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

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

1 Answer 1

2

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;
    }   
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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