Developer forum

Forum » CMS - Standard features » Product/variant URLs going to 404

Product/variant URLs going to 404

Andrew Rushworth
Reply

We have multiple variants per product -some of the variants show fine, and others show a 404 error when selected.
If I change the customized urls for ecommerce to "do nothing" the product shows on front end with the detailed url: 

Shows products with url => Default.aspx?ID={productpageid}&GroupID=&ProductID={productid}&VariantID={variantid}

However, this configuration:

results int the following 404 url (only for some variants):  /{product page name}/{Product Name}/{variant combination option}-5?GroupID=

So even though the variant is available and shows if you use the base, unaltered fully qualified url, when using the customized version its bombing out - again only for some variants, not all.

So my query is:

1. Some of the variant URLs have -1,-6, etc appended, even though they only belong to a single group in the system. 
What is the logic or table queries that happen to produce this url in the the backend?
Does it look in the EcomProducts, etc table to determine duplicates and is it possible find out why its appending a particular count for a product/variant and remove the offending entries.

2. Is it not possible to see what the correct url is for the product (like some sort of mapping table)?

3. Is it not possible to rebuild this index?
Currently I've created a task to run Dynamicweb.Frontend.UrlHandling.UrlHelper.SetResetNeeded(), Dynamicweb.Frontend.UrlProviders.Handler.Reset() and Dynamicweb.Frontend.UrlHandling.UrlIndex.Reset() when necessary, although it doesn't seem to make a difference - the system still appends and responds with a 404, even though the variant is available and shows if you use the original url.

For another day:
The 404 page is not great as it's part of the site, but when i try to set this to be a particular page in DW Admin, I get a circular reference: 
Handler404.Handle() has already been called. Circular reference.

I've been through the forum posts and although i found some good bits like the index resets, nothing has really provided a solution.

Thanks Andrew

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Andrew

There are 2 urls systems - the "old" one which is the url providers above that works for the entire installation, and the new ones that are setup on one page: https://doc.dynamicweb.com/documentation-9/platform/platform-tools/customized-urls#sideNavTitle1-5

You can see some of the URLs under the old scheme by adding ?showurls=true to the frontend.

You can see some of the URLs under the new scheme by adding ?showurlindex=true to the frontend.

Urls are not in the database - they are generated by code - the 2 schemes have very different approach. You are using the 'old' one and you probably have the same variant name multiple times in the same variant group (i.e. red 2 times) or have 2 variant groups with the same value - i.e. "Cloting color" and "Bike colors" or something like that.

If you switch to the new version, you get rid of that issue.

BR Nicolai

 
Andrew Rushworth
Reply
That's the issues, is that it's not used more than than once. I can't find anywhere in the ecom tables where it's duplicated, so I'm not sure why it's appending the suffix.
 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

What does your ecommerce data health say - you can find that page in Monitoring: https://doc.dynamicweb.com/documentation-9/monitoring#10218

Which tables did you check? See variant related tables here: https://doc.dynamicweb.com/documentation-9/ecommerce/product-catalog/variants#2840

 
Andrew Rushworth
Reply

I checked all those tables and could only find one record for the particular product variant combo in each.

In health there are a few issues, but none of them related to this product or variant.

 
Andrew Rushworth
Reply

Is it possible to point me to which piece of code generates the friendly url. That way I can at least see the logic it is applying and can then find out why its resulting in a missing product.

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Andrew

You are using the old URL providers - in the frontend you can see these URLs using ?showurls=true in the frontend and see the URLs - that will also give you an idea of where the bad data is coming from.

The 404 can also come from something else - i.e. in customized URLs settings you can set 404 for products not in current website shop, language and group - so if  you have a query that published a product to the product list page, then when seeing it in the PDP page, you will get a 404 from that context check. You can disable those in the settings.

If you are using the new URL handling providers, you can access the URLs using /?showurlindex=true which will also give you a list.

The code for the old urlproviders can be found in Dynamicweb.Ecommerce.Frontend.UrlProviders and the new ones in Dynamicweb.Ecommerce.Frontend.UrlHandling

The 404 issue you have is probably because you are using ressources on your 404 page which are them selves 404. Generally 404 pages should be empty. The concept of adding all kinds of functionality to that page should be avoided.

 
Andrew Rushworth
Reply

Manged to figure out the issue with the client and the old url system
They client had variants that had a period in the Name field ( i.e "1.8").
The problem here is that DW splits the Name by the period when it generates its list. So "1.8" becomes "1-8".
In conjunction with this they have numerios variants with "1" as as the name (for each brand...I know). THis would then result in 1-1,1-2,1-3, 1-4...,1-7,"1-8"
This is where the conflict occurs.
Just to note, the ID's are all correct.

In DW the variant ID is split in the library by "." here:

 

You must be logged in to post in the forum