Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cross Sell for 2.3.1 (X-Sell)


newburns

Recommended Posts

There was no contribution support page, so I decided to make one here.

This is for contribution addon --> http://addons.oscommerce.com/info/8330

 

Based on Cross-Sell (XSell) Module v2.6 by bluephoenix and updated by others.

 

Updated by mort=lemur for use with OSC 2.3.1 All credit to the original authors.

 

Cross sell enables selection of related products to display on the product info page via an admin screen, potentially boosting your sales.

 

Screenshots included.

 

@@Mort-lemur

@@Snoopy10

Link to comment
Share on other sites

I'm not particularly a developer, however, I have this add-on installed, and I had no where to post to the people actively developing this one. So I figured I would make a place like all the rest of the add-ons.

I will support it to the best of my ability.

However,

@@burt

Is there another solution for keeping up to date with add-on versions?

Link to comment
Share on other sites

1054 - Unknown column 'p.image_folder' in 'field list'

 

select p.products_id, p.products_model, pd.products_name, p.products_image, p.image_folder, p.products_price, p.products_tax_class_id, p.products_id from products p, products_description pd where p.products_id = pd.products_id and pd.language_id = "1" order by pd.products_name asc limit 0, 20

 

Any idea how to set the value for p.image_folder and p.image_display

Link to comment
Share on other sites

p.image_folder and p.image_display are other columns in the products table. When you install the addon protected images, then you need these. Otherwise, take out the columns again and adjust the path to images again. Compare the previous version.

Link to comment
Share on other sites

If you haven't installed Protected Images, use the following code for the file /catalog/includes/modules/xsell_products.php

 

<?php

/*

$Id: xsell_products.php, v1 2002/09/11

// adapted for Separate Pricing Per Customer v4 2005/02/24

 

osCommerce, Open Source E-Commerce Solutions

<http://www.oscommerce.com>

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

if ((USE_CACHE == 'true') && empty($SID)) {

// include currencies class and create an instance

require_once(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

}

 

if ($HTTP_GET_VARS['products_id']) {

 

$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price

from " . TABLE_PRODUCTS_XSELL . " xp left join " . TABLE_PRODUCTS . " p on xp.xsell_id = p.products_id

left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'

left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id

where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "'

and p.products_status = '1'

order by sort_order asc limit " . MAX_DISPLAY_XSELL);

 

$num_products_xsell = tep_db_num_rows($xsell_query);

if ($num_products_xsell > 0) {

?>

<!-- xsell_products //-->

<?php

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS);

//new contentBoxHeading($info_box_contents);

 

$row = 0;

$col = 0;

$info_box_contents = array();

while ($xsell = tep_db_fetch_array($xsell_query)) {

if (tep_not_null($xsell['specials_new_products_price'])) {

$xsell_price = '<s>' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</s><br>';

$xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</span>';

} else {

$xsell_price = $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id']));

 

 

 

 

 

}

$text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a><br>' . $xsell_price. '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=buy_now&product_to_buy_id=' . $xsell['products_id'], 'NONSSL') . '">' . tep_draw_button( IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link( basename( $PHP_SELF ), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $xsell['products_id']));

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="33%" valign="top"',

'text' => $text) ;

$col ++;

if ($col > 2) {

$col = 0;

$row ++;

}

}

//new contentBox($info_box_contents);

 

?>

 

<div class="ui-widget infoBoxContainer">

<div class="ui-widget-header ui-corner-top infoBoxHeading">

<span><?php echo TEXT_XSELL_PRODUCTS; ?></span>

</div>

 

<?php new contentBoxStart($info_box_contents); ?>

</div>

 

<!-- xsell_products_eof //-->

<?php

}

}

?>

Edited by Snoopy10
Link to comment
Share on other sites

If you haven't installed Protected Images, use the following code for the file /catalog/includes/modules/xsell_products.php

 

<?php

/*

$Id: xsell_products.php, v1 2002/09/11

// adapted for Separate Pricing Per Customer v4 2005/02/24

 

osCommerce, Open Source E-Commerce Solutions

<http://www.oscommerce.com>

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

if ((USE_CACHE == 'true') && empty($SID)) {

// include currencies class and create an instance

require_once(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

}

 

if ($HTTP_GET_VARS['products_id']) {

 

$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price

from " . TABLE_PRODUCTS_XSELL . " xp left join " . TABLE_PRODUCTS . " p on xp.xsell_id = p.products_id

left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'

left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id

where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "'

and p.products_status = '1'

order by sort_order asc limit " . MAX_DISPLAY_XSELL);

 

$num_products_xsell = tep_db_num_rows($xsell_query);

if ($num_products_xsell > 0) {

?>

<!-- xsell_products //-->

<?php

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS);

//new contentBoxHeading($info_box_contents);

 

$row = 0;

$col = 0;

$info_box_contents = array();

while ($xsell = tep_db_fetch_array($xsell_query)) {

if (tep_not_null($xsell['specials_new_products_price'])) {

$xsell_price = '<s>' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</s><br>';

$xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</span>';

} else {

$xsell_price = $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id']));

 

 

 

 

 

}

$text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a><br>' . $xsell_price. '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=buy_now&product_to_buy_id=' . $xsell['products_id'], 'NONSSL') . '">' . tep_draw_button( IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link( basename( $PHP_SELF ), tep_get_all_get_params(array('action', 'products_id')) . 'action=buy_now&products_id=' . $xsell['products_id']));

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="33%" valign="top"',

'text' => $text) ;

$col ++;

if ($col > 2) {

$col = 0;

$row ++;

}

}

//new contentBox($info_box_contents);

 

?>

 

<div class="ui-widget infoBoxContainer">

<div class="ui-widget-header ui-corner-top infoBoxHeading">

<span><?php echo TEXT_XSELL_PRODUCTS; ?></span>

</div>

 

<?php new contentBoxStart($info_box_contents); ?>

</div>

 

<!-- xsell_products_eof //-->

<?php

}

}

?>

 

 

If you haven't installed Protected Images, use the following code for the file /catalog/admin/xsell.php

 

 

<?php

/* $Id$

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

xsell.php

Original Idea From Isaac Mualem [email protected] <mailto:[email protected]>

Complete Recoding From Stephen Walker admin@@snjcomputers.com

*/

require('includes/application_top.php');

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

require(DIR_WS_INCLUDES . 'template_top.php');

switch($_GET['action']){

case 'update_cross' :

if ($_POST['product']){

foreach ($_POST['product'] as $temp_prod){

tep_db_query('delete from ' . TABLE_PRODUCTS_XSELL . ' where xsell_id = "'.$temp_prod.'" and products_id = "'.$_GET['add_related_product_ID'].'"');

tep_db_query('delete from ' . TABLE_PRODUCTS_XSELL . ' where xsell_id = "'.$_GET['add_related_product_ID'].'" and products_id = "'.$temp_prod.'"');

}

}

 

$sort_start_query = tep_db_query('select sort_order from ' . TABLE_PRODUCTS_XSELL . ' where products_id = "'.$_GET['add_related_product_ID'].'" order by sort_order desc limit 1');

$sort_start = tep_db_fetch_array($sort_start_query);

$sort = (($sort_start['sort_order'] > 0) ? $sort_start['sort_order'] : '0');

if ($_POST['cross']){

foreach ($_POST['cross'] as $temp){

$sort++;

$insert_array = array();

$insert_array = array('products_id' => $_GET['add_related_product_ID'],

'xsell_id' => $temp,

'sort_order' => $sort);

tep_db_perform(TABLE_PRODUCTS_XSELL, $insert_array);

} // foreach $temp

} // if cross

// insert reciprocable x-sell products BOF

if ($_POST['reciprocal_link_cross']){

foreach ($_POST['reciprocal_link_cross'] as $temp2) {

$sort_start_query2 = tep_db_query('select sort_order from ' . TABLE_PRODUCTS_XSELL . ' where products_id = "'.$temp2.'" order by sort_order desc limit 1');

$sort_start2 = tep_db_fetch_array($sort_start_query2);

$sort2 = (($sort_start2['sort_order'] > 0) ? $sort_start2['sort_order'] : '0');

$sort2++;

$insert_array = array();

$insert_array = array('products_id' => $temp2,

'xsell_id' => $_GET['add_related_product_ID'],

'sort_order' => $sort2);

tep_db_perform(TABLE_PRODUCTS_XSELL, $insert_array);

} // foreach $temp2

} // if reciprocal_link_cross

// insert reciprocable x-sell products EOF

$messageStack->add(CROSS_SELL_SUCCESS, 'success');

//Cache

$cachedir = DIR_FS_CACHE_XSELL . $_GET['add_related_product_ID'];

if(is_dir($cachedir)) {

rdel($cachedir);

}

//Fin Cache

break;

 

case 'update_sort' :

foreach ($_POST as $key_a => $value_a){

tep_db_query('update ' . TABLE_PRODUCTS_XSELL . ' set sort_order = "' . $value_a . '" where xsell_id = "' . $key_a . '"');

}

$messageStack->add(SORT_CROSS_SELL_SUCCESS, 'success');

break;

}

?>

 

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

</table></td>

<td width="100%" valign="top">

<!-- body_text //-->

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

</tr>

<tr>

<td class="smallText" align="center">

<?php

echo tep_draw_form('search', FILENAME_XSELL_PRODUCTS, '', 'get'). tep_draw_hidden_field('add_related_product_ID', $add_related_product_ID);

echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search');

echo '</form>';

?>

</td>

</tr>

 

</table>

 

<?php

if ($_GET['add_related_product_ID'] == ''){

?>

<table border="0" cellspacing="1" cellpadding="2" bgcolor="#999999" align="center">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent" width="75"><?php echo TABLE_HEADING_PRODUCT_ID;?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_MODEL;?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_IMAGE;?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_NAME;?></td>

<td class="dataTableHeadingContent" nowrap><?php echo TABLE_HEADING_CURRENT_SELLS;?></td>

<td class="dataTableHeadingContent" colspan="2" nowrap align="center"><?php echo TABLE_HEADING_UPDATE_SELLS;?></td>

</tr>

<?php

if (isset($HTTP_GET_VARS['search'])) {

$search = tep_db_prepare_input($HTTP_GET_VARS['search']);

$products_query_raw = 'select p.products_id, p.products_model, p.products_price, p.products_tax_class_id, p.products_image, pd.products_name, p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" and pd.products_name like "%' . tep_db_input($search) . '%" order by pd.products_name asc';}else{$products_query_raw = 'select p.products_id, p.products_model, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_id from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by pd.products_name asc';}

$products_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);

$products_query = tep_db_query($products_query_raw);

while ($products = tep_db_fetch_array($products_query)) {

?>

<tr onmouseover="cOn(this); this.style.cursor='pointer'; this.style.cursor='hand';" onmouseout="cOut(this);" bgcolor='#FFFFFF' onclick=document.location.href="<?php echo tep_href_link(FILENAME_XSELL_PRODUCTS, 'add_related_product_ID=' . $products['products_id'], 'NONSSL');?>">

<td class="dataTableContent" valign="top"> <?php echo $products['products_id'];?> </td>

<?php

if ($products['products_model'] == NULL) {

$products_model = TEXT_NONE;

} else {

$products_model = $products['products_model'];

}

?>

<td class="dataTableContent" valign="top"> <?php echo $products_model;?> </td>

<td class="dataTableContent" align="center"> <?php echo tep_image(DIR_WS_CATALOG_IMAGES .$products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);?> </td>

<td class="dataTableContent" valign="top"> <?php echo $products['products_name'];?> </td>

<td class="dataTableContent" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<?php

$products_cross_query = tep_db_query('select p.products_id, p.products_model, pd.products_name, p.products_id, x.products_id, x.xsell_id, x.sort_order, x.ID from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd, '.TABLE_PRODUCTS_XSELL.' x where x.xsell_id = p.products_id and x.products_id = "'.$products['products_id'].'" and p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by x.sort_order asc');

$i=0;

while ($products_cross = tep_db_fetch_array($products_cross_query)){

$i++;

?>

<tr>

<td class="dataTableContent"> <?php echo $i . '.  <b>' . $products_cross['products_model'] . '</b> ' . $products_cross['products_name'];?> </td>

</tr>

<?php

}

if ($i <= 0){

?>

<tr>

<td class="dataTableContent"> -- </td>

</tr>

<?php

}else{

}

?>

</table></td>

<td class="dataTableContent" valign="top"> <a href="<?php echo tep_href_link(FILENAME_XSELL_PRODUCTS, tep_get_all_get_params(array('action')) . 'add_related_product_ID=' . $products['products_id'], 'NONSSL');?>"><?php echo TEXT_EDIT_SELLS;?></a> </td>

<td class="dataTableContent" valign="top" align="center"> <?php echo (($i > 0) ? '<a href="' . tep_href_link(FILENAME_XSELL_PRODUCTS, tep_get_all_get_params(array('action')) . 'sort=1&add_related_product_ID=' . $products['products_id'], 'NONSSL') .'">'.TEXT_SORT.'</a> ' : '--')?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="infoBoxContent">

<tr>

<td class="smallText" valign="top"><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID', 'action'))); ?></td>

</tr>

</table></td>

</tr>

</table>

<?php

}elseif($HTTP_GET_VARS['add_related_product_ID'] != '' && $HTTP_GET_VARS['sort'] == ''){

$products_name_query = tep_db_query('select pd.products_name, p.products_model, p.products_image, p.products_price from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = "'.$HTTP_GET_VARS['add_related_product_ID'].'" and p.products_id = pd.products_id and pd.language_id ="'.(int)$languages_id.'"');

$products_name = tep_db_fetch_array($products_name_query);

?>

<table border="0" cellspacing="0" cellpadding="0" bgcolor="#999999" align="center">

<tr>

<td><?php echo tep_draw_form('update_cross', FILENAME_XSELL_PRODUCTS, tep_get_all_get_params(array('action')) . 'action=update_cross', 'post');?><table cellpadding="1" cellspacing="1" border="0">

<tr>

<td colspan="6"><table cellpadding="3" cellspacing="0" border="0" width="100%">

<tr class="dataTableHeadingRow">

<td valign="middle" align="left"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . '/'.$products_name['products_image'], "", SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);?></td>

<?php

if ($products_name['products_model'] == NULL) {

$products_model = TEXT_NONE;

} else {

$products_model = $products_name['products_model'];

}

?>

<td valign="middle" align="left"><span class="main"><?php echo TEXT_SETTING_SELLS.$products_name['products_name'].' ('.TEXT_MODEL.': '.$products_model.') ('.TEXT_PRODUCT_ID.': '.$_GET['add_related_product_ID'].')';?></span></td>

<td valign="middle" align="center"><?php echo tep_image_submit('button_update.gif')?></td>

<td valign="middle" align="center"><?php echo '<a href="'.tep_href_link(FILENAME_XSELL_PRODUCTS, 'men_id=catalog').'">' . tep_image_button('button_cancel.gif') . '</a>'; ?></td>

</tr>

</table></td>

</tr>

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent" width="75"> <?php echo TABLE_HEADING_PRODUCT_ID;?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT_MODEL;?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT_IMAGE;?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_CROSS_SELL_THIS;?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT_NAME;?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT_PRICE;?> </td>

</tr>

<?php

if (isset($HTTP_GET_VARS['search'])) {

$search = tep_db_prepare_input($HTTP_GET_VARS['search']);

$products_query_raw = 'select p.products_id, p.products_image, p.products_model, p.products_price, pd.products_name from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" and pd.products_name like "%' . tep_db_input($search) . '%" order by pd.products_name asc';}else{$products_query_raw = 'select p.products_id, p.products_image, p.products_model, pd.products_name, p.products_price from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by pd.products_name asc';}

$products_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);

$products_query = tep_db_query($products_query_raw);

while ($products = tep_db_fetch_array($products_query)) {

$xsold_query = tep_db_query('select * from '.TABLE_PRODUCTS_XSELL.' where products_id = "'.$_GET['add_related_product_ID'].'" and xsell_id = "'.$products['products_id'].'"');

$xsold_query_reciprocal = tep_db_query('select * from '.TABLE_PRODUCTS_XSELL.' where products_id = "'.$products['products_id'].'" and xsell_id = "'.$_GET['add_related_product_ID'].'"');

?>

<tr bgcolor='#FFFFFF'>

<td class="dataTableContent" align="center"> <?php echo $products['products_id'];?> </td>

<?php

if ($products['products_model'] == NULL) {

$products_model = TEXT_NONE;

} else {

$products_model = $products['products_model'];

}

?>

<td class="dataTableContent" align="center"> <?php echo $products_model;?> </td>

<td class="dataTableContent" align="center"> <?php echo tep_not_null($products['products_image']) ? tep_image(DIR_WS_CATALOG_IMAGES . '/' . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) : TEXT_NONE; ?> </td>

<td class="dataTableContent"> <?php echo tep_draw_hidden_field('product[]', $products['products_id']) . tep_draw_checkbox_field('cross[]', $products['products_id'], ((tep_db_num_rows($xsold_query) > 0) ? true : false), '', ' onmouseover="this.style.cursor=\'hand\'"');?> <label onmouseover="this.style.cursor='hand'"><?php echo TEXT_CROSS_SELL;?><br> <?php echo tep_draw_hidden_field('product[]', $products['products_id']) . tep_draw_checkbox_field('reciprocal_link_cross[]', $products['products_id'], ((tep_db_num_rows($xsold_query_reciprocal) > 0) ? true : false), '', ' onmouseover="this.style.cursor=\'hand\'"');?> <label onmouseover="this.style.cursor='hand'"><?php echo TEXT_RECIPROCAL_LINK;?></label> </td>

<td class="dataTableContent"> <?php echo $products['products_name'];?> </td>

<td class="dataTableContent"> <?php echo $currencies->format($products['products_price']);?> </td>

</tr>

<?php

}

?>

</table></form></td>

</tr>

<tr>

<td colspan="6"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="infoBoxContent">

<tr>

<td class="smallText" valign="top"><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td>

<td class="smallText" align="right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID', 'action'))); ?></td>

</tr>

</table></td>

</tr>

</table>

<?php

}elseif($HTTP_GET_VARS['add_related_product_ID'] != '' && $HTTP_GET_VARS['sort'] != ''){

$products_name_query = tep_db_query('select pd.products_name, p.products_model, p.products_image, p.products_price from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd where p.products_id = "'.$HTTP_GET_VARS['add_related_product_ID'].'" and p.products_id = pd.products_id and pd.language_id ="'.(int)$languages_id.'"');

$products_name = tep_db_fetch_array($products_name_query);

?>

<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">

<tr>

<td><?php echo tep_draw_form('update_sort', FILENAME_XSELL_PRODUCTS, tep_get_all_get_params(array('action')) . 'action=update_sort', 'post');?>

<table cellpadding="1" cellspacing="1" border="0">

<tr>

<td colspan="6"><table cellpadding="3" cellspacing="0" border="0" width="100%">

<tr class="dataTableHeadingRow">

<td valign="middle" align="left"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . '/'.$products_name['products_image'], "", SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);?></td>

<?php

if ($products_name['products_model'] == NULL) {

$products_model = TEXT_NONE;

} else {

$products_model = $products_name['products_model'];

}

?>

<td valign="middle" align="left"><span class="main"><?php echo TEXT_SETTING_SELLS.$products_name['products_name'].' ('.TEXT_MODEL.': '.$products_model.') ('.TEXT_PRODUCT_ID.': '.$_GET['add_related_product_ID'].')';?></span></td>

<td valign="middle" align="center"><?php echo tep_image_submit('button_update.gif')?></td>

<td valign="middle" align="center"><?php echo '<a href="'.tep_href_link(FILENAME_XSELL_PRODUCTS, 'men_id=catalog').'">' . tep_image_button('button_cancel.gif') . '</a>'; ?></td>

</tr>

</table></td>

</tr>

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT_ID;?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT_MODEL;?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT_IMAGE;?> </td>

<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_PRODUCT_NAME;?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT_PRICE;?> </td>

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT_SORT;?> </td>

</tr>

<?php

$products_query_raw = 'select p.products_id as products_id, p.products_price, p.products_image, p.products_model, pd.products_name, x.products_id as xproducts_id, x.xsell_id, x.sort_order, x.ID from '.TABLE_PRODUCTS.' p, '.TABLE_PRODUCTS_DESCRIPTION.' pd, '.TABLE_PRODUCTS_XSELL.' x where x.xsell_id = p.products_id and x.products_id = "'.$HTTP_GET_VARS['add_related_product_ID'].'" and p.products_id = pd.products_id and pd.language_id = "'.(int)$languages_id.'" order by x.sort_order asc';

$products_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);

$sort_order_drop_array = array();

for($i=1;$i<=$products_query_numrows;$i++){

$sort_order_drop_array[] = array('id' => $i, 'text' => $i);

}

$products_query = tep_db_query($products_query_raw);

while ($products = tep_db_fetch_array($products_query)){

?>

<tr bgcolor='#DFE4F4'>

<td class="dataTableContent" align="center"> <?php echo $products['products_id'];?> </td>

<?php

if ($products['products_model'] == NULL) {

$products_model = TEXT_NONE;

} else {

$products_model = $products['products_model'];

}

?>

<td class="dataTableContent" align="center"> <?php echo $products_model;?> </td>

<td class="dataTableContent" align="center"> <?php echo tep_not_null($products['products_image']) ? tep_image(DIR_WS_CATALOG_IMAGES . '/' . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) : TEXT_NONE; ?> </td>

<td class="dataTableContent" align="center"> <?php echo $products['products_name'];?> </td>

<td class="dataTableContent" align="center"> <?php echo $currencies->format($products['products_price']);?> </td>

<td class="dataTableContent" align="center"> <?php echo tep_draw_pull_down_menu($products['products_id'], $sort_order_drop_array, $products['sort_order']);?> </td>

</tr>

<?php

}

?>

</table></form></td>

</tr>

<tr>

<td colspan="7">

<table border="0" width="100%" cellspacing="0" cellpadding="2" class="infoBoxContent">

<tr>

<td class="smallText" valign="top"><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID', 'action'))); ?></td>

</tr>

</table>

</td>

</tr>

</table>

<?php

}

?>

<!-- body_text_eof //-->

</td>

</tr>

</table>

<!-- body_eof //-->

 

<br>

</body>

</html>

<?php

require(DIR_WS_INCLUDES . 'template_bottom.php');

require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

@@osc777 Are you self-hosted, VPS, or web hosted? I ask because there is a bit of code I think you should try before you start to do anything. No one told me this exactly when I started, and this may help you tremendously

Link to comment
Share on other sites

Well, if you are self hosted Linux some VPS, first thing you want us to send the whole catalog file to a tar backup file. You can delete later if space is an issue, but being able to revert to a working copy is awesome. Best advice i received (late)

Link to comment
Share on other sites

@@Snoopy10

Still having issues. Something is up with the cache

Cache is writeable because the rest of the site works.

http://mtrosemedia.tk/store/

I have commented out

<?php
   // BOF Reviews at Product Page
   include(DIR_WS_MODULES . FILENAME_REVIEWS_FRONT);
   // EOF Reviews at Product Page
//added for cross -sell
   if ((USE_CACHE == 'true') && empty($SID)) {
//	  echo tep_cache_xsell_products(3600); //added for Xsell
  echo tep_cache_also_purchased(3600);
   } else {
  include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); //added for Xsell
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
?>

Link to comment
Share on other sites

Finally found an error

Apr 10 09:47:38 mtrose httpd: PHP Fatal error: Call to a member function store() on a non-object in /**************/includes/modules/ultimate_seo_urls5/main/usu5.php on line 78
Apr 10 10:02:10 mtrose httpd: PHP Fatal error: Cannot redeclare usu5_base_filename() (previously declared in /**************/includes/application_top.php:58) in /**********/includes/application_top.php on line 78

Edited by newburns
Link to comment
Share on other sites

  • 7 months later...

Does anyone know if this mod works with 2.3.3.4 ?

 

Yes it is but there are changes needed - have a look at page 2 of my post here: http://www.oscommerce.com/forums/topic/395359-modding-up-a-new-2334-install-documented/

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Thanks for the reply!

 

I took a look at it (the contrib) and then started an install but I'm getting that sinking feeling....

The docs for the mod list at least 3 files that don't exist;

 

Step 5B: mobile_product_info

Step 7: also_purchased_mobile

Step 7: xsell_mobile

 

Don't know what to do there but given the scope of the missing files/mods that need to be done I'm pretty sure it won't work.

 

So far those errors/omissions seem to be related to 'mobile' files. My guess is that the osc version this mod was written for had mobile-specific files and that this has been deprecated in 2.3.3.4?

Edited by Marvin Miller

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

@@Marvin Miller

 

Just ignore the references in the latest version to the mobile files - they are for users who have the mobile addon installed -just follow the install instructions with the changes in my thread as linked above.

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Excellent - I'll go back to that in two seconds (well...maybe not that fast). Quick off-topic question if you have a minute. I have 2.3.3.4 installed and emails aren't getting through. I changed over to SMTP but there seems to be no method to specify what server to use. In broad strokes - what am I missing here? We have our own mail server which would be ideal to use.

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

@@Marvin Miller Sorry - cant help with the email issue - search the forum for smtp mail threads

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

@@Marvin Miller

 

Just ignore the references in the latest version to the mobile files - they are for users who have the mobile addon installed -just follow the install instructions with the changes in my thread as linked above.

 

Strange, it doesn't seem to work at all. I took my time on it, went through it methodically, the site continues to work and the admin has a section for cross-selling. I enabled a cross-sell for an item and then checked the store but I don't see any recommended products or any notification for them.

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

It does work on 2.3.3.4 I will pm you with a link to my development store so you can see what it does.

 

Did you run the sql command? did you set up the cross sell item correctly?

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Yes, I ran the MySQL script and created the tables. I also set up some cross-sells but started seeing really weird behavior. The prices on the cross sells were off - sometimes they showed up, sometimes they didn't.

 

I think the conclusion is that I'm just going to have to wait until someone updates the mod for 2.3.3.4 and then it can be more properly fleshed out. Thanks for trying though - it is appreciated!

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

  • 3 months later...

Just wondered if there was a way for it to select random products to show in the "we also recommend" box? I have over 4000 products so it would take weeks to go through and do it

Link to comment
Share on other sites

It would seem to me to defeat the purpose of the addon to randomly display an item which was a cross sell / related item where is the logic?

Edited by joli1811
To improve is to change; to be perfect is to change often.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...