Developer forum

Forum » Swift » Mutliple product lists underneath the same website root

Mutliple product lists underneath the same website root

Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

I have a site that needs two seperate product lists. The first list is made up of products that are not sold online, the second can be added to cart.

I thought I might be able to just create two Product List pages, but I found that the Product List Gridview only expects a single shop page on line 139:

@foreach (ProductViewModel product in productList.Products)
{
string link = product.GetProductLink(GetPageIdByNavigationTag("Shop"), false);
 
Now the list works, and shows different products, but tries to link the detail page to the first shop page...
Just wanted to check if you think this is something I could get to work with minor customizations, or that I'm jumping down a rabbit hole here?
 
Thanks,
Justin

Replies

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply
This post has been marked as an answer

Hi Justin

You are perfectly right. We are currently only supporting one product list on Swift. There is quite a lot of complexity surrounding support for multiple lists. I.e. which list would a simple search use? And what should happen when searching for something results in a mix of products from both lists?

And then there is the problem you have here. The reason it is made this way, is for us to be able to use the Visual editor to build great detail pages, while keeping pretty urls. I do not know how your product data looks, but maybe you can use the same list design for both of the product groups, and then link them to different detail pages? There is a guide on how to do that here: https://doc.dynamicweb.com/swift/setup-project/guides/multiple-product-details-pages 

 

Best regards
Karsten Thuen

Votes for this answer: 1
 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hey Karst,

Thanks! Glad I asked.

Does the product detail always need to be underneath a product list as a child? The products I want to seperate are actually donations, so I would like the visitor to be able to add a donation to the basket and use the normal checkout flow. but I don't actually even need a product list if I could just manually create two product detail pages with a static product on them, but I realize that might be a rabit hole all the same :-)

I was thinking, since on the product detail template there is already a function to select a dummy product in the visual editor, I could customize this (create a copy of that template) and just also show the selected dummy product in the front-end (so basically remove the IsVisualEditro check and alows use just that as a source for product data.

Cheers,

Justin

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Justin

Great question. I do not think you need to have the detail pages directly under the list, as we simply renders the "Grid" from the selected detail page. But I am uncertian of how that setup would work. I think whenever something can be added to the cart, and we want to show it as a kind of product, it should be in the product catalog. That way we secure that everything is easy to get to work exactly as it should. You could i.e. have a product where the variants of that product is different donation option (1$, 5$, 50$, 100$ etc.) 

But let me know how the experiment you describe here, turns out, if you decide to try it.


Best regards
Karsten Thuen

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hey Karsten, 

Thanks for your reply!

I'm quite far along. I made a copy of the Swift_ProductCatalogDetails app and changed it so that is always uses the selected dummy product as a source. I now have a working detail page, that shows the product I want, with the correct variants. 

When I click the variant, it shows the right variant URL in the address bar, for example: /donations/one-time-donation-item827?GroupID=GROUP353&variantid=VO29

But I have two remaining problem where I could use some pointers how to go and fix that:

  • It seems something is broken in the hover and click events, the style of the variant buttons does not change when hovered or clicked
  • More importantly, when I click Add to Cart, the base products is added to the cart instead of the variant. 

I guess something is wrong with the javascript connecting this together, but I'm not sure where to start looking (I can share a URL of the current version if you would have a few minutes to look?)

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Justin

Sorry for the late answer. I would say that there is only a small chance that the javascript is broken here. Have you tried to update to the latest Swift + DW version? 

If that does not work, I will probably need a link to be able to investigate what might have happened.

 

Best regards
Karsten Thuen

 

You must be logged in to post in the forum