cName and pName v1.5 for osCommerce-ms2

by Chemo

What does this contribution do?

This contribution 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.

How does this contribution work?

This contribution creates a cache file of product and category names then uses that to swap pName/products_id and cName/cPath parameters. Upon admin edting a category or product the cache files are 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 the traditional mod_rewrite methods. In addition, this contribution supports multi-lingual stores.

Screenshots

URL with category name

URL with product name

URL with product and category name

How do I install this contribution?

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

STEP 1 - Upload the included files

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

You will need to edit these two files and fill in the correct value for the $cache_dir variable. I would suggest creating a folder OUTSIDE your webroot and give the webserver read/write permission.

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

Find this code:

Directly AFTER add this:

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

Find the function tep_href_link()

REPLACE WITH THIS CODE:

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

Find this code:

Directly AFTER add this:

Notes

The installation is pretty straight forward. Before reporting any bugs please verify that the cache files are being written to file (cache directory variable).

Support

osCommerce is a community driven organization and as such the support base will fall entirely on the forum members. The base class 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!

Enter Donation amount: $

Credits

This contribution is original work. Enjoy!