Hello,
Add to cart button Placed on https://robwilliamlaurie.wixsite.com/website-2/big-blue
is not working. But the values that should be forwarded to the Cart is Showing up when log the values in the console.
Any help to Fix this is Highly Appreciated.
Thanks in Advance
Esmond
import wixWindow from 'wix-window';
import wixData from 'wix-data';
//====== Global Variables ====== //
const NUMBER_OF_CHOICES = 2;
const productId = "2b127c36-745b-e1c0-61b5-913becd1ce6c";
let selectedOptions = {};
$w.onReady(function () {
clearSelection();
$w('#addToCartButton').disable();
});
function clearSelection() {
selectedOptions = {};
$w('#addToCartButton').disable();
$w('#lampshadeImg').hide;
$w('#CableImg').hide;
$w('#lampshadeImg').src = 'https://';
$w('#CableImg').src = 'https://';
}
export function refreshButton_click(event) {
clearSelection();
}
//===== selectChoiceForOption() ===== //
function selectChoiceForOption(option, choiceData, choiceTitle){
selectedOptions[option] = choiceTitle;
$w(`#${option}Img`).src = choiceData;
$w(`#${option}Img`).show();
}
export function cableSelectionRepeater_itemReady($w, itemData, index) {
$w('#selectCableButton').onClick(() => {
selectChoiceForOption($w, 'Cable', itemData);
})
}
// ====== Shade Button ===== //
export function checkDesignBtn_click(event, option, displayImage, shadeTitle, cableTitle) {
shadeTitle = $w('#lshadeDrop').value;
cableTitle = $w('#cableDrop').value;
// Lampshade
wixData.query("combinedMaterialsImages")
.eq('option','lampshade')
.eq('title', shadeTitle)
.find()
.then( (res) => {
displayImage = res.items[0].displayImage
selectChoiceForOption('lampshade', displayImage, shadeTitle)
})
// Cable
wixData.query("combinedMaterialsImages")
.eq('option','Cable')
.eq('title', cableTitle)
.find()
.then( (results) => {
displayImage = results.items[0].displayImage
selectChoiceForOption('Cable', displayImage, cableTitle)
})
$w('#addToCartButton').enable();
}
export function lshadeDrop_change(event) {
$w('#addToCartButton').disable();
}
export function cableDrop_change(event) {
$w('#addToCartButton').disable();
}
export function addToCartButton_click(event) {
$w('#shoppingCartIcon1').addToCart(productId, 1, {"choices": selectedOptions});
console.log(selectedOptions);
}
#ProductConfigurator #AddToCart #AddToCartButton