Greetings, I need to pick up the product name for a field on my form. This is already working for me:
$w ( “#input10” ). placeholder = “Product Name” ;
But now I need to change the product name to a dynamic value that changes accordingly to the product displayed on the page.
I imagine that what I need is to change the value between “”
to a function that gets the product name, but I’ve tried several options without success.
Show what you have tried already…
This is where I am at now. The hidden field is already there, working, value goes to my submission table, which is good, but I’m not able to make the value dynamic.
Also tried using get ( name )
I believe I need to structure better this function, but don’t know how to do.
First of all read this post…
it could give you a better understanding of how to work on PRODUCT-PAGE and how to interact on it.
Next time when you are opening a post…
- Always open your own one
- Always describe your issue as detailed as possible (anybody can see your SETUP ecxept YOU), including…
a) which elements are used ?
b) are APPs or predefined (out of the box) Wix-Stuff used, such like for example → Wix-Stores, Wix-Restaurants, Wix-Events, Wix-Blogs and so on…
c) do you use datasets or are you working with wix-data-api (or even both) ?
d) Also a good description of the flow how the user uses your page?
1) User starts at…
2) User clicks … then…happens
3) showing already generated related coding
4) eventually adding even BACKEND-CODE if also connected to the described issue.
This is how a DETAILED-DESCRIPTION should look like.
What you describe here…
$w("#input10").placeholder= "Product Name";
IS NOTHING!
What point of my question did you not understand? I just need to know how do I call back the product name, that’s all. Don’t understand the necessity of being rude of typing big like this, its humiliating.
1 Like
$w.onReady(async function() {
get_AllProductsPageData();
});
function get_AllProductsPageData(){
$w('#productPage1').getProduct()
.then(async(product) => {
//console.log("Product: ", product);
let productName = product.name;
console.log("Product-Name: ", productName);
let productDescription = product.description;
console.log("Product-Description: ", productDescription);
let currency = product.currency;
console.log("Currency: ", currency);
let discountedPrice = product.discountedPrice;
console.log("Discounted-Price: ", discountedPrice);
let inStockAvailability = product.inStock;
console.log("In Stock available: ", inStockAvailability);
let inventoryItemId = product.inventoryItemId;
console.log("Inventory-Item-ID: ", inventoryItemId);
let productImage = product.mainMedia;
console.log("Product-Image: ", productImage);
let productMediaItems = product.mediaItems;
console.log("Product-Media-Items: ", productMediaItems);
let productPrice = product.price;
console.log("Product-Price: ", productPrice);
let productPageURL = product.productPageUrl;
console.log("Product-Page-URL: ", productPageURL);
});
}
And to solve completely your issue…
$w.onReady(async function() {
get_AllProductsPageData();
});
function get_AllProductsPageData(){
$w('#productPage1').getProduct()
.then(async(product) => {
//console.log("Product: ", product);
let productName = product.name;
console.log("Product-Name: ", productName);
$w("#input10").placeholder= productName;
});
}
RUDE? Maybe sometimes! → But fair ! 
There’s not much I can do about rudeness, as we give what we have, right? I prefer to belong in the realm of people that guide by positivity.
But yes, that was exactly the result wanted to reach, thank you so much for sparing your time to help me with that question. It really helped and makes me wanna study even more because that’s not my background.
Cheers!
1 Like
May I know this page you put the coding?