1

i'm wondering how to get the normal price (before discount) for a grouped product in list.phtml, i only know how to get the special price by the following code

<?php echo 'From: '.$_coreHelper->formatPrice($_product->min_price, false).' - '.$_coreHelper->formatPrice($_product->max_price, false); ?>

but how to get min/max regular price?

3

I know this question has been asked while ago, but I'm gonna answer it anyway if it helps anyone.

So one thing you could try is following which would work in some instances,

$_product->getMaxPrice();

But it didn't work for me in my case, So I came up with following snippet, which is what I have implemented on our site working perfectly and much more robust,

    $_model_group_prod = Mage::getModel('catalog/product_type_grouped');
    $_associated_products = $_product->getTypeInstance(true)->getAssociatedProducts($_product);

    foreach( $_associated_products as $_associated_product ) {

        if( $_associated_product->getPrice() >= $regular_price ) {

            $regular_price = $_associated_product->getPrice();

        }

    }

echo 'Regular/Max Price: '.$_coreHelper->formatPrice($regular_price, false);
  • 2
    This looks nice, but maybe you should use getFinalPrice instead of getPrice for the associated products. There might be discount rules or special prices affecting them. getPrice will give you only the original price. – Marius Nov 25 '16 at 13:59

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.