Display First Tier Price as default Price

2019-09-02 18:21发布

问题:

I am working on a project to display the first Tier Price as the default Price for a Magento website. Following is what I have done so far:

  1. edited the price.phtml file

  2. replaced

    $_product = $this->getProduct();

with

$_product = $this->getTierPrice($quantity);

On line 44

I tested this out and this isn't working the way I expected. Am I missing something?

回答1:

Oh, just to check at the start, your code is like this, yes?:

$_product = $this->getProduct();              //$this is Mage_Catalog_Block_Product_Abstract
$price = $_product->getTierPrice($quantity);  //$_product is Mage_Catalog_Model_Product

So with the variable $_product representing the actual product model, can you tell us what value is returned from these function calls:

$dummyPrice = $this->getTierPrice($quantity);
$dummyPrice = $this->getTierPrice(1);
$dummyPrice = $this->getTierPrice(); //should return an array of the tiers
$dummyPrice = $this->getFormatedTierPrice(1);
$dummyPrice = $this->getFormatedTierPrice();//should return an array of the tiers


标签: magento