简体   繁体   English

Magento-在产品页面上选择选项不会刷新

[英]Magento - Selecting an option on a product page does not refresh

I have the following code for the "Percentage Off" of a product 对于产品的“关闭百分比”,我有以下代码

located next to the Price shown on each product page /template/catalog/product/price.phtml 位于每个产品页面上显示的价格旁边/template/catalog/product/price.phtml

<span class="per_mk" id="percent-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>">
<?php
$msrp_mk = $_product->getMsrp();
if ($_price < $msrp_mk) { 
$_savePercent = 100 - round(($_price / $msrp_mk)*100); }
if ($_price < $msrp_mk) { echo $this->__('Percentage Off:'); echo $_savePercent;} ?>%
</span>

The "Percentage Off: #%" works correctly when you first load the page. 首次加载页面时,“关闭百分比:#%”可以正常工作。 The only issue is when a user selects a new option (small, med, large, ect) the Price will change, but the "Percentage Off: #%" stays the same. 唯一的问题是,当用户选择一个新选项(小,中,大等)时,价格将发生变化,但“折扣百分比:#%”保持不变。

I looked into /catalog/product/view/type/options/configurable.phtml where Product.Config = Class.create(); 我查看了/catalog/product/view/type/options/configurable.phtml ,其中Product.Config = Class.create(); but I don't know what to edit/add. 但我不知道要编辑/添加什么。

I've read that you can do some jQuery voodoo and update those values yourself. 我读过您可以做一些jQuery伏都教并自己更新这些值。 I have over 10,000 products and I'm not sure how I would go about doing this. 我有10,000多种产品,我不确定该怎么做。

Any help would be much appreciated! 任何帮助将非常感激! (currently using magento 1.7) (当前使用magento 1.7)

pass product id through ajax and get its price and msrp and do your calculation in php and return percentageoff to ajax, then set the price .. 通过ajax传递产品ID并获取其价格和msrp,并在php中进行计算,然后将percentoff返回给ajax,然后设置价格..

Hope this is what you need..tell if not. 希望这是您需要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM