首页 文章

Magento从可配置的下拉列表中删除Incl Tax

提问于
浏览
0

我正在使用可配置的产品,我已经在Magento的后端设置了选项,以显示价格Incl TAX和Excl Tax .

我的问题是,在可配置产品选项的下拉列表中,它还显示Incl TAX和Excl TAX .

我需要它在产品页面的价格区域中显示两个选项,但在下拉列表中仅显示Excl Tax,因此它删除了Incl TAX我已经获得了屏幕截图,需要删除红色区域 .

enter image description here

1 回答

  • 2

    我已经得到了一些外部帮助,并提出了解决方案 . 这是基于Magento 1.5.1.0 .

    在app / design / frontend / default / YOURTEMPLATE / template / catalog / product / view / type / options /中找到文件configurable.phtml .

    替换这个:

    <script type="text/javascript">
        var spConfig = new Product.Config(<?php echo $this->getJsonConfig(); ?>);
    </script>
    

    有了这个:

    <?php
    // get current drop down string
    $currentstring = $this->getJsonConfig();
    
    // create new string with true set to false using str_replace function (string replace)
    $newstring = str_replace( '"showBothPrices":true,"', '"showBothPrices":false,"', $currentstring );
    
    ?>
    <!-- render dropdown but with new var ($newstring) -->
    <script type="text/javascript">
        var spConfig = new Product.Config(<?php echo $newstring ?>);
    </script>
    

    这仅适用于可配置产品 . 如果你想为简单产品的自定义选项做同样的事情,只需改变这个:

    <?php echo $this->getValuesHtml() ?>
    

    为了这:

    <?php echo preg_replace("/\([^)]+\)/","", $this->getValuesHtml()); ?>
    

    在此文件中:app / design / frontend / default / YOURTEMPLATE / template / catalog / product / view / options / type / select.phtml

    希望这可以帮助

相关问题