Ultimate SEO URLs v2.0 for osCommerce-ms2

by Chemo

If you are upgrading please see the UPGRADE DIRECTIONS

If you have a CRE Loaded store please see the CRE Loaded install directions

What does this contribution do?

This contribution builds on the cName contibution and replaces the stock osCommerce method of passing the product_id and cPath parameters. The intent is to display the product name and category name as part of the URL.

Currently, this contribution supports 2 different methods for creating search engine friendly URLs.  A store owner may toggle between the two methods at leisure from the convenience of an admin control panel setting group.

METHOD #1 - cName (v1.X series)

This method does NOT use mod_rewrite and is suitable for any store on any server operating system.  This is advantageous to some since a store hosted on a Windows server that uses IIS (and not Apache) cannot use mod_rewrite based transformers.  This method is the fastest and most compatible SEO URL contribution currently available.

This method will work on any server.

METHOD #2 - Rewrite (v2.X series)

This method is the most advantageous with respect to optimizing for search engines.  It rewrites all category and product URLs to appear as static HTML files.  Although faster than other mod_rewrite based contributions this one is still slower than METHOD #1 by a few milliseconds.  In addition, this contribution does not add significant overhead to the server resources.

This method relies on Apache mod_rewrite so is not compatible with Windows/IIS servers or Front Page Extensions.

NEW IN THIS RELEASE:

This release is also bundled with the new osC Advanced Cache Class. This moves the cache off the filesystem and into the database.

Why store cache in the database? Well, there were some store owners that had trouble with setting up a cache directory and also getting the permissions correct. This is an elegant solution to those problems since there is no need to enter any path or setup any directory with the right permissions. Also, the cache class will serve as the backbone of my future releases (osC Advanced Templating Engine, osC Search Engine / Spider, more performance enhancements, etc).

Installation of the cache class is a 2 step process: upload the file and call the install script in your browser. That is it! Install couldn't be easier! The directions below are bundled...

How does this contribution work?

This contribution creates a cache of product, manufacturer, and category names then uses that to swap pName/products_id, mName/manufacturers_id and cName/cPath parameters. Upon admin edting a category or product the cache is deleted. Then on the next customer visit to the page each cache file is recreated. Each language gets a separate cache file.

This contribution is fully dynamic and presents less server load than most traditional mod_rewrite methods. In addition, this contribution supports multi-lingual stores, unlimited nested categories, and duplicates (categories and products).

Screenshots

Admin Control Panel Options

Version 1.X (cName) Screenshots

URL with category name

URL with product name

URL with product and category name

URL with manufacturer name

http://yourdomain.com/index.php?mName=touchstone-entertainment

Version 2.X (Rewrite) Screenshots

URL with category name

URL with product name

URL with manufacturer name

http://yourdomain.com/touchstone-entertainment-m-15.html

How do I install this contribution?

Upload 3 new files, modify 4 existing files, done. Install should take about 5 minutes.

Before you install this it should be noted that it is NOT COMPATIBLE with the stock osCommerce option of SEF URLs. Be sure to turn this off if you have it enabled!

STEP 1 - Upload the included files

The files should be located in the upload directory of this contribution.

STEP 2 - Install the database settings

In step #1 you should have uploaded a file to your catalog directory called "install-seo.php". Call that file in your web browser.  Read the page...there are 2 options => install or uninstall.  Select the install link and it will add all the settings. If you are upgrading first UNINSTALL then re-install.

In step #1 you should have uploaded a file to your catalog directory called "install-cache.php". Call that file in your web browser. Read the page...there are 2 options => install or uninstall. Select the install link and it will add the cache table. Do this even if you are upgrading.

STEP 3- Edit *catalog*/includes/application_top.php

3 (1) Find this code:

3 (1) Directly AFTER add this:

3 (2) Find this code:

3 (2) REPLACE WITH THIS:

3 (3) Find this code:

3 (3) REPLACE WITH THIS:

STEP 4 - Edit *catalog*/includes/functions/html_output.php

4 (1) Find the function tep_href_link()

4 (1a) IF YOU DO NOT HAVE PAGE CACHE INSTALLED REPLACE WITH THIS CODE:

4 (1b) IF YOU HAVE PAGE CACHE INSTALLED REPLACE WITH THIS CODE:

STEP 5 - Edit *catalog*/includes/modules/product_listing.php

5 (1) Find this code:

5 (1) REPLACE WITH THIS:

STEP 6 - Edit *admin directory*/categories.php

6 (1) Find this code:

6 (1) Directly AFTER add this:

STEP 7 - Edit *admin directory*/includes/functions/general.php

Add this code to the file just above the ending ?> tag:

STEP 8 - Edit .htaccess file (in your catalog directory)

If you don't have an .htaccess file in your catalog folder create one.

If you are on a Windows/IIS server skip this step - you won't be able to use the rewrite method.

8 (1a) If your store is located in a FOLDER add this to the /folder/.htaccess file:

NOTE: you will have to edit the "folder" to match your directory name!

8 (1b) If your store is located in the root add this to the /.htaccess file:

STEP 9 - Configure the settings

Admin Control Panel => Configuration => Enable SEO URLs => true

Admin Control Panel => Configuration => Choose URL Type => cName or Rewrite

Admin Control Panel => Configuration => Filter Short Words => 3

Admin Control Panel => Configuration => Reset SEO URLs Cache => false

NOTE: The filter short words option will remove all words less than or equal to the number! You can set this to 0 to disable.

Upgrade

    1. Overwrite current files with new. Upload the cache.class.php file
    2. Call the install-seo.php file in the web browser and select UNINSTALL. Turn right around and select INSTALL. This will clear the current settings and get the new ones in there. Call the instal-cache.php file in your browser and select INSTALL
    3. Update the code in step 3(1). Also, depending on which version you are upgrading from you may also need to do steps 3(2) and 3(3).
    4. Just to make sure you have the latest code replace your tep_href_link() function with the one provided.
    5. If you are not upgrading from the latest version you may need to peform step #5
    6. Update your code with step #6
    7. Perform step #7
    8. Step #8 should already be completed from a past install
    9. Reconfigure the settings in the admin control panel

Notes

The installation is pretty straight forward. I anticipate the biggest source of errors will be with modifying the WRONG .htaccess file.  It should be the one in your catalog directory.  So, if your store is located in a folder (i.e. - www.domain.com/catalog/ ) then you should edit/create the .htaccess in THAT folder.  For those that don't know you can have an .htaccess file in each folder and your site is NOT limited to just 1 in the root.

Support

Following the massive requests for me to install my contributions on store owners sites I will start taking them up on their offer. If you would like me to install this or any other contribution on your site just shoot me an email (link at top of page). Upgrade or installation of Ultimate SEO URLs will be set at $50 per install. Sound steep? Well, $20 of that will go toward the osCommerce development team so they can keep coding too. You get this installed hassle free. I get $30 for my time. The osCommerce team gets $20 for just being so damn cool. Everyone wins. :-)

osCommerce is a community driven organization and as such the support base will fall entirely on the forum members. The base code is thoroughly commented and should be easy to follow for any coder. I offer limited support in-between paid projects (feeding my family comes first before volunteer time).

If you use this contribution and find it useful a small donation can be made via PayPal. This will enable me to offer one-on-one support and also fund releasing other contributions. In addition, if you make a donation it'll make you eligible for other performance optimization contributions that are not released!

After all the contributions I've coded and released I'm beginning to think nobody reads this far down...

Enter Donation amount: $

Credits

This contribution is original work. Enjoy!

Additional credit goes to WebPixie and Fred Doherty for their additions. Further credit goes to claroque for development support.






eCommerce-Directory.org

If you're interested in SEO for your store be sure to submit your site to my directory! It has a high PR and clean links






Blatant Footer Advertisement

If you need reliable, extremely fast, and expert webhosting for your store I am opening my server to accounts.  Each account gets unlimited everything and trust my server is setup to run osCommerce at top speed.

osCommerce Hosting and Technical Support - by Chemo