Magento从可配置下拉列表中删除包含税款 [英] Magento remove Incl Tax from configurable dropdown

查看:107
本文介绍了Magento从可配置下拉列表中删除包含税款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用可配置的产品,并且在Magento的后端设置了显示价格的选项,包括TAX和Excl Tax。



我的问题是,我们需要它在产品页面的价格区域中显示这两个选项,但仅限于Excl(税前)和Excl Tax(税前)。

在下拉列表中扣除税款,因此它删除了Incl TAX我收到了屏幕截图,需要删除红色区域。

$ b

解决方案

帮助解决这个问题并提出解决方案。这是基于Magento 1.5.1.0。



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



替换为:

 <脚本类型= 文本/ JavaScript的 > 
var spConfig = new Product.Config(<?php echo $ this-> getJsonConfig();?>);
< / script>

有了这个:

 <?php 
//获取当前下拉字符串
$ currenttring = $ this-> getJsonConfig();

//使用str_replace函数(字符串替换)将true设置为false来创建新字符串
$ newstring = str_replace('showBothPrices:true,','showBothPrices:false ,',$ currentstring);

?>
<! - 呈现下拉列表,但新的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



希望这有助于


I am using configurable products and I have set the option in the backend of Magento to show prices Incl TAX and Excl Tax.

My problem is that with this inside the dropdown for the configurable products options it also shows both Incl TAX and Excl TAX.

I need it to show both options in the price area on the product page but only Excl Tax in the dropdown so it removes the Incl TAX I have attahced a screenshot the areas in red need to be removed.

解决方案

I've had some external help with this and come up with a solution. This is based on Magento 1.5.1.0.

Locate the file configurable.phtml in app/design/frontend/default/YOURTEMPLATE/template/catalog/product/view/type/options/.

Replace this:

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

With this:

<?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>

This will only work for configurable products. If you want to do the same thing for custom options of simple products just change this:

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

For this:

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

In this file: app/design/frontend/default/YOURTEMPLATE/template/catalog/product/view/options/type/select.phtml

Hope this helps

这篇关于Magento从可配置下拉列表中删除包含税款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆