1

I have a configurable product with a number of simple products associated with it.

I am showing the lowest price simple product on the product page with this code:

$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product); 
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions()->addAttributeToSort('Price', 'asc'); 

foreach($simple_collection as $simple_product){ 
echo '</br>Price: ' . Mage::helper('core')->currency($simple_product->getPrice()) . '</br></br>';
break;
}

I have a banner on the homepage which is where I want to show the price for a certain product.

I need to modify this code to load the price from configurable product ID 80 and show it on the Homepage

  • are you need lowest price simple product in homepage banner right? – Abdul Dec 18 '15 at 11:57
  • Yes. I need to pull data using the product ID if that's possible – Mike Tim Turner Dec 18 '15 at 11:59
  • configurable product ID fixed? – Abdul Dec 18 '15 at 12:00
  • It doesnt change as far as I'm aware – Mike Tim Turner Dec 18 '15 at 12:02
1

Try bellow code

$_product = Mage::getModel('catalog/product')->load(80);
if($_product->isconfigurable()) {
    $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product); 
    $simple_collection = $conf->getUsedProductCollection()
                        ->addAttributeToSelect('*')
                        ->addFilterByRequiredOptions()
                        ->addAttributeToSort('Price', 'asc'); 

    foreach($simple_collection as $simple_product){ 
    echo '</br>Price: ' . Mage::helper('core')->currency($simple_product->getPrice()) . '</br></br>';
    break;
    }   
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.