SEO name compatibility

I developed a new extension to the ‘local’ addon that will provide compatibility for older (or foreign) SEO names.



The problem I had to solve is for converting to cs-cart from another cart provider (such as Yahoo, Monster, etc.) where they use “flat” SEO names. By “flat” I mean that there is no distinction between categories, pages or products.



Because cs-cart likes to use categories and parent pages as the path to a product, category or page, someone converting from one of these “flat” sites would loose all their SEO rankings. This is unacceptable and I’m really surprised that the “cs-cart architects” don’t understand that site conversion and retention of SEO ranking is extremely important.



For instance, a Yahoo store has a product that is refernced as “junk.html”. In cs-cart, this product is actually referenced by “category1/category2/junk.html”. Hence a “site.com/junk.html” will yield a 404 Page Not Found error. Yahoo might have a category as ‘cat3.html’ but in cs-cart it might be in ‘cat1/cat2/cat3’. A Yahoo ‘page’ (though they don’t really have the page/category concept) of ‘p2.html’ but in cs-cart it is ‘p1/p2.html’. This extension attempts to resolve all these issues.



I had made my request to cs-cart and they informed me that they were planning to do this in 2.0.11. Unfortunately, they did not and as is the norm, there is no committment to do so.



The solution: I utilize a hook named ‘validate_sef_object’ contained in addons/seo/func.php in the function fn_validate_object(). It behaves like this:

  • if the standard resolution of the object fails, it looks up the ‘type’ and the ‘name’.
  • it resolves the ‘id_path’ to the respective SEO names for each path component.
  • it then issues a 301 redirect to the fully-qualified name as it would appear in cs-cart. This preserves SEO ranking and the search engines fully honor an 301 redirect and the site is not penalized for using it.
  • if the standard resolution succeeds, the extension does nothing
  • There is a compatibility issue for cart versions earlier than 2.0.11. I have verified a small hack on 2.0.10 but cannot verify on any releases earlier than that. So if you’re using a cart prior to 2.0.10, please back up your existing site before enabling this extension.



    So how to get/use this feature…



    If installing the ‘local’ addon for the first time, nothing special is required. Just grab the archive listed below and un-archive it in the root of your cs-cart installation.



    If you have previously installed the ‘local’ addon, you must backup your skins//customer/addons/local directory to preserve your changes. This is only necessary if you have made modifications to files that were distributed in a prior ‘Local Configuration’ release. But it’s always best to backup. Then “uninstall” the ‘Local Configuration’ addon and then ‘install’ it.



    This version has two sections (tabs) in the addon options. There is a tab for css_settings (earlier releases) and a new section called ‘SEO’. There are 2 checkboxes in the SEO section. The first is ‘Redirect flat SEO names’. The default for this option is “unchecked” (do not use this extension). Checking this checkbox will enable the addon to automatically redirect flat SEO names to their cs-cart counterparts. The second option is ‘Ignore .html Suffix For Categories’. The default for this is “checked” (specifying a category name as category.html will ignore the suffix “.html”). Products/pages can always be referenced as simply ‘product’ (or ‘page’), however this would be very unusual in an HTML environment.



    Some examples:
  • A product in the cart as ‘category1/category2/product.html’ can now be referenced as ‘product.html’ or simply ‘product’.
  • The category2 category can be referenced as simply ‘category2’ or ‘category2.html’ (if the “Ignore Suffix” checkbox is checked).
  • A bad name (one unknown to the SEO engine) will still result in a 404 Page Not Found error page.
  • This translation ONLY DEALS WITH FLAT SEO NAMES. I.e. if you have a product in the cart as ‘cat1/cat2/cat3/product.html’, it will only resolve if given ‘product.html’. Any of the ‘cat’ path components are assumed to be valid path components.



    How to get it:

    Go to [url]http://www.ez-ms.com/products/local-addon.html[/url]



    If you’re feeling generous and would like to contribute to the cause, enter a purchase amount. But you are not required to do so.



    Complete the checkout process. I require you go provide me contact information so I can keep track of how many are using this free service and also so I can update you if bugs are found/fixed. Once checkout is complete, you should receive an email with a link to the download.



    Enjoy,

    tony

[quote name=‘tbirnseth’]For instance, a Yahoo store has a product that is refernced as “junk.html”. In cs-cart, this product is actually referenced by “category1/category2/junk.html”. Hence a “site.com/junk.html” will yield a 404 Page Not Found error. Yahoo might have a category as ‘cat3.html’ but in cs-cart it might be in ‘cat1/cat2/cat3’. A Yahoo ‘page’ (though they don’t really have the page/category concept) of ‘p2.html’ but in cs-cart it is ‘p1/p2.html’. This extension attempts to resolve all these issues.[/quote]



Maybe I’m not understanding something, but isn’t this already an option in CS-Cart? I know that I have my setting to:



saltwatertogo.com/product.html



Maybe I didn’t read your post right? If I didn’t than maybe you can explain this better?



Thank you,



Brandon

[quote name=‘brandonvd’]Maybe I’m not understanding something, but isn’t this already an option in CS-Cart? I know that I have my setting to:



saltwatertogo.com/product.html



Maybe I didn’t read your post right? If I didn’t than maybe you can explain this better?



Thank you,



Brandon[/QUOTE]



You can have it one way or the other (the SEF product format setting controls how products are resolved). This is intended to be a transitional method so that the “flat” names resolve, but are resolved via a 301 redirect so the search engines know that the link has moved. This then jives with what is generated in the sitemap, catalog, etc.



If your ‘product.html’ actually lives in category1/product.html then setting the format to “product_name.html” will force it to resolve to that name only (try referencing your page via category/product.html, it will fail with a 404 if you have the SEF setting for products as product_name.html). However, with this mod it will resolve to either (if the format is category_name/product_name.html) and generate the redirect to the correct page if it isn’t resolved via the standard methods.



Most notably this addresses category names. “category.html” isn’t supported at all in cs-cart but is widely used by other providers. So when trying to convince a customer to move to cs-cart, they would have to re-establish all their SEO links. Not something many people see as valuable.



Also, this won’t work for “pages” at all in the standard implementation. There is no setting for the format of “pages”. They are assumed to be referenced via the hierarchy in which they live.

Thank you for your contribution Tony.

I can see how this would be a huge help to someone migrating over, excellent mod.



Is there an SEO advantage to having your categories map over to a .html? (i.e. maybe some sites only let you link to a page?)