Optimized also_purchased_products module v1.0 for osCommerce-MS2

by Chemo

What does this contribution do?

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.

How does this contribution work?

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.

Screenshots

Stock osCommerce module - EXPLAIN SELECT

Modified contribution module - EXPLAIN SELECT

How do I install this contribution?

Upload 1 file, done. Install should take about 30 seconds.

STEP 1 - Upload the included files

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

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!

Enter Donation amount: $

Credits

This contribution is original work. Enjoy!