Customise your own SEO Urls

This mod allows you to specify your own URLS for better SEO





Currently it only works on products and still requires a little work for search results, but this will be added as both me and Zyles develope it further…





[COLOR=red]BEFORE MAKING ANY CHANGES, BACKUP THE FOLLOWING FILES INCASE[/COLOR]

  • admin/products_pages/products_update.tpl
  • addons/seo/func.php
  • include/customer/products.php





    1. Edit database using somthing like phpMyAdmin

    and find the table > cscart_product_descriptions.





    Add a field named ‘url’ to the end, Set it as Varchar(255)





    2. Edit template > admin/products_pages/products_update.tpl





    Find this line :

```php



```

Add this below it:
```php

SEO URL Prefix:




```



[B]3. Next edit addons/seo/func.php[/B]

Replace this line
```php
$tpl_source = str_replace($match, '{$product.product|fn_generate_name:"p":$product.product_id}.html', $tpl_source);
```

With this :

```php
$tpl_source = str_replace($match, '{if $product.url != ""}
{$product.url|fn_generate_name:"p":$product.product_id}.html
{else}
{$product.product|fn_generate_name:"p":$product.product_id}.html
{/if}', $tpl_source);
```



[B]4. Edit include/customer/products.php[/B]


Add this code just before this at the very bottom of the file.

Above this code
[COLOR=red]} else {[/COLOR]
[COLOR=red]fn_set_exception('access_denied') ;[/COLOR]
[COLOR=red]}[/COLOR]
[COLOR=red]}[/COLOR]
[COLOR=red]?>[/COLOR]

```php

$url= db_get_field("SELECT url FROM $db_tables[product_descriptions] WHERE product_id='$product_id' LIMIT 1");
$smarty->assign('url', $url);

```




Now in the products pages of the admin you can enter your own SEO URL in the same way you can enter a page title or keywords. So typing in for instance : "this is my product"

Will give you a link like : this-is-my-product-p121.html

[B]So no more having to make your product title look untidy just for getting a few keywords into the url !![/B]


We are also going to be making these changes for the categories and other pages along with adding sub folders for the category the product is being viewed under so hopefully you will be able to have seo urls like : [URL="http://www.shop.com/sony/wide-screen-plasma-tv.html"]www.shop.com/sony/wide-screen-plasma-tv.html[/URL]


[B]To see this current version in action, look at the first featured products link here : [/B]
[URL="http://www.car-audio-accessories.co.uk/nissan-c127.html"]http://www.car-audio-accessories.co.uk/nissan-c127.html[/URL]


[COLOR=red][B]MOD DEVELOPMENT BY : SWS & ZYLES[/B][/COLOR]

Project progress:



So far we figured out how to remove the pXXX.html and cXXX.html so all urls are basicly: www.domain.com/my-url.html



These can be defined in the admin section. And will also be implemented for topics, pages etc.



A script is also included that will automaticly generate urls using the current product names in database when you install it.



The hierarchy style with directories is a bit more tricky, but it’s coming.



Stay tuned.

Theres still a lot to be done for this to be a complete mod… but above is just the building blocks…



Well im signing off for about 1 week now so have fun everybody !!!

Your hard work is appreciated. Have a happy holiday.

Thanks so much for the mod. It is something that we will most definitely use.



One question that I have is what happens if you do not enter a custom URL? Will one be generated from the product description?



Have a great holiday everyone.



Bob

At present… until further dev is continued this only works for products, there are more things to add to this which will be done after xmas.

Its by no means a full solution yet !



In answer to your Q.

If you dont enter a custom url, the default will be used !

Project progress:



So far we figured out how to remove the pXXX.html and cXXX.html so all urls are basicly: www.domain.com/my-url.html



These can be defined in the admin section. And will also be implemented for topics, pages etc.



Also a script is included that will automaticly generate urls using the current product names in database when you install it.



The hierarchy style with directories is a bit more tricky, but it’s coming.



Stay tuned.

Whoa… Thats an awesome mod! Definately something we could all use!



I do have one question though, lets say your selling a table, can you make your URL something like: Custom Application Development Software for Business - Salesforce.com without the “pXXX.html”, and ending in a trailing “/”? Since the product ID really has no value for SEO.



Thanks.

That’s the idea. I have forwarded these suggestions to CS-Cart aswell and they will hopefully include these functionalities in the next versions. But it might be a couple of months from now.



Our next release will probably only include the functionality of having custom .html for all pages in the cart.



Ideas for having urls like: www.domain.com/category/product/ and product.html extensions are planned in a future version.



If anyone is a king on regex we could use a bit of help to speed the process. :wink:

Good Work Zyles & SMS, look forward to your final work…we’ve been hammering CS to do this forever…

[quote name=‘Zyles’]That’s the idea. I have forwarded these suggestions to CS-Cart aswell and they will hopefully include these functionalities in the next versions. But it might be a couple of months from now.



Our next release will probably only include the functionality of having custom .html for all pages in the cart.



Ideas for having urls like: www.domain.com/category/product/ and product.html extensions are planned in a future version.



If anyone is a king on regex we could use a bit of help to speed the process. ;)[/QUOTE]



Zyles,



Just to make sure I understand you correctly, are you saying that the pXXX.html is required for the cart to work properly? If yes, why does it need that in the URL to work properly?



You say in the next release the cart will probably have “custom” pages, do you mean to where you can actually mod where things are within each page individually?



I think the best URL you can have is something like Custom Application Development Software for Business - Salesforce.com. I have talked to SEO’s about this, and have been told that folders on the root of a site are giving the highest value because rather than being a “page” in a folder, you are the “index” of the folder.



I’m not sure what “Regex” is, but if theres anything I can do to help with the cart development, let me know and I will do my best.



Thanks.

[quote name=‘Brandito’]Zyles,



Just to make sure I understand you correctly, are you saying that the pXXX.html is required for the cart to work properly? If yes, why does it need that in the URL to work properly?



You say in the next release the cart will probably have “custom” pages, do you mean to where you can actually mod where things are within each page individually?



I think the best URL you can have is something like Custom Application Development Software for Business - Salesforce.com. I have talked to SEO’s about this, and have been told that folders on the root of a site are giving the highest value because rather than being a “page” in a folder, you are the “index” of the folder.



I’m not sure what “Regex” is, but if theres anything I can do to help with the cart development, let me know and I will do my best.



Thanks.[/QUOTE]



As it is now, the pXXX is needed because the cart validates the number and the letter such as “p123” to “product 123”, “c123” to “category 123”. This is the way CS-Cart built it.



However I made a workaround using another method so you are able to remove it and have full custom urls up to the .html point.



I read a lot of SEO myself and I know about hierarchy. However it’s not recommended if you have long strings, for example. Look at this url in cs-cart demo:



HP Pavilion a1000n Desktop PC (Intel Celeron D Processor 340, 512 MB RAM, 80 GB Hard Drive, DVD/CD-RW Drive)

/hp-pavilion-a1000n-desktop-pc-intel-celeron-d-processor-340-512-mb-ram-80-gb-hard-drive-dvd-cd-rw-drive-p1120.html



That seems pretty spammy and way too long. Even if you make it / at end:

/hp-pavilion-a1000n-desktop-pc-intel-celeron-d-processor-340-512-mb-ram-80-gb-hard-drive-dvd-cd-rw-drive-p1120/



Search engines prefer sites that are “themed”, like category based. Like:

/desktops/

/desktops/hp-pavilion/

/desktops/hp-pavilion/a1000n-intel-celeron/



That way search engines know the HP Pavilion is related to the desktops category. If it was all on root level, it’s pretty hard for the search engine to know which pages are related and which are not, because it’s not a logical setup.



Another problem with having the product next to the root is that the url can tend to become very long as you try to fit in a lot of keywords. It’s easier if you use directory structure and it makes more sense both for the user and the search engine.



Sure it’s good if you want pagerank on every page, but pagerank is not everything.



This might be my own opinion and SEO is as such. Opinions. :wink:



However my goal is to have multiple ways for the store owner to choose how they want their urls to be. You may want catalog hierarchy structure, or one level, .html ending, or whatever. So you may use what you feel works for you if you disagree with my logics.



By “custom pages”, I mean “objects”, where an object is either a product, category, page, topic etc. All these will be supported by the custom urls mod.



As long as CS-Cart themselves does not implement this properly, I and SWS will hopefully keep working on this to improve it as much as we can as there is free time.



Any developer help is of course welcomed to speed up the process. Regex is Regular Expressions, a bit complex…



Because personally I think this is a very essential addition to success on SEO, and need it badly myself.

[quote name=‘Zyles’]As it is now, the pXXX is needed because the cart validates the number and the letter such as “p123” to “product 123”, “c123” to “category 123”. This is the way CS-Cart built it.



However I made a workaround using another method so you are able to remove it and have full custom urls up to the .html point.



I read a lot of SEO myself and I know about hierarchy. However it’s not recommended if you have long strings, for example. Look at this url in cs-cart demo:



HP Pavilion a1000n Desktop PC (Intel Celeron D Processor 340, 512 MB RAM, 80 GB Hard Drive, DVD/CD-RW Drive)

/hp-pavilion-a1000n-desktop-pc-intel-celeron-d-processor-340-512-mb-ram-80-gb-hard-drive-dvd-cd-rw-drive-p1120.html



That seems pretty spammy and way too long. Even if you make it / at end:

/hp-pavilion-a1000n-desktop-pc-intel-celeron-d-processor-340-512-mb-ram-80-gb-hard-drive-dvd-cd-rw-drive-p1120/



Search engines prefer sites that are “themed”, like category based. Like:

/desktops/

/desktops/hp-pavilion/

/desktops/hp-pavilion/a1000n-intel-celeron/



That way search engines know the HP Pavilion is related to the desktops category. If it was all on root level, it’s pretty hard for the search engine to know which pages are related and which are not, because it’s not a logical setup.



Another problem with having the product next to the root is that the url can tend to become very long as you try to fit in a lot of keywords. It’s easier if you use directory structure and it makes more sense both for the user and the search engine.



Sure it’s good if you want pagerank on every page, but pagerank is not everything.



This might be my own opinion and SEO is as such. Opinions. :wink:



However my goal is to have multiple ways for the store owner to choose how they want their urls to be. You may want catalog hierarchy structure, or one level, .html ending, or whatever. So you may use what you feel works for you if you disagree with my logics.



By “custom pages”, I mean “objects”, where an object is either a product, category, page, topic etc. All these will be supported by the custom urls mod.



As long as CS-Cart themselves does not implement this properly, I and SWS will hopefully keep working on this to improve it as much as we can as there is free time.



Any developer help is of course welcomed to speed up the process. Regex is Regular Expressions, a bit complex…



Because personally I think this is a very essential addition to success on SEO, and need it badly myself.[/QUOTE]



Great, since you found a way around it, I assume that it willl be brought into this mod further along?



You bring up some interesting points about SEO, I hadn’t really that about it in that way.



I will look into Regex, and see if I can get any kind of understanding with it. I have seen about 7 - 8 different types of Reges though. Which kind would be implemented with CS-Cart?

You guys should see what Zyles has been cooking up in the [COLOR=red]MOD kitchen[/COLOR] :smiley:



Its no longer in the rumor mill !!! its now in the kitchen…and its HOT HOT HOT !





HEHE, dont ask why I posted that, maybe excitement or maybe… :rolleyes:

Okay, crazy talk over…

This release is gonna be HOT! :wink:



The release will be a FULL RELEASE so you can customize your URLs any way you want.



And if you already have pages indexed by search engines, DON’T WORRY! We have been thinking outside the box and made changes so that all your old URLs will create an automatic PERMANENT REDIRECT to your new URLs. This will make your pages inherit pagerank and not create 404 errors when someone uses the old URLs!



Stay tuned.

Man… I can’t wait! This mod is going to be so awesome! You guys rock! Keep up the good work! =)

Hi,



Is this mod ready yet?



Thanks,

MM10000

Hi guys…



Appreciate your input into cs-cart… it seems it’s getting better just by being fed from your “MOD Kitchen”



Wondering… is this mod ready to go?

Too much time went into working with this and there were a lot of issues which needed to be changed in the core code. So we got fed up and hope for CS-Cart to implement a proper SEO solution in 1.3.5 by our recommendations instead as standard. If they fail again I’m sure we will try and fix it ourselves… again. Hopefully we don’t have to.



You can always have a say in the matter and contact CS-Cart via the helpdesk expressing your need in this mod.

Hi,



This is a very nice mod especially for me since i’m using arabic characters and the URL used to be unreadable.

However, there is something wrong that I hope you can help me with. The home page works fine with all the products correctly re-written using the ‘url’ field from the table.

However, when I click on sub-category entry from the category menu to view its products, the returned products are re-written using the ‘product’ field and not the ‘url’ field. Please note, that if this sub-category has a list of featured products, they are re-written correctly.

Is there something wrong or is this part still to be implemented?

Your help will be appreciated.



Thank you