In my shop I have tier prices for some products. And what I am trying to do is if the customer is logged in I want to display them tier price in products category instead of regular price.

In catalog/product/price.phtml currently I am having this:

<?php if(Mage::getSingleton('customer/session')->isLoggedIn()):
    $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();

    $prod = $this->getProduct();
    $tierPrice = $prod->getPriceModel()->getFinalPrice($groupId, $prod);

But the tier price is wrong (I am getting 60). So I dump (var_dump($prod)) the product object to see what's wrong. And this is what I get (here the tier price is correct):

object(Mage_Catalog_Model_Product)#1158 (32) { ["_cacheTag":protected]=> string(15) "catalog_product" ["_eventPrefix":protected]=> string(15) "catalog_product" ["_eventObject":protected]=> string(7) "product" ["_canAffectOptions":protected]=> bool(false) ["_typeInstance":protected]=> NULL ["_typeInstanceSingleton":protected]=> object(Mage_Catalog_Model_Product_Type_Simple)#435 (9) { ["_product":protected]=> NULL ["_typeId":protected]=> NULL ["_setAttributes":protected]=> NULL ["_editableAttributes":protected]=> NULL ["_isComposite":protected]=> bool(false) ["_canConfigure":protected]=> bool(false) ["_canUseQtyDecimals":protected]=> bool(true) ["_storeFilter":protected]=> NULL ["_fileQueue":protected]=> array(0) { } } ["_linkInstance":protected]=> NULL ["_customOptions":protected]=> array(0) { } ["_urlModel":protected]=> object(Mage_Catalog_Model_Product_Url)#672 (7) { ["_data":protected]=> array(0) { } ["_hasDataChanges":protected]=> bool(false) ["_origData":protected]=> NULL ["_idFieldName":protected]=> NULL ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } } ["_errors":protected]=> array(0) { } ["_optionInstance":protected]=> NULL ["_options":protected]=> array(0) { } ["_reservedAttributes":protected]=> NULL ["_isDuplicable":protected]=> bool(true) ["_calculatePrice":protected]=> bool(true) ["_defaultValues":protected]=> array(0) { } ["_storeValuesFlags":protected]=> array(0) { } ["_lockedAttributes":protected]=> array(0) { } ["_isDeleteable":protected]=> bool(true) ["_isReadonly":protected]=> bool(false) ["_resourceName":protected]=> string(15) "catalog/product" ["_resource":protected]=> NULL ["_resourceCollectionName":protected]=> string(26) "catalog/product_collection" ["_dataSaveAllowed":protected]=> bool(true) ["_isObjectNew":protected]=> NULL ["_data":protected]=> array(40) { ["entity_id"]=> string(5) "16214" ["entity_type_id"]=> string(2) "10" ["attribute_set_id"]=> string(1) "9" ["type_id"]=> string(6) "simple" ["sku"]=> string(4) "A155" ["created_at"]=> string(19) "2013-10-14 22:28:27" ["updated_at"]=> string(19) "2014-05-02 13:48:22" ["has_options"]=> string(1) "0" ["required_options"]=> string(1) "0" ["relevance"]=> string(6) "1.0000" ["price"]=> string(7) "60.0000" ["tax_class_id"]=> string(1) "0" ["final_price"]=> float(60) ["minimal_price"]=> string(7) "39.0000" ["min_price"]=> string(7) "60.0000" ["max_price"]=> string(7) "60.0000" **["tier_price"]=> string(7) "39.0000"** ["cat_index_position"]=> string(6) "850001" ["name"]=> string(60) " ISO lizdas 36 pin-4RCA lizdai,CD grot. jungtis -ISO 21051 " ["small_image"]=> string(18) "/i/m/image_508.jpg" ["url_key"]=> string(55) "iso-lizdas-36-pin-4rca-lizdai-cd-grot-jungtis-iso-21051" ["thumbnail"]=> string(18) "/i/m/image_508.jpg" ["image_label"]=> string(4) "A155" ["small_image_label"]=> string(4) "A155" ["thumbnail_label"]=> string(4) "A155" ["msrp_enabled"]=> string(1) "2" ["msrp_display_actual_price_type"]=> string(1) "4" ["special_price"]=> NULL ["msrp"]=> NULL ["status"]=> string(1) "1" ["short_description"]=> string(60) " ISO lizdas 36 pin-4RCA lizdai,CD grot. jungtis -ISO 21051 " ["special_from_date"]=> NULL ["news_from_date"]=> NULL ["news_to_date"]=> NULL ["special_to_date"]=> NULL ["request_path"]=> string(60) "iso-lizdas-36-pin-4rca-lizdai-cd-grot-jungtis-iso-21063.html" ["is_salable"]=> string(1) "1" ["stock_item"]=> object(Varien_Object)#1155 (7) { ["_data":protected]=> array(1) { ["is_in_stock"]=> string(1) "1" } ["_hasDataChanges":protected]=> bool(false) ["_origData":protected]=> NULL ["_idFieldName":protected]=> NULL ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } } ["group_price"]=> array(0) { } ["group_price_changed"]=> int(0) } ["_hasDataChanges":protected]=> bool(true) ["_origData":protected]=> NULL ["_idFieldName":protected]=> string(9) "entity_id" ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } }

So how should I get tier price value 39 instead of 60 ?

Thanks in advance.

  • there is a logical error in the first parameter of GetFinalPrice you pass the groupId BUT the function definitions is the following double getFinalPrice ([double $qty = null], Mage_Catalog_Model_Product $product) you can see that the first parameter is not the customer group id but the requested quantity. Use the public function getGroupPrice($product) if you wanto to get the group price – Giuseppe Jan 27 '15 at 16:24

Maybe you try to get a group price. If you want to get the tier price (http://www.magentocommerce.com/knowledge-base/entry/tier-pricing)

you should call


$qty is null will return the FinalPrice instead.

reference Model -> Product

public function getTierPrice($qty=null)
| improve this answer | |
  • Thank you for your answer but I am still not getting the right price. I tried getTierPrice() method and I get this: array(1) { [0]=> array(4) { ["price"]=> string(7) "60.0000" ["website_price"]=> string(7) "60.0000" ["price_qty"]=> int(1) ["cust_group"]=> int(32000) } } – intentarr May 4 '14 at 12:10
  • according to Model Product public function getTierPrice($qty=null) { return $this->getPriceModel()->getTierPrice($qty, $this); } you need to give it a qty which in your case is 1. call $prod->getTierPrice(1); you will get that. :) – Tai May 5 '14 at 1:08
  • Ok, so now I'm getting the price which is 60. The strange thing that using this method as you see from my previuos comment doesn't show the correct tier price. It shows only regular price which is 60. As you see from my question the tier price should be 39 and the product object has it but I still can't figure out how I should get :/ – intentarr May 5 '14 at 5:54
  • Ok, so I am not sure if it is correct way of doing this but I am getting tier price using getData ($tierPrice = $prod->getData('tier_price');) – intentarr May 5 '14 at 6:23
  • it's same thing. :) I try these code it works on CE v.1.7.2. – Tai May 5 '14 at 23:24

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.