by Chemo
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.
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.
URL with category name
URL with product name
URL with product and category name
STEP 1 - Upload the included files
The files should be located in the upload directory of this contribution.
- includes/seo_cache.php should be uploaded to your *catalog*/includes/ directory
- admin/includes/reset_seo_cache.php should be uploaded to your *catalog*/*admin directory*/includes/ directory.
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:
The installation is pretty straight forward. Before reporting any bugs please verify that the cache files are being written to file (cache directory variable).
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!
This contribution is original work. Enjoy!