1

I made a .phtml block which should display the lowest price by the parameter sku

{{block type="core/template" sku="theproductsku" template="getlowestprice.phtml"}}

and the getlowestprice.phtml looks like this

$_product = Mage::getModel('catalog/product')->loadByAttribute('sku',$this->sku);
$price=$prod->getPrice();

While getting price works just fine, getting the tier price like I used in product view doesnt work:

$prices = $this->getTierPrices($_product);

($prices equals NULL)

Is there any workaround to get tier prices outside product view?

7
  • Question was already answered: magento.stackexchange.com/questions/1283/…
    – mbalparda
    Jun 9, 2014 at 19:01
  • doesnt work unfortunately, tried all answers, even getTierPricesHtml() does not work :( Jun 9, 2014 at 19:35
  • $custom = Mage::getModel('catalog/product')->loadByAttribute('sku',$this->sku); var_dump($custom->getTierPrice());
    – Charlie
    Jun 13, 2014 at 13:37
  • @Charlie thank you worked perfectly, pls post as answer to get reward Jun 13, 2014 at 14:54
  • @Tearsdontfalls. Sorry for Late reply, I am out for the weekend.
    – Charlie
    Jun 16, 2014 at 6:32

3 Answers 3

2
+50
$custom = Mage::getModel('catalog/product')->loadByAttribute('sku',$this->sku); var_dump($custom->getTierPrice());
6

To simply get all the tier prices you could try the following:

$prices = $product->getFormatedTierPrice();

The reason your call for $this->getTierPrices($_product); is not working is because your block it not of a type that extends Mage_Catalog_Block_Product_Abstract which contains this getTierPrices function.

What you could do would be to use this function would be to make your own block that extends this and then use that instead of core/template

2

Create your own custom block

$_tierPricing = $this->getLayout()->createBlock(
    'catalog/product_view',
    'product.tierprices',
    array(
        'product_id' => $yourproductId
    )
);
$_tierPricing->setTemplate('catalog/product/view/tierprices.phtml');

<?php echo $_tierPricing->getTierPriceHtml();?>

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.