Custom URL Varible for Sku#

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
User avatar
vsammons
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon May 10, 2010 7:10 am

Custom URL Varible for Sku#

Post by vsammons » Tue Nov 17, 2015 1:12 pm

Has anyone created the ability to use VARIBLES to add Product information to the URL?

/apple-blossom-and-blueberry-wall-stencil-p7883_sku_1694.aspx (Example URL)

Example of Variable to create url above:
Custom Url: &_SKU_<%Sku%>%

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Custom URL Varible for Sku#

Post by AbleMods » Tue Nov 17, 2015 4:00 pm

I believe this is only possible with full source code. The Product CustomUrl field does not support macro substitution.

With full source code, you would make your changes in the /Catalog/UrlGenerator.cs class. Look for the GetBrowseUrl() method.

You can make any property of the product class a part of the url, but I wouldn't recommend it. Anything other than the ProductId value can be changed and that change will then alter the product url. Now you've broken every search engine link that points to your product page until your site gets indexed again.

This is why Able uses the ProductId (or CategoryId) - that value cannot be changed and thus ensures someone doesn't accidentally break site url links.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
vsammons
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon May 10, 2010 7:10 am

Re: Custom URL Varible for Sku#

Post by vsammons » Wed Nov 18, 2015 6:27 am

The problem is we had added this in the Custom source code on version 7 and need to re adapt as all of the current links are bad. We wanted the SKU to be dominated in a Google search when looking for the product by SKU number. I will look in the source code on Gold and make the adjustments. Thank you!

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Custom URL Varible for Sku#

Post by AbleMods » Wed Nov 18, 2015 8:08 am

The lesser of two evils at this point :)
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
vsammons
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon May 10, 2010 7:10 am

Re: Custom URL Varible for Sku#

Post by vsammons » Wed Nov 18, 2015 12:06 pm

You are correct, I may just let it reindex...

User avatar
vsammons
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Mon May 10, 2010 7:10 am

Re: Custom URL Varible for Sku#

Post by vsammons » Wed Dec 16, 2015 3:37 am

update for those who may find it useful:
I changed first line of code in the Commercebuilder.Catalog.DefaultUrlReWriter

Code: Select all

private static Regex _defaultRewriteRegex = new Regex(@"^((?:.*/)*).*?-(C|P|W|L)(\d+)(?:[C](\d+))?(_sku_(\d+))?\.aspx$", RegexOptions.IgnoreCase);

Post Reply