cancel
Showing results for 
Search instead for 
Did you mean: 

Show Product Price Range

Show Product Price Range

How do you show the price range for a configurable product that contains simple products?

12 REPLIES 12

Re: Show Product Price Range

 
Edit the file from below path and add code which you want to display on front-end.
 
app\design\frontend\myPackage\myTheme\default\template\catalog\product\view.phtml
 
<?php 
    $productId = $_product['entity_id'];
    $product = Mage::getModel('catalog/product')->load($productId);
    $block = Mage::app()->getLayout()->createBlock('catalog/product_view_type_configurable');
    $block->setProduct($product);
    $config = json_decode($block->getJsonConfig(), true);
    $basePrice = $config['basePrice'];
    $min = null;
    $max = null;
    foreach ($config['attributes'] as $aId=>$aValues){                
            foreach ($aValues['options'] as $key=>$value){
                    if (is_null($min) || $min>$value['price']){
                        $min = $value['price'];
                    }
                    if (is_null($max) || $max<$value['price']){
                        $max = $value['price'];
                    }
             }
     }
    //until here we have the min and max price differences. Now just add the base price.
    echo "MinimumPrice :- " . $min += $basePrice . "</br>";
    echo "MaximumPrice :- " . $max += $basePrice . "</br>";                           
?>
 
Hope this helps you.
Query solved? Accept as Solution.Thanks
Eric Baily

Re: Show Product Price Range

Hello,

I copied and pasted the code you provided into the view.phtml page and it does not work:

 

http://45.40.134.230/~sportsmedcom/index.php/por-marca/cramer.html

 

Any ideas? Thank you.

Re: Show Product Price Range

Hi @jeffgrech

 

The code is working absolutely fine at our end. Can you please share your FTP details so we can solve your query.

Query solved? Accept as Solution.Thanks
Eric Baily

Re: Show Product Price Range

 

Re: Show Product Price Range

Hi @jeffgrech

 

We have followed the same code we mentioned above.

 

Kindly check at your end now its done. http://45.40.134.230/~sportsmedcom/index.php/por-marca/cramer/original-tuf-skin-spray.html

Query solved? Accept as Solution.Thanks
Eric Baily

Re: Show Product Price Range

Hello,

Just checked and it seems a little buggy.

 

This is what we are looking for on the catalog page:

http://45.40.134.230/~sportsmedcom/screencaps/storefront-products-electronics.png

 

Also on the actual product page, it should look like this:

http://45.40.134.230/~sportsmedcom/screencaps/storefront-products-page.png

 

Let me know if this is possible.

 

Thank you,

 

 

Re: Show Product Price Range

Hi @jeffgrech

 

Let's have brief session on skype.

Query solved? Accept as Solution.Thanks
Eric Baily

Re: Show Product Price Range

Hi @jeffgrech

 

Let's have brief session on Skype.

Query solved? Accept as Solution.Thanks
Eric Baily

Re: Show Product Price Range

Hello,

I sent you a contact request to SKYPE.

 

Thank you,