2016-06-20 31 views
0

我想改變價格,當我選擇其他元素,但它沒有奏效。如何在下拉菜單中選擇其他元素時更新價格?

我在文件中搜索:configurable.js,但只能看到函數:reloadPrice和realoadOldPrice,我需要你的幫助。

enter image description here

enter image description here

,並在Magento文件:/js/varien/configurables.js

getOptionLabel: function(option, price){ 
........ 
    var sel = document.getElementById('attribute'+IdProduct); 
    if(sel!=""){ 

     var opt = sel.options[sel.selectedIndex]; 
     var text= opt.text; 
     var text_array= text.split(" "); 
     var PriceExcl=text_array[2]; 
     var cutpriceincl=text_array[3]; 
     if (cutpriceincl!=undefined) { 
      PriceIncl=cutpriceincl.substring(1); 


     } 

    } 
.......... 
}, 

我試圖改變與JavaScript的價格。

感謝您的幫助!

+0

現場演示將是有益的 – brk

+0

https://inoxtaps.com/cocoon-mono-set03-wall-mounted-cold-water-tap-3133 這是頁面和產品 – vaifer91

+0

你能夠改變不含稅的價格 – Deep

回答

0

您可以使用以下代碼更新價格。

var sel = document.getElementById('attribute'+IdProduct); 
if(sel!=""){ 

    var opt = sel.options[sel.selectedIndex]; 
    var text= opt.text; 
    var text_array= text.split(" "); 
    var PriceExcl=text_array[2]; 
    document.getElementById("price-excluding-tax-3133_clone").innerHTML = PriceExcl; 
    var cutpriceincl=text_array[3]; 
    if (cutpriceincl!=undefined) { 
     PriceIncl=cutpriceincl.substring(1); 
     document.getElementById("price-including-tax-3133_clone").innerHTML = PriceIncl; 

    } 

} 
相關問題