微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – Magento的$_weeeHelper-> typeOfDisplay()方法

我正在调查Magento臭名昭着的价格块/ price.phtml文件,我遇到的东西看起来像一个bug和/或废弃的代码路径,但我想首先由社区运行它以确保我理解发生了什么.

在整个文件中,Magento将在条件调用中使用以下方法

$_weeeHelper->typeOfdisplay($_product, 0)
$_weeeHelper->typeOfdisplay($_product, 1)
$_weeeHelper->typeOfdisplay($_product, 4)
$_weeeHelper->typeOfdisplay($_product, 2)

根据我的代码跟踪收集的内容,此方法(如所调用的)最终将第二个参数与两个配置值中的一个进行比较.或

Tax -> Fixed Product Taxes -> display Prices On Product View Page
Tax -> Fixed Product Taxes -> display Prices In Product Lists

取决于当前的背景.如果我们在产品页面上,那就是第一个.否则,它采用产品列表页面. (以及“在产品页面上”表示在Mage :: registry(‘current_product’)中设置了一个值).

除了下面的电话,这一切都很好

$_weeeHelper->typeOfdisplay($_product, 4)

这些配置字段的唯一可能值是0 – 3.没有“4”.

那么,第一个问题:上面是否准确描述了typeOfdisplay方法的行为? (假设$zone参数为null)

第二个问题:如果是这样的话,Magento的版本是否存在(或者存在)版本中存储了值为“4”的版本

Tax -> Fixed Product Taxes -> display Prices In Product Lists
Tax -> Fixed Product Taxes -> display Prices On Product View Page

领域?

解决方法:

好吧,也许这是部分答案……

在CE 1.3.3.0中,似乎确实存在4的值.

class Mage_Weee_Model_Config_Source_display
{

    public function toOptionArray()
    {
        return array(
            array('value'=>0, 'label'=>Mage::helper('weee')->__('Including FPT only')),
            array('value'=>1, 'label'=>Mage::helper('weee')->__('Including FPT and FPT description [excl. FPT VAT]')),
            array('value'=>4, 'label'=>Mage::helper('weee')->__('Including FPT and FPT description [incl. FPT VAT]')),
            array('value'=>2, 'label'=>Mage::helper('weee')->__('Excluding FPT, FPT description, final price')),
            array('value'=>3, 'label'=>Mage::helper('weee')->__('Excluding FPT')),
        );
    }

}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐