Developer forum

Forum » Swift » DW10: Error when selecting variant option in product details view using pretty urls

DW10: Error when selecting variant option in product details view using pretty urls

Jóhannes Þorkell Tómasson
Reply

Hi.

We have products which are assigned a default variant so when the user selects a product from a product list the default variant is automatically selected and everything looks fine: 

 

...But when the user tries to select any other variant from this view the details page returns a 404 response and the page is stuck in endlessly loading:

...here I selected the medium size variant and the error occurs. DW adds the querystring like it does when the "Querystring based urls" setting is on to the url as opposed to the pretty url path it used when I originally entered the page.

All the functionality on the product details page works when using the "Querystring based urls" setting but it's not as nice looking. Additionally we have the "Do not add base href to header" setting on (without it the pretty urls don't work on product details pages at all):


Replies

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Johannes

This is not a bug I have seen before. You are perfectly right, we need to start by looking at the url, to track down the problem. I need the last part of the url to see that the VariantID is correctly set.

As you are given a 404 page, you could also check that the product variants are all set to active.

 

Best regards
Karsten Thuen 

 
Jóhannes Þorkell Tómasson
Reply

Hi Karsten.

An example full URL when the functionality breaks and returns a 404 is: https://vefverslun_afangar.test.lisa.is/is-is/marco-polo/doemur/skyrtur-og-blussur/skyrtur/siderma-finflauelskyrta/Default.aspx?ID=5182&GroupID=DSKYRTUR&ProductID=408088242331&variantid=IMPORT_COLOUR_816.IMPORT_ALL_SIZES_36

The product variant is definitely active and everything works as it should if we don't have pretty urls enabled.

Furthermore by appending the path and queryparams that are added to the url when the error occurs directly to the base url it also works i.e.

https://vefverslun_afangar.test.lisa.is/Default.aspx?ID=5182&GroupID=DSKYRTUR&ProductID=408088242331&variantid=IMPORT_COLOUR_816.IMPORT_ALL_SIZES_36

...This url redirects to the corresponding pretty url and everything is fine:

https://vefverslun_afangar.test.lisa.is/Default.aspx?ID=5182&GroupID=DSKYRTUR&ProductID=408088242331&variantid=IMPORT_COLOUR_816.IMPORT_ALL_SIZES_36 - redirects to - https://vefverslun_afangar.test.lisa.is/is-is/marco-polo/doemur/skyrtur-og-blussur/skyrtur/siderma-finflauelskyrta/morning-sky-36

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

Hi Johannes,

Thank you very much. I found the issue. When enabling this checkbox in DW10, the variant selector creates broken urls, containing both a friendly url and the ugly url.



I have created bug #21035 for this issue.

Votes for this answer: 1
 
Jóhannes Þorkell Tómasson
Reply

Ok, thanks for the help Karsten but like I said the pretty urls don't work for us at all without that option enabled. Looking forward to the update!

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Johannes

If you want the fix right away, you can take this commit into your solution:

https://github.com/dynamicweb/Swift/commit/c3c59273b28f00fe44a27ddf98d995eb5875cbcd

BR Nicolai

Votes for this answer: 1
 
Jóhannes Þorkell Tómasson
Reply

Great we will try that! Thanks Nicolai.

 

You must be logged in to post in the forum