Wednesday, November 24, 2010

How to add tier prices in the product list

Inside the app/design/frontend/{interface}/{theme}/template/catalog/product/list.phtml add this inside the foreach loops for grid and/or list
<?php $this->setProduct(Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($_product->getId()))?>
<?php echo $this->getTierPriceHtml() ?> 

It does not look nice for grid but it can be fixed by css.

6 comments:

  1. Hello, conglatourations for this blog, it's very useful for me so I thank you very much. I've tried this code but it dosn't work, could you help about it. It's very important to me to show tier prices in list view.

    Thanks in advance and best regards,

    ReplyDelete
  2. Sorry about that. I forgot to replace some > and < with &gt; and &lt; and the code appeared broken.
    I think I fixed it. You can try it now

    ReplyDelete
  3. Great!!, thanks a lot, you help me. Thank you very much.

    BR Jose.

    ReplyDelete
  4. Hi tzyganu,

    Works like a charm!!!

    Keep up the good work ;-)

    Cheers,

    Steve

    ReplyDelete
  5. Works great - but how can I change the UL and LI styling of the output? I currently have it in enclosed in a span with a class called 'grid_tier_price' but I cannot get it to override the .product-pricing, .tier-prices styling!

    Thanks!

    ReplyDelete
    Replies
    1. Hello
      I think you ca change the template of the tier prices like this.
      Instead of <php echo $this->getTierPriceHtml() ?>
      Do this:
      <?php echo $this->setTierPriceTemplate('catalog/product/view/tierprices_custom.phtml')->getTierPriceHtml() ?>

      Create the file catalog/product/view/tierprices_custom.phtml (you can copy the content from catalog/product/view/tierprices.phtml) aned etit that file and make it look like you want.
      Cheers,
      Marius.

      Delete