I have XANO endpoint GET products/ with list of products, I added such collection to WeWeb.
When I click on product I want to proceed to page single product.
I have endpoint GET ONE product /{{product_id}} and data is different then GET products/ endpoint and I want to use this endpoint to display data on Single product page.
Ive checked your awesome tutorial on XANO JOb board app and it looks like same data from list of jobs is used to populate Single job page via object variable.
I have different amount of data in products & single product endpoints.
How do I Fetch SIngle Item data with {{product_id}} that I pass with navigation from products list?
When I create collection by fetching GET ONE product endpoint it creates only 1 item and not refetch. ANd always product id=1 is displayed if I link elements to that item in Template.
Thank you.
Hello,
Perhaps you can run a workflow on the single page specifically where you use a GET and populate the parameter which you have passed from the collection page to pull the data?
1 Like
Pass the id of the product that you want to display in a query string variable. Then, on the page the you want to display product details, use that ID in the GET ONE /{{product_id}
To send the product id in the query:
To create a query string variable:
If your url contains ?product-id, then just name your variable product_id, and WeWeb takes care of the rest if you select “Query” as your type.
1 Like
Thank you for the answers!
Now I can see a problem, but cannot debug it.
When on products collection page I click on item and set variable with product ID and test → it perfectly works and number changes when I click on different items.
But when I proceed to “product Item page” and display this project variable productID on product/single page it doesnt match what i’ve selected previously on product list and it is always default value “1” thats why I always fetch productID=1…
I dont understand why it changes to default if I set it on another page to new value…
list of products:
and next click after this → product page
BUT URL query is correct #19 BUT item is displayed which is #1
R
I have selected SingleTrendID as #19 and it becomes in project variables again #1
What I do wrong? Thank you.
- variables (unless they are session variables or project constants) will reset on every new page load.
- You named your variable in the URL “trend_id”, but you named your variable in WeWeb “SelectedTrendID”
- For query variables, WeWeb will “grab” them from the URL, with whatever name you give them.
So, you need to either change your variable name to trend_id, or your URL parameter name to SelectedTrendID.
2 Likes
It works now, huge superhuge thanx!
2 Likes
Superhuge high five! Way to goo!!!
2 Likes