1

we have a requirement where url will have different variants as argument e.g. pid=Prod1|Prod2|Prod3. Based on this we need to show a pdp page with three products. Initially, I was thinking to create an empty product set and add the products dynamically. But I don’t see any method for this. Any input on this will be very helpful.

Thanks

2 Answers 2

1

You could do the following:

In the route Product-Show get the pid parameter and spit it:

var apiProducts = [];
var variants = req.querystring.pid.split('|');
variants.forEach(function (variant) {
    apiProducts.push(ProductMgr.getProduct(variant));
});

Then you can use apiProducts in your template to show the requested products.

To determine which template to use (1 product or multiple) you can check if the pid parameter can be split.

Maybe this gives you an idea on how to approach this.

1
  • Thanks @empiric, I was thinking also in the same line. Commented Jan 5, 2021 at 15:04
0

You can use a Report, and then the URL parameters will flow into the Report criteria.

Product IDs or SKUs will go into URL parameters named "pv0", "pv1", etc., however you set up your report criteria.

More info: https://www.salesforceben.com/salesforce-reports-url-hack/

3
  • How will this work for Commerce Cloud?
    – kurunve
    Commented Dec 19, 2020 at 19:31
  • Thanks for the answer but the salesforce report option is not available in salesforce commerce cloud. Commented Dec 20, 2020 at 1:36
  • Didn't know that Commented Dec 21, 2020 at 0:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .