Hey,
I’m trying to create a search box which can search the products from my stores.
I used codes and built it. It which works on a page. but when I use the same strategy to show this search box on my home page, it doesn’t work.
what should I do? Please help pals. I need to complete it ASAP. Please help if something should be different for homepage.
The Exact code I used is here:
import wixData from “wix-data”;
export function Buttonclick_click(event) {
wixData.query(“Stores/Products”)
.contains(“name”, $w(“#searchInput1”).value)
.find()
.then(res => {
$w(“#searchResultTable1”).rows = res.items;
$w(“#searchResultTable1”).expand();
});
}
$w.onReady( function () {
$w(“#searchResultTable1”).columns = [{
“id”: “col1”,
“dataPath”: “mainMedia”,
“label”: “mainMedia”,
“visible”: true ,
“type”: “image”,
“linkPath”: “productPageUrl”
},
{
“id”: “col2”,
“dataPath”: “name”,
“label”: “Book”,
“width”: 50,
“type”: “string”,
“linkPath”: “productPageUrl”
},
{
“id”: “col3”,
“dataPath”: “formattedDiscountedPrice”,
“label”: “Price”,
“width”: 10,
“type”: “string”,
“linkPath”: “productPageUrl”
}
];
});
#searchBox #databaseSearch #storeSearch #store #homepage #wixCode