1
我目前正在使用圖像按鈕添加預定義消息的訂單的插件。圖片按鈕增加購物車價格點擊時 - Magento
我想不過做的是指定一個價格每個按鈕,這也被添加到訂單。有點像分配給每個按鈕的自定義選項,但是我可以自己編寫代碼。
這可能嗎?我找不到任何信息來使用按鈕/代碼來調整購物車的價格。
任何建議非常感謝。
我目前正在使用圖像按鈕添加預定義消息的訂單的插件。圖片按鈕增加購物車價格點擊時 - Magento
我想不過做的是指定一個價格每個按鈕,這也被添加到訂單。有點像分配給每個按鈕的自定義選項,但是我可以自己編寫代碼。
這可能嗎?我找不到任何信息來使用按鈕/代碼來調整購物車的價格。
任何建議非常感謝。
這很簡單的JavaScript,除非你想做它的服務器端,這將是很容易,但需要MySQL。
HTML代碼:
<img src="" onclick="item_1()"> //just add the src (path) and some style.
<img src="" onclick="item_2()"> //if you need a third just repeat the same and change the numbers.
<p id="total_order">$0</p> //that's the paragraph that shows the total bill (can be a div too)
JAVASCRIPT:
var order = 0;
var price_1 = "price"; //simply change "price" for the price you want
var price_2 = "price";
function item_1() {
order += price_1; //increments the order value by the price of the 1st item
document.getElementById("total_order").innerHTML = "$"+order;
}
//same function repeated but with different number
function item_2() {
order += price_2;
document.getElementById("total_order").innerHTML = "$"+order;
}
我不知道這是否就是你要找的東西,但我希望它能幫助。
謝謝@KeepoN,我會試試! – windywah
我想我可以擁有它...我可以爲我想要的價格設置更多產品並將它們分配給按鈕。我發現這個問題/答案似乎是正確的軌道! – windywah
你想要做的事情看起來與[本教程]的內容非常相似(http://www.magesolution.com/blog/techniques-show-product-options-in-product-list/)。區別在於本教程使用'