Get Lowest Tier Price
A few weeks ago we were scratching our heads in confusion on how to get the lowest tier-price from magento. If you take a look at your catalog>product>view>tierprices.phtml you will see why – why does such a complicated section of code even exist?
Anyway after a few failed attempts we were contacted this morning by Christiaan who asked us this question a few weeks ago on the magento forums. We took this as a challenge and set to work this very morning sorting it out.
After a few black coffees we finally figured it out…or at least got rid of the rubbish that was concealing it. We now have a little method to bring back the lowest tier price on a magento product view page!
Here is how you do it:
1. Create a file in your product>view folder called getlowest.phtml
Copy & paste the following into it:
<?php
/**
* @E-Commercewebdesign.co.uk
*/
$_product = $this->getProduct();
$_tierPrices = $this->getTierPrices();
$_finalPriceInclTax = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice(), true);
$_weeeTaxAmount = Mage::helper('weee')->getAmountForDisplay($_product);
if (Mage::helper('weee')->typeOfDisplay($_product, array(1,2,4))) {
$_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
}
?>
<?php if (count($_tierPrices) > 0): ?>
<?php if ($this->getInGrouped()): ?>
<?php $_tierPrices = $this->getTierPrices($_product); ?>
<?php endif; ?>
<?php Mage::helper('weee')->processTierPrices($_product, $_tierPrices); ?>
<?php $i = 0; ?>
<?php $_tierPrices = array_reverse($_tierPrices); ?>
<?php foreach ($_tierPrices as $_price): ?>
<?php if($i==0){ ?>
<p style="font-weight:bold; font-size: 1em;">After tier pricing the lowest price you can have a Cowboy Hat is...
<span style="font-size:150%; text-decoration:underline;">
<?php echo $_price['formated_price']; ?>
</span>
<p>
<?php $i++; ?>
<?php } ?>
<?php endforeach ?>
<?php endif;?>
As you can see you can edit some words above to output whatever you like around this lowest price – could be on top of an image or simply surrounded by text like above.
2. Open your themes catalog.xml and paste in the following code:
<block type="catalog/product_view" name="getlowest" as="getlowest" template="catalog/product/view/getlowest.phtml" />
3. Call this function on your product>view.phtml
<?php echo $this->getChildHtml('getlowest') ?>
There you have it! This code will output the lowest price of your tier prices dynamically – and will also not show anything if tier-prices are not activated for the product.
Thanks for visiting our magento blog at ecommerce website design – home of the (newly styled!) magneto fox. Take Care.


Thanks Robert! You’d just put me in the right direction using this post. Have it working right now!
Thanks you very much for this awesome piece of code. you published on the same day that I needed it, hence my deep appreciation.
one question: there is a function called getDisplayMinimalPrice() in app\code\core\Mage\Catalog\Block\Product\Price.php, do you have any idea what this does? does it interfere with your code at all?
anyway, thanks for the great help.
Hi Jason,
It wouldn’t interfere with the code I don’t think – it’s just hit and miss whether that will show on the product view page – you should give it a go though and if it works nicely I’ll add to this post for the benefit of others.
Cheers,
Rob
I have actually managed to put this function into the Product class itself.
in X:\htdocs\magento2\app\design\frontend\default\magesupport\template\catalog\product, add this function:
public function getLowestPrice($_product)
{
$prices = new Mage_Bundle_Block_Catalog_Product_View();
$_tierPrices = $prices->getTierPrices($_product);
$count = $_product->getTierPriceCount();
if ($count > 0):
$i = 0;
$_tierPrices = array_reverse($_tierPrices);
foreach ($_tierPrices as $_price):
if($i==0){
return $_product->getFormatedTierPrice($_price);
$i++;
}
endforeach;
endif;
}
after this, you can retrieve lowest tier price anywhere by simply calling
$_product = $this->getProduct();
$_product->getLowestPrice($_product);
im immature in Magento programming. it may not be the most efficient way but i found it neater to put all the logic in one place, whic can be called anywhere else.
correction to my previous post!
the function should be added in this file:
app\code\core\Mage\Catalog\Model\Product.php
just replace that in my original post plz. cheers
Jason
This works perfect on the product view, but what about the product listing? There the tierprice array contains only the normal single price. Any idea?
Hi Robert,
I´m scratching my head too, in confusion on how to get the lowest price (minimal price) on my product page. But the absolut minimal price for exemple, a product have tier-price and option price too (T-shirt white cheaper as black). In the front of the price I need “as low as”. In Germany is this a “It must be” if you understand what I mean. I´m dispairing. Can you help??
Can this code be modified to suit my needs ?
What i am trying to do is make some kind of new function or modify function inside price.phtml file so when a ” As low as ” price exists
the regular price will be hidden , when there is no As low as then regular price is displayed
thank you
Great code but i’m after something a little simpler! I have 1.4.2.0 on the modern theme, and all i want is for the lowest tier price to replace the standard price in the grid/list pages, am i missing some option in magento config pages???? Mike
Hi,
I have the same problem with grouped products. Can anyone tell me how I can this get worked for grouped products? I want to output the pirce of the grouped product with the lowest price. Christian
Hi,
At what line in the files mentioned at step 2 and 3 should the codes in step 2 and 3 be placed?
Hi Wout,
Did you find a solution to your question…?
Please share with me too as i don’t get this to work
Hi Robert,
how can I add “from” in the price-box ??
How to Get Lowest Tier Price in product view at magento 1.6.0?
Hi Shafraz,
Until now I didn’t succeed nor received any response from the e-commercewebdesign.co.uk team sofar.
You can read any (succesfull) update here!
Hi Wout,
This worked me with following steps.
Step 1
save the getlowest.phtml file in app/design/frontend/yourtheme/default/template/catalog/product/view/getlowest.phtml
Step 2
in app/design/frontend/yourtheme/default/layout/catalog.xml find the comment “” and include the block into content area.
Step 3
goto app/design/frontend/yourtheme/default/template/catalog/product/view.phtml and include the following lines
<?php echo $this->getTierPriceHtml() ?> <?php echo $this->getChildHtml('getlowest'); // our lowest tier price block?> <?php echo $this->getChildHtml('extrahint') ?>hope you can understand this and will help you.
@Shafraz: thanks got it working in that way!
Next question: I now both have the productprice and lowest tierprice showing up whereas I would like the lowest tierprice to be shown instead of the productprice?
As in the image at the beginning of this article with the hat and tierprices, I still have a productprice before the tierprices.
Any clue how to achieve this?
@Wout: i guess if you comment out following line of code, you can hide the base price.
I havn’t tried it though.
<?php echo $this->getChildHtml('product_type_data') ?>if not worked try googling in magento forum. I am sure a working solution should be there.
Id like to show the lowest price on the Category listing page (list.phtml). Any ideas?
Likewise. has anyone managed to display the lowest price on the category listing page? (list.phtml)
I am also looking to extend this to the category listings.
I’m kinda surprised that no-one suggested replacing this:
<?php $i = 0; ?> <?php $_tierPrices = array_reverse($_tierPrices); ?> <?php foreach ($_tierPrices as $_price): ?> <?php if($i==0){ ?> <p style="font-weight:bold; font-size: 1em;">After tier pricing the lowest price you can have a Cowboy Hat is... <span style="font-size:150%; text-decoration:underline;"> <?php echo $_price['formated_price']; ?> </span> <p> <?php $i++; ?> <?php } ?> <?php endforeach ?>With this:
array_pop() should do the same as reversing the array then looping through it to find only the first element by a counter variable comparison.