0

我正在使用可配置产品,并且我在 Magento 的后端设置了选项以显示含税和不含税的价格。

我的问题是,在可配置产品选项的下拉列表中,它还显示了含税和不含税。

我需要它在产品页面的价格区域中显示这两个选项,但在下拉列表中仅显示不包括税,因此它删除了包含税我已附上屏幕截图,红色区域需要删除。

在此处输入图像描述

4

1 回答 1

2

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

在 app/design/frontend/default/YOURTEMPLATE/template/catalog/product/view/type/options/ 中找到文件可配置的.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

希望这可以帮助

于 2013-03-06T11:58:04.660 回答