在1.6多个版本的Magento中存在一个突出的错误,当选择一个选项时,等级价格的节省百分比默认为100%.其他贡献者建议在747行附近更改product.js
for (var i = 0; i < this.tierPrices.length; i++) {
Run Code Online (Sandbox Code Playgroud)
成为
for (var i = 0; i > this.tierPrices.length; i++) {
Run Code Online (Sandbox Code Playgroud)
这解决了%节省的问题,但从未执行过代码块.我绝不是Javascript专家,但是当选择选项时,此块似乎更新了层级价格和%节省.我想找到问题的根源,而不是"评论出来".
根据我在Firebug中的调试,我注意到product.js中的等级价格类是错误的,因此,检索的等级价格为0,这说明为什么%节省总是100%.Firebug显示价格为
class="tier-prices product-pricing">
Buy 10 for
<span class="price">$40.00</span>
Run Code Online (Sandbox Code Playgroud)
而product.js正试图使用
$$('.price.tier-' + i).each(function (el) {
Run Code Online (Sandbox Code Playgroud)
如果您将上述内容更改为
$$('.tier-prices .price).each(function (el) {
Run Code Online (Sandbox Code Playgroud)
检索层级价格,但对于产品的多个层级价格,无法单独引用它们.上面的"价格"类没有声明唯一标识符或迭代编号.
在等级价格中,class ="price"在哪里?在tierprices.phtml的代码中,它看起来像这样
<?php echo $this->__('Buy %1$s for %2$s each', $_price['price_qty'], $_price['formated_price'])?>
Run Code Online (Sandbox Code Playgroud)