Well, I have a Wix Database with a lot of products.
It’s like ProductName, Segment, Industry :
Product1, Plastic, Construction // Product2, Organic, FoodIndustry // …
So… I have some “solutions” links, like “For FoodIndustry, with organic components you need this products”, and if you click in the link, you will see a table with a list of Products that match that conditions.
Well, at this time I have a Button with a OnClick event, and https//www.blablabla/page?product=Product2,Product3 etc.
So, in the Product page I use wixLocation.query, to obtain “producto = Product2,Product3”, and then I use split to create an array with the name of the products that the table must show.
Here is the problem… For some reason that I don’t know, I get two Products from Query (in url), : [Product1, Product2], then I pass those two elements in the array “separated”, but in the table only appears Product1, obviously the query only returns ONE results, but I don’t know why.
I want to send TWO products in the URL, and show TWO products in the table.
I’m going crazy!
I’ll appreciate the help.
Thank you!
Here is the code from the web that receive the parameters.
import wixData from ‘wix-data’;
import wixLocation from ‘wix-location’;
$w.onReady(() => {
let queryParam = wixLocation.query;
let separated = queryParam;
separated = separated.product;
separated = separated.split(“,”);
let filters = wixData.query(“Products”)
.hasSome(“title”, separated)
.find()
.then((results) => {
console.log(results.items);
$w(‘#table1’).rows = results.items;
})
. catch ((error) => {
let errorMsg = error.message;
let code = error.code;
});
})