by Chemo
This contribution replaces the standard product listing with a top down union query generated listing. It lists all products in Cat1 - subCat1 - subCat2 - etc. and sorts the results by products_ordered. Cat1 is the $current_category_id. Thus, as customers drill down through the categories it presents the layered bestsellers for all subcats in and below the current category.
This contribution was coded to be a proof of concept and is geared as a guide for developers and webmasters of high traffic and high volume stores.
There are 2 files to upload and only the index.php file has to be modified to implement. Of course, if you drop this in you should trim all the extra stock code to save the queries...
If you don't know what a union query is and if it will benefit your store please do not install this contribution.
This contribution first gets all subcategories to the current. Next, it queries for all products in those returned subcategories and the current. Next, it performs a union query for the product information which is then passed to a custom unionSplit class.
The contructed union query is much easier on system resources as it uses proper indexes and DOES NOT use filesort or temporary tables.
Upload 2 new files, modify 1 existing file, done. Install should take about 3 minutes.
Before you install this you better know what you're doing. I'm not going to provide support for this and offer it ONLY as a guide for those webmasters that contracted by high volume sites and need this. If you don't know if you need it the answer is no.
STEP 1 - Upload the included files
The files should be located in the upload directory of this contribution.
- includes/classes/union_split_page_results.php should be uploaded to your *catalog*/includes/classes directory
- includes/modules/product_listing_union.php should be uploaded to your *catalog*/includes/modules directory.
STEP 2 - Edit index.php
2(a) - Remove the old code for generating the product listing. If you don't know how to do this close the install file now.
2(b) - Add these two lines of code in place:
The union query is very easy on system resources when compared to the traditional join query used by osCommerce. Using my osC-Explain contribution I have verified performance. I highly recommend installing the osC-Explain contribution if you are interested in optimizing high volume, high traffic, or high load stores.
osCommerce is a community driven organization and as such the support base will fall entirely on the forum members. This contribution is geared toward developers and not store owners that cut-n-paste contributions.
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...
By me . Enjoy!
eCommerce-Directory.orgIf 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 AdvertisementIf 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. |