Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Also Purchased options or improvements?


smartwork

Recommended Posts

Our order quantity has gotten to the point where the "Also Purchased" function is grinding slower and slower. I've tried installing the optimized contribution, but not much difference. Anyone know of an alternative, or anyone know of a way where we can tell it to only search orders that are "x" days old - just so it doesn't search the entire orders table?

 

Thanks!

Link to comment
Share on other sites

You could also try something like the Family products contribution which allows you to assign products to different products, this way you can pick and choose what you would like to push with what items you sell. Just change the wording and you are good to go.

 

As for searching for only a certain amount of time no idea so can't help you with that.

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Link to comment
Share on other sites

I think this would do what you need ... change the upper part of your file includes/modules/also_purchased_products.php to this AFTER taking a backup ...

 

the $max_days parameter can be set to your liking!

 

<?php
/*
 $Id: also_purchased_products.php,v 1.21 2003/02/12 23:55:58 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

$max_days = '60';

 if (isset($HTTP_GET_VARS['products_id'])) {
$orders_query = tep_db_query("select p.products_id, p.products_image from " . TABLE_ORDERS_PRODUCTS . " opa, " . TABLE_ORDERS_PRODUCTS . " opb, " . TABLE_ORDERS . " o, " . TABLE_PRODUCTS . " p where opa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and opa.orders_id = opb.orders_id and opb.products_id != '" . (int)$HTTP_GET_VARS['products_id'] . "' and opb.products_id = p.products_id and opb.orders_id = o.orders_id and p.products_status = '1' and o.date_purchased > SUBDATE( now(  ) ,  INTERVAL " . $max_days . "  DAY  ) group by p.products_id order by o.date_purchased desc limit " . MAX_DISPLAY_ALSO_PURCHASED);
$num_products_ordered = tep_db_num_rows($orders_query);
if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED) {
?>
<!-- also_purchased_products //-->

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

  • 5 months later...
Our order quantity has gotten to the point where the "Also Purchased" function is grinding slower and slower. I've tried installing the optimized contribution, but not much difference. Anyone know of an alternative, or anyone know of a way where we can tell it to only search orders that are "x" days old - just so it doesn't search the entire orders table?

 

Thanks!

 

Thank you Wendy :thumbsup:

 

That was just what I was searching for in here..... ;)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...