1

I have following codes on my home page product listing. I have to calculate the difference between lowest tier price and normal price of a product, But I can't find the lowest tier price. All other information about product are coming but lowest tier price. I can't understant what to do as I am new to magento. Please help. Here is the code snippet..

<?php  
$storeId = Mage::app()->getStore()->getId();  
$_productCollection=Mage::getResourceModel('catalog/product_collection')
        ->addAttributeToSelect('*')
        ->addAttributeToFilter('is_featured', 1)
        ->addAttributeToFilter('status', 1)
        ->joinField('value','catalog_product_entity_tier_price','value', 'entity_id=entity_id','{{table}}.website_id='.$storeId, 'left')
        ->setPageSize(9)
        ->setStoreId($storeId)
        ->addStoreFilter($storeId);  
foreach ($_productCollection as $_product):  
$lowestTierPrice = product->getResource()->getAttribute('tier_price')->getFrontend()->getValue($_product); //It is not working  
$normalPrice = $_product->getPrice();  //it works fine  

print_r($_product->getTierPrice()); //getting all the tier price
endforeach;

1
  • join ` ->addMinimalPrice() ->addFinalPrice() ->addTaxPercents()` to collecton got getting mininal porice
    – Amit Bera
    Commented Sep 23, 2015 at 5:36

1 Answer 1

1

For getting tier price you does not need to use

 ->joinField('value','catalog_product_entity_tier_price','value', 'entity_id=entity_id','{{table}}.website_id='.$storeId, 'left')

and

lowestTierPrice = product->getResource()->getAttribute('tier_price')->getFrontend()->getValue($_product); //It is not working  

And add below code inside foreach loop.

$TierPirce=Mage::getModel('catalog/product_type_price')->getTierPrice(null,$_product);
3
  • $TierPirce=Mage::getModel('catalog/product_type_price')->getTierPrice(null,$$_product);print_r($TierPirce); gives me only normal price. Commented Sep 23, 2015 at 7:16
  • there have syntax mistake.. i have edit that .. now see
    – Amit Bera
    Commented Sep 23, 2015 at 7:17
  • I had modified that one "$$_product". It gives me normal price (one item). but ->addMinimalPrice() ->addFinalPrice() ->addTaxPercents(); lowestTierPrice = product->getResource()->getAttribute('tier_price')->getFrontend()->getValue($_product); gives me lowest tire price. is it right ? Commented Sep 23, 2015 at 7:21

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.