Hi folks, there seems to be numerous posts about this or related topics but I have yet to find the right combination or at least I don’t fully understand the suggestions. I am querying my store products and then adding some information about matches to a table. I would like to have a link in the table which would then send me to the product page so that customers could select options and so on. Ideally in the third column of the table there would be a button that was clickable sending the customer to the product page. The best I have been able to do (the uncommented code below) is to display the product page URL in the 3rd column of the table. Clicking on it unfortunately just takes me to my stores homepage, not to the wanted product page. You can also see my other varied attempts with some of the code that is commented. Any suggestions?
import wixData from 'wix-data';
import wixLocation from 'wix-location';
//let path = wixLocation.path;
// remove "/product-page/"
//path.shift();
//let toUrl = "/stores/products/" + path.join("/");
//export function resultsTable_rowSelect(event, $w) {
//let rowData = event.rowData;
//let rowIndex = event.rowIndex;
//const myRow = event.target.rows[rowIndex];
//console.log("value is ", myRow);
//wixLocation.to(`${myRow["productPageUrl"]}`);
// wixLocation.to(`productPageUrl`);
// wixLocation.to("/about");
//}
$w.onReady(function () {
wixData.query('Stores/Products')
.contains("name",'1968-69')
.find() // Run the query
.then(res => {
// Set the table data to be the results of the query
$w("#table1").rows = res.items;
$w("#table1").expand();
});
$w("#table1").columns = [{
"id": "col1",
"dataPath": "name",
"label": "Card",
"type": "string",
},
{
"id": "col2",
"dataPath": "quantityInStock",
"label": "Quantity Available",
"type": "string",
},
{
"id": "col3",
"dataPath": "productPageUrl",
//"dataPath": "slug",
"label": "Shop",
"type": "string",
"linkPath": "productPageUrl",
}
];
});