Hallo All
I Need to add a Custom Field to my ProductPage witch shows me the storage location.
The Script Shows like following:
let productQuantityNum = 200; //initialize product quantity variable
let soldOutText = "Ab Externem Lager" //initialize variable to display "sold out" text when inventory is 0
$w.onReady(function () {
//TODO: write your page related code here...
$w('#productPage1').getProduct() //get current product
.then( (product) => {
productQuantityNum = product.quantityInStock; //get quantity in stock for current product
if (productQuantityNum > 0) { //if it's greater than 0, Display number remaining
let productQuantityString = productQuantityNum.toString();
$w("#text47").text = productQuantityString + " remaining";
} else {
$w("#text47").text = soldOutText; //display sold out text
}
if (productQuantityNum > 999) { //if it's greater than 0, Display number remaining
let productQuantityString = productQuantityNum.toString();
$w("#text47").text = "Ab externem Lager";
} else {
}
} )
.catch( (error) => {
console.log(error);
} );
});
My primary issue is that the code fails to update the textbox when a product with a combobox (e.g., size options) is selected and the selected value is changed.
My second issue is that I want to position my text field below the ‘Add to Cart’ button. However, this doesn’t work consistently across different monitor resolutions because I cannot directly bind the text field element to the ‘Add to Cart’ button. Can someone help me?
Regards, Roger.