by Chemo
This contribution replaces the stock osCommerce module for also_purchased_products.php. It uses a dynamically generated SELECT / JOIN / UNION query that has proven to be very fast and less server resource intensive than the stock code.
This contribution creates a dynamic query based on the products_id and uses less system resources. How does it work? Read the code then refererence the MySQL website to read up.
The stock code needs to create a temporary table to execute the query (hold the rows) and also needs to do an extra pass.
Stock osCommerce module - EXPLAIN SELECT
Modified contribution module - EXPLAIN SELECT
STEP 1 - Upload the included files
The files should be located in the includes directory of this contribution.
- includes/modules/also_purchased_products.php should be uploaded to your *catalog*/includes/modules directory
There is a define at the top of the file called USE_STOCK_OSC which must be set WITHOUT the single quotes. Set it to true to quickly switch back to the original stock osC code. Leave it as false to use the contribution code.
Notes
The installation is as easy as it gets. If you have problems with this one just delete the file and upload the backup copy.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!
Credits
This contribution is original work. Enjoy!