Product Gallery Change Collection on user click

Hi everyone, i am tryng to change my current product gallery collection basend on user repeater item click.

exemple i created two collections “Chocolate cakes” and “Strawberry cakes”, my current collection showing on product gallery is “Chocolate cakes” on user click in the repeater item “Strawberry cakes” my product gallery load my collection " Strawberry cakes"

Hi,
You need to use the onClick() event which will query the " Strawberry cakes" database and update items in the repeater .

You can see a similar example with a button and image here .

Hey Aleks, ty for your reply but this is not exactly i want to do
i made a screenshot explaining:

Click in the repeater and load the Cake collection on the store

You should create one collection that has all cakes. Add a field called “type” which can contain chocolate, strawberry, coconut, okra, or whatever else you want. Then it’s just a simple filtering of the collection to display the items that you want.

Hello Yisrael.
I need to create this field type on repeaters ? you can give me an exemple ? i searched on documentation but i did’n find anything.

See the examples page which has many examples - including examples with Repeaters.

Hello guys, now I’m getting the collection through my repeaters and filtering with the dataquery. now how do i set the filter result in the filters of the Wix Store, could someone give me a clue?

I’m putting my code here.


$w.onReady(function () {
$w("#container1").onClick( (event) => {
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset2").getCurrentItem();
querySelectedCollection(clickedItemData);
} );

});
export function querySelectedCollection(selectedItem) {
console.log(selectedItem)
wixData.query("Stores/Collections")
.eq("name", selectedItem.name)
.find()
.then( (results) => {
if(results.items.length > 0) {
let items = results.items;
let firstItem = items[0];
let totalCount = results.totalCount;
let pageSize = results.pageSize;
let currentPage = results.currentPage;
let totalPages = results.totalPages;
let hasNext = results.hasNext();
let hasPrev = results.hasPrev();
let length = results.length;
let query = results.query;
console.log(items)
} else {
console.log("Else")
}
})
}