Magento 1.9 – Always Show Lowest Price for Grouped Product with Tiered Pricing on Category View

magento-1.9tierprice

We have many grouped products that use tiered pricing on the simple products as we sell mostly wholesale. Magento shows a starting at price in the category view but what it shows is the lowest Each price for the simple products. We want to display the lowest tier price of the lowest cost item in the grouped product.

I believe I need to edit the price.phtml file for my template. I have already made a couple changes so everything says "Starting at:" uniformly across the site. Just not sure how to tell it to grab lowest tier price instead of lowest each price.

I have found some others asking for the same thing but I haven't found any response to the question. Hopefully mine will do a little better.

Best Answer

I found something that works for my needs.
User MTM posted a solution to this issue in this post.
MTM's solution is as follows.

To check the tier price of any product, you can use the following code in the conditions :

<?php
$tierprices = array();
if ($_product->getTypeId() == 'grouped'){
    $associatedProducts = $_product->getTypeInstance(true)->getAssociatedProducts($_product);
    foreach ($associatedProducts as $assoc_product) {
    //$assoc_product = Mage::getModel('catalog/product')->load($assoc_product->getId());// use this only if necessary
        if($assoc_product->getTierPrice()){
            $product_tier_prices = $this->getTierPrices($assoc_product);
            if(count($product_tier_prices) > 0){
                $product_tier_prices = (object)$product_tier_prices;
                foreach($product_tier_prices as $key=>$value){
                    $value = (object)$value;
                    $tierprices[] = $value->price;
                }
            }
        }  
    }
} ?>

In this way you will get tier prices of all the associated products of Group product. You need to use the following condition to display "minimum tier" or "as low as":

<?php if(count($tierprices) > 0){ ?>
    <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
        <?php echo $_coreHelper->currency(min($tierprices), true, false) ?>
    </span>

<?php } else { ?>
all your rest of normal price will come here.
<?php } ?>
Related Topic