Hi all
Grateful for some help before I cry. Been trying for a few hours on and off to get datasets to work but I just can't.
So here's what I have
A store with collections
Collections with products
Products with an individual store product page
Here's what I want:
A dynamic page show collections - this works
A dynamic page showing all the products in each collection when the collection is clicked on the collections page
The product on the dynamic page to link to the individual product page ready for purchase
this is what happens:
I create a dynamic page, based on my store collections using the ready made datasets. This is fine for the (All) page and shows all the collection names and images etc. Perfect
The next page which is the (Item) page doesn't work. No matter what I do I simply cannot get it to show the products from within that collection. I've tried filtering, I've named the page URL, I've deleted numerous times and started again, and I've tried all the different available pre-made datasets. Nothing seems to work.
Consequently I am unable to link anything to a product page yet so don't know if this will work!
I'm not really sure what i'm doing wrong but I'm sure it can't be this difficult!!! And I'm not creating datasets from scratch either - I'm using the ones already available created by the site.
I want to use a dynamic page because i have a lot of collections and the website structure will be massive if I create a new page for each collection - at the moment there are 60 different collections.
Any thoughts on whats going on with instructions will be very gratefully received!
Thanks
So I'm guessing that the issue is a bug or something with the pre built dynamic pages under stores. I've just created a page from scratch and added my own dataset and it all works perfectly - by doing exactly what I had been doing with the premade pages. Gawd damn it Wix!!!!!! 😄
hi Ahmed - thanks for this. I'll give it a go. The dynamic pages are supposed to do all this for you though so I'm not sure why its not working. when I read the instructions on the help it basically says that dynamic pages and datasets do exactly what I want - ie create a front page and then display everything within the collection that I click on in a repeater on the next page. Strangely I can get it work in Editor X but not in Editor!!! i'll give your instructions a go and see what happens. Thank you!
Hi, I don't understand what you're trying to achieve, do you want to create a dynamic page to display the (Wix Stores Collections) on, and when a collection is clicked show its relative products in a repeater?
Correct me if I'm wrong, but if I'm not, here's what I think might work for you.
1. First things first, connect the item dataset - the one that comes when you create a dynamic item page - to (Stores/Collections).
2. Create a new collection that has three fields, the first one is the collection name as (Text), the second one a reference field for the collection name, and the last one is a multi reference field for your products (Stores/Products).
3. On the dynamic page, connect the collections to a repeater, and use its onItemReady() function to query and get the products from the collection that you've created in STEP 2, get the items in an array.
4. Using a for loop, query the products collection and get each product and add it to a new array.
5. Now that you have all the related products in an array, mutate the array with another for loop to add an index for each product like this:
item = { '_id': indexFromTheForLoop, product: theNewProductsArray[indexFromTheForLoop] }
This step is required for the next step.
6. Set the repeater data to your new mutated array.
7. In the related collection's repeater, use its onItemReady() function to get the each product's details and setup the children items values accordingly.
I think this will work, it's a simple code though, it'll need a lot of work and debugging to get it to work as you desire.
Hope that helped!
Ahmad
Hi. I have but its obviously not as I want it now - but it will give you an idea of what there is on there. the reason why its got much is because its plants...so collections are things like, shade, sun, drought tolerant etc etc
www.gardensinglass.co.uk
Do you have perhaps a link which shows an example of your site (structure)?
It is ab big project that you want to do and it is surely not done by 5-code-lines.