Access function on product details page

Vote:
 

I have created a catalog containing products and variants.

On one of my CMS pages I have created a link to a products details page - The page that can be accessed in Commerce Catalog, This takes me to the following url: http://localhost:PORT/en/SEOURL FOR PRODUCT.aspx/

Now when i hit a button on this page for adding it to the cart (method I have created, placed in the controller) I get a "Server Error in '/' Application." page.

The strange thing is that when I locate my product in the Commerce catalog and see the details page there, and click the button for adding it to the cart, it works (it use the method I have placed in the controller).

Can someone see what it is that I am missing since it works in the Commerce catalog, but not when accessing it through its SEO url?

Maybe its because i "link" to my product details page using the SEO url? - In that case, what is the best way to link to the "correct" products detial page?

#143247
Jan 18, 2016 15:12
Vote:
 

Hi,

SEO URLs should work fine.

What versions are you working on?
Are you using Default Hierarical Catalog Router?
Can you please provide more Error information?

Regards
Khurram

#143249
Jan 18, 2016 15:29
Vote:
 

Hi,

I am using the newest version, so 9.xx ?
I can see that we use the following code for routing setup in initialization:

CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, true);

Taken from this site: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Commerce/9/Routing/Routing/

The only error that i get is the following:

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /en/iPhone-5s-en.aspx/AddToCart

#143250
Jan 18, 2016 15:34
Vote:
 

Try by removing Language prefix as, /iPhone-5s-en.aspx/AddToCart rather /en/iPhone-5s-en.aspx/AddToCart, I will prefer WebApi instead for "AddToCart".
/K

#143252
Jan 18, 2016 15:50
Vote:
 

This produces the exact same error:

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /iPhone-5s-en.aspx/AddToCart

#143253
Jan 18, 2016 15:53
Vote:
 

Just to give an update if someone have the same error.

When I change the routing so that it does not use SEO urls it works. So in the initialization module i changed the following line:

CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);

If the last parameter is true SEO urls will be used, and false will not use SEO urls.

#143274
Jan 19, 2016 8:38
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.