@Gilby
Firstly, I like this module. Like you I never understood the module manager approach.
Secondly, perhaps because I tend to do modified, quite highly structured sites, I often need the number of images to be constant, so as not to break the formatting of the page. So, what I tend to do is 'pad' the number of cross sells with other products, so that, for instance, four products are always shown. If only two xsells are set then two other products are used to make up the numbers.
This padding might be a nice feature to include in the module. Because I tend to do it for a specific site I haven't done all the coding ( for instance an admin switch to turn this on and off ) but thought I'd send you the changes that I make. Just a quick change to the query really:
Code:
$sql1 = "(select distinct p.products_id, p.products_image, pd.products_name
from " . TABLE_PRODUCTS_MXSELL . $mxsell . " xp, " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd
where xp.products_id = '" . $_GET['products_id'] . "'
and xp.xsell_id = p.products_id
and p.products_id = pd.products_id
and pd.language_id = '" . $_SESSION['languages_id'] .
$xsell_sort_by.')';
$sql2 = "(select distinct p.products_id, p.products_image, pd.products_name
from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = pd.products_id
and p.products_id != '" . $_GET['products_id'] . "'
and pd.language_id = '" . $_SESSION['languages_id'] .
'order by rand()'.')';
$sql = $sql1. ' union '.$sql2." limit " . constant('MAX_DISPLAY_XSELL' . $mxsell);
$xsell_query = $db->Execute($sql);
It evidently would not be too hard to include a if statement that either uses or doesn't use the second query depending on an admin switch. I just have never done it because I haven't needed it.
As I say you have my respect for having taken this mod on.
Bookmarks