Change the url of product detail
I came across this post:
http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/how-to-use-a-custom-url-in-the-products-module---solution.aspx
How can I change the format of the URL's for products inside the ECommerce module?
Regards,
Daniel
Hi Daniel,
Thank you for contacting support.
You can change the Url of product detail in two ways -
1)If you want to remove the published date from the url of the product you can go to Administration->Settings->Advanced->Catalog->Providers->OpenAccessProvider->Parameters and add a new parameter the key of the new parameter will be "urlFormat" and the value will be "/[UrlName]".
Please note that already existing products will not get the route by default. You will have to publish the exisisting products again.
2)You can add a class to your project and make the class inherit from "OpenAccessCatalogDataProvider". You can override the below methods to get custom routing.
Please note that you will need to change ProviderType of catalog (can be changed at Administration->Settings->Advanced->Catalog->Providers->OpenAccessProvider) to have your custom class name.
public
override
string
GetUrlFormat(Telerik.Sitefinity.GenericContent.Model.ILocatable item)
return
"/[CustomRouteKey]/[UrlName]"
;
protected
override
string
GetUrlPart<T>(
string
key,
string
format, T item)
if
(key ==
"CustomRouteKey"
)
//Use any mechanism to get the route key
return
base
.GetUrlPart<T>(key, format, item);
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Venkata, when trying to follow example 2 (1 didn't work at all...) I receive the following:
The type 'T' cannot be used as type parameter 'T' in the generic type or method 'Telerik.Sitefinity.Modules.GenericContent.UrlDataProviderBase.GetUrlPart<T>(string, string, T)'. There is no boxing conversion or type parameter conversion from 'T' to 'Telerik.Sitefinity.GenericContent.Model.ILocatable'
Hi Denny,
I have answered your support ticket on this issue. If you have any questions please contact us there!
Thanks in advance!