我对基于客户群的产品设置了不同的价格。如果两个产品都应用于产品清单,查看,相关产品和追加销售产品,我希望向客户展示这两种价格。Magento - 无法在产品视图中显示层定价
我打开模板路径的提示,以确认价格的观点,都是从同一个模板文件,它是呈现如下:
/应用程序/设计/前端/默认/ my_theme /模板/目录/产品
我可以在产品清单,相关产品和加售产品中正确看到层级定价,但不能用于产品视图。
调试了一段时间后,我已经收窄目录/产品/ price.phtml文件的部分问题如下:
<?php
$_coreHelper = $this->helper('core');
$_weeeHelper = $this->helper('weee');
$_taxHelper = $this->helper('tax');
$_product = $this->getProduct();
$_id = $_product->getId();
echo 'Product Id: ' . $_id;
$_weeeSeparator = '';
$_simplePricesTax = ($_taxHelper->displayPriceIncludingTax() || $_taxHelper->displayBothPrices());
echo 'Simple Price Tax: ' . $_simplePricesTax;
$_minimalPriceValue = $_product->getMinimalPrice();
echo 'Minimal Price Value: ' . $_minimalPriceValue;
//$_minimalPriceValue = 41;
$_minimalPrice = $_taxHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax);
echo 'Minimal Price: ' . $_minimalPrice;
//$_minimalPrice = 41;
?>
我也附和所有价格从上述模型中取出,只有在的情况下,产品查看页面上面的$ _product-> getMinimalPrice()不会返回任何内容,但它在列表,相关和追加销售产品上正确显示。
我想不出任何理由。 catalog.xml中有几行不同,但我认为他们没有任何关系。此外,在上面的代码中有几条注释行,我已经对minimalPrice和minimalPriceValue变量进行了硬编码。这样做后价格也开始出现在产品视图中。包括产品视图在内的所有视图的产品ID也显示正确,因此当时产品已加载。
我们正在使用自定义模板,我发现默认情况下我们没有这个问题。我正在使用Magento 1.4.1.1
这终于帮我达成了解决方案。对于产品视图,层级价格通过 /catalog/product/view/tierprices.phtml获取并显示。对于这个被称为下面的行应该是 /catalog/product/view.phtml '<?php echo $ this-> getTierPriceHtml()?>' – 2010-12-02 15:35:23