Jump to content
dreamscape

[Contribution] Cross Sell (X-Sell) Admin

Recommended Posts

Can you paste the contents of your catalog/includes/modules/xsell_products.php?

 

The button is not correctly adding the product number


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.

Share this post


Link to post
Share on other sites
<?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 (c) 2002 osCommerce
Released under the GNU General Public License
*/
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_XSELL_PRODUCTS);
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, 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);
?>
<!-- xsell_products_eof //-->
<?php
  }
}
?>

Share this post


Link to post
Share on other sites

Ok that is identical to mine.

 

Can you confirm that ALL the changes have been carried out in catalog/includes/application_top.php?


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.

Share this post


Link to post
Share on other sites

I think it's good.

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2008 osCommerce
 Released under the GNU General Public License
*/
// start the timer for the page parse time log
 define('PAGE_PARSE_START_TIME', microtime());
// set the level of error reporting
 error_reporting(E_ALL & ~E_NOTICE);
// check support for register_globals
 if (function_exists('ini_get') && (ini_get('register_globals') == false) && (PHP_VERSION < 4.3) ) {
   exit('Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory. Please use PHP 4.3+ if register_globals cannot be enabled on the server.');
 }
// load server configuration parameters
 if (file_exists('includes/local/configure.php')) { // for developers
   include('includes/local/configure.php');
 } else {
   include('includes/configure.php');
 }
 if (strlen(DB_SERVER) < 1) {
   if (is_dir('install')) {
  header('Location: install/index.php');
   }
 }
// define the project version --- obsolete, now retrieved with tep_get_version()
 define('PROJECT_VERSION', 'osCommerce Online Merchant v2.3');
// some code to solve compatibility issues
 require(DIR_WS_FUNCTIONS . 'compatibility.php');
// set the type of request (secure or not)
 $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';
// set php_self in the local scope
 $PHP_SELF = (((strlen(ini_get('cgi.fix_pathinfo')) > 0) && ((bool)ini_get('cgi.fix_pathinfo') == false)) || !isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) ? basename($HTTP_SERVER_VARS['PHP_SELF']) : basename($HTTP_SERVER_VARS['SCRIPT_NAME']);
 if ($request_type == 'NONSSL') {
   define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
 } else {
   define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
 }
// include the list of project filenames
 require(DIR_WS_INCLUDES . 'filenames.php');
// include the list of project database tables
 require(DIR_WS_INCLUDES . 'database_tables.php');
// include the database functions
 require(DIR_WS_FUNCTIONS . 'database.php');
// make a connection to the database... now
 tep_db_connect() or die('Unable to connect to database server!');
// set the application parameters
 $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
 while ($configuration = tep_db_fetch_array($configuration_query)) {
   define($configuration['cfgKey'], $configuration['cfgValue']);
 }
// if gzip_compression is enabled, start to buffer the output
 if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) {
   if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
  if (PHP_VERSION >= '4.0.4') {
    ob_start('ob_gzhandler');
  } else {
    include(DIR_WS_FUNCTIONS . 'gzip_compression.php');
    ob_start();
    ob_implicit_flush();
  }
   } else {
  ini_set('zlib.output_compression_level', GZIP_LEVEL);
   }
 }
// set the HTTP GET parameters manually if search_engine_friendly_urls is enabled
 if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
   if (strlen(getenv('PATH_INFO')) > 1) {
  $GET_array = array();
  $PHP_SELF = str_replace(getenv('PATH_INFO'), '', $PHP_SELF);
  $vars = explode('/', substr(getenv('PATH_INFO'), 1));
  do_magic_quotes_gpc($vars);
  for ($i=0, $n=sizeof($vars); $i<$n; $i++) {
    if (strpos($vars[$i], '[]')) {
	  $GET_array[substr($vars[$i], 0, -2)][] = $vars[$i+1];
    } else {
	  $HTTP_GET_VARS[$vars[$i]] = $vars[$i+1];
    }
    $i++;
  }
  if (sizeof($GET_array) > 0) {
    while (list($key, $value) = each($GET_array)) {
	  $HTTP_GET_VARS[$key] = $value;
    }
  }
   }
 }
// define general functions used application-wide
 require(DIR_WS_FUNCTIONS . 'general.php');
 require(DIR_WS_FUNCTIONS . 'html_output.php');
// set the cookie domain
 $cookie_domain = (($request_type == 'NONSSL') ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN);
 $cookie_path = (($request_type == 'NONSSL') ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH);
// include cache functions if enabled
 if (USE_CACHE == 'true') include(DIR_WS_FUNCTIONS . 'cache.php');
// include shopping cart class
 require(DIR_WS_CLASSES . 'shopping_cart.php');
// include navigation history class
 require(DIR_WS_CLASSES . 'navigation_history.php');
// define how the session functions will be used
 require(DIR_WS_FUNCTIONS . 'sessions.php');
// set the session name and save path
 tep_session_name('osCsid');
 tep_session_save_path(SESSION_WRITE_DIRECTORY);
// set the session cookie parameters
  if (function_exists('session_set_cookie_params')) {
   session_set_cookie_params(0, $cookie_path, $cookie_domain);
 } elseif (function_exists('ini_set')) {
   ini_set('session.cookie_lifetime', '0');
   ini_set('session.cookie_path', $cookie_path);
   ini_set('session.cookie_domain', $cookie_domain);
 }
 @ini_set('session.use_only_cookies', (SESSION_FORCE_COOKIE_USE == 'True') ? 1 : 0);
// set the session ID if it exists
  if (isset($HTTP_POST_VARS[tep_session_name()])) {
 tep_session_id($HTTP_POST_VARS[tep_session_name()]);
  } elseif ( ($request_type == 'SSL') && isset($HTTP_GET_VARS[tep_session_name()]) ) {
 tep_session_id($HTTP_GET_VARS[tep_session_name()]);
  }
// start the session
 $session_started = false;
 if (SESSION_FORCE_COOKIE_USE == 'True') {
   tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);
   if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
  tep_session_start();
  $session_started = true;
   }
 } elseif (SESSION_BLOCK_SPIDERS == 'True') {
   $user_agent = strtolower(getenv('HTTP_USER_AGENT'));
   $spider_flag = false;
   if (tep_not_null($user_agent)) {
  $spiders = file(DIR_WS_INCLUDES . 'spiders.txt');
  for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {
    if (tep_not_null($spiders[$i])) {
	  if (is_integer(strpos($user_agent, trim($spiders[$i])))) {
	    $spider_flag = true;
	    break;
	  }
    }
  }
   }
   if ($spider_flag == false) {
  tep_session_start();
  $session_started = true;
   }
 } else {
   tep_session_start();
   $session_started = true;
 }
 if ( ($session_started == true) && (PHP_VERSION >= 4.3) && function_exists('ini_get') && (ini_get('register_globals') == false) ) {
   extract($_SESSION, EXTR_OVERWRITE+EXTR_REFS);
 }
// initialize a session token
 if (!tep_session_is_registered('sessiontoken')) {
   $sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
   tep_session_register('sessiontoken');
 }
// set SID once, even if empty
 $SID = (defined('SID') ? SID : '');
// verify the ssl_session_id if the feature is enabled
 if ( ($request_type == 'SSL') && (SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($session_started == true) ) {
   $ssl_session_id = getenv('SSL_SESSION_ID');
   if (!tep_session_is_registered('SSL_SESSION_ID')) {
  $SESSION_SSL_ID = $ssl_session_id;
  tep_session_register('SESSION_SSL_ID');
   }
   if ($SESSION_SSL_ID != $ssl_session_id) {
  tep_session_destroy();
  tep_redirect(tep_href_link(FILENAME_SSL_CHECK));
   }
 }
// verify the browser user agent if the feature is enabled
 if (SESSION_CHECK_USER_AGENT == 'True') {
   $http_user_agent = getenv('HTTP_USER_AGENT');
   if (!tep_session_is_registered('SESSION_USER_AGENT')) {
  $SESSION_USER_AGENT = $http_user_agent;
  tep_session_register('SESSION_USER_AGENT');
   }
   if ($SESSION_USER_AGENT != $http_user_agent) {
  tep_session_destroy();
  tep_redirect(tep_href_link(FILENAME_LOGIN));
   }
 }
// verify the IP address if the feature is enabled
 if (SESSION_CHECK_IP_ADDRESS == 'True') {
   $ip_address = tep_get_ip_address();
   if (!tep_session_is_registered('SESSION_IP_ADDRESS')) {
  $SESSION_IP_ADDRESS = $ip_address;
  tep_session_register('SESSION_IP_ADDRESS');
   }
   if ($SESSION_IP_ADDRESS != $ip_address) {
  tep_session_destroy();
  tep_redirect(tep_href_link(FILENAME_LOGIN));
   }
 }
// create the shopping cart
 if (!tep_session_is_registered('cart') || !is_object($cart)) {
   tep_session_register('cart');
   $cart = new shoppingCart;
 }
// include currencies class and create an instance
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();
// include the mail classes
 require(DIR_WS_CLASSES . 'mime.php');
 require(DIR_WS_CLASSES . 'email.php');
// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
   if (!tep_session_is_registered('language')) {
  tep_session_register('language');
  tep_session_register('languages_id');
   }
   include(DIR_WS_CLASSES . 'language.php');
   $lng = new language();
   if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
  $lng->set_language($HTTP_GET_VARS['language']);
   } else {
  $lng->get_browser_language();
   }
   $language = $lng->language['directory'];
   $languages_id = $lng->language['id'];
 }
// include the language translations
 require(DIR_WS_LANGUAGES . $language . '.php');
// currency
 if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {
   if (!tep_session_is_registered('currency')) tep_session_register('currency');
   if (isset($HTTP_GET_VARS['currency']) && $currencies->is_set($HTTP_GET_VARS['currency'])) {
  $currency = $HTTP_GET_VARS['currency'];
   } else {
  $currency = ((USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && $currencies->is_set(LANGUAGE_CURRENCY)) ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
   }
 }
// navigation history
 if (!tep_session_is_registered('navigation') || !is_object($navigation)) {
   tep_session_register('navigation');
   $navigation = new navigationHistory;
 }
 $navigation->add_current_page();
// action recorder
 include('includes/classes/action_recorder.php');
// Shopping cart actions
 if (isset($HTTP_GET_VARS['action'])) {
// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
   if ($session_started == false) {
  tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
   }
   if (DISPLAY_CART == 'true') {
  $goto =  FILENAME_SHOPPING_CART;
  $parameters = array('action', 'cPath', 'products_id', 'pid');
   } else {
  $goto = basename($PHP_SELF);
 if ($HTTP_GET_VARS['action'] == 'buy_now') {
// BOE: XSell
    if (isset($HTTP_GET_VARS['product_to_buy_id'])) {
	  $parameters = array('action', 'pid', 'products_to_buy_id');
 } else {
	  $parameters = array('action', 'pid', 'products_id');
 }
// EOE: XSell
  } else {
    $parameters = array('action', 'pid');
  }
   }
   switch ($HTTP_GET_VARS['action']) {
  // customer wants to update the product quantity in their shopping cart
  case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {
						    if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
							  $cart->remove($HTTP_POST_VARS['products_id'][$i]);
						    } else {
							  $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
							  $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
						    }
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // customer adds a product from the products page
  case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
						    $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : '';
						    $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes);
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // customer removes a product from their shopping cart
  case 'remove_product' : if (isset($HTTP_GET_VARS['products_id'])) {
						    $cart->remove($HTTP_GET_VARS['products_id']);
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // performed by the 'buy now' button in product listings and review page
// BOF: XSell
  case 'buy_now' :	    if (isset($HTTP_GET_VARS['product_to_buy_id'])) {
    if (tep_has_product_attributes($HTTP_GET_VARS['product_to_buy_id'])) {
	  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['product_to_buy_id']));
    } else {
	  $cart->add_cart($HTTP_GET_VARS['product_to_buy_id'], $cart->get_quantity($HTTP_GET_VARS['product_to_buy_id'])+1);
    }
						  } elseif (isset($HTTP_GET_VARS['products_id'])) {
// EOF: XSell
						    if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
						    } else {
							  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
						    }
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  case 'notify' :		 if (tep_session_is_registered('customer_id')) {
						    if (isset($HTTP_GET_VARS['products_id'])) {
							  $notify = $HTTP_GET_VARS['products_id'];
						    } elseif (isset($HTTP_GET_VARS['notify'])) {
							  $notify = $HTTP_GET_VARS['notify'];
						    } elseif (isset($HTTP_POST_VARS['notify'])) {
							  $notify = $HTTP_POST_VARS['notify'];
						    } else {
							  tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
						    }
						    if (!is_array($notify)) $notify = array($notify);
						    for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
							  $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");
							  $check = tep_db_fetch_array($check_query);
							  if ($check['count'] < 1) {
							    tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");
							  }
						    }
						    tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
						  } else {
						    $navigation->set_snapshot();
						    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
						  }
						  break;
  case 'notify_remove' :  if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {
						    $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
						    $check = tep_db_fetch_array($check_query);
						    if ($check['count'] > 0) {
							  tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
						    }
						    tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));
						  } else {
						    $navigation->set_snapshot();
						    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
						  }
						  break;
  case 'cust_order' :	 if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
						    if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
						    } else {
							  $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
						    }
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
   }
 }
// include the who's online functions
 require(DIR_WS_FUNCTIONS . 'whos_online.php');
 tep_update_whos_online();
// include the password crypto functions
 require(DIR_WS_FUNCTIONS . 'password_funcs.php');
// include validation functions (right now only email address)
 require(DIR_WS_FUNCTIONS . 'validations.php');
// split-page-results
 require(DIR_WS_CLASSES . 'split_page_results.php');
// infobox
 require(DIR_WS_CLASSES . 'boxes.php');
// auto activate and expire banners
 require(DIR_WS_FUNCTIONS . 'banner.php');
 tep_activate_banners();
 tep_expire_banners();
// auto expire special products
 require(DIR_WS_FUNCTIONS . 'specials.php');
 tep_expire_specials();

// BOF: Featured Products
 require(DIR_WS_FUNCTIONS . 'featured.php');
 tep_expire_featured();
 require(DIR_WS_CLASSES . 'osc_template.php');
 $oscTemplate = new oscTemplate();
// calculate category path
 if (isset($HTTP_GET_VARS['cPath'])) {
   $cPath = $HTTP_GET_VARS['cPath'];
 } elseif (isset($HTTP_GET_VARS['products_id']) && !isset($HTTP_GET_VARS['manufacturers_id'])) {
   $cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);
 } else {
   $cPath = '';
 }
 if (tep_not_null($cPath)) {
   $cPath_array = tep_parse_category_path($cPath);
   $cPath = implode('_', $cPath_array);
   $current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
 } else {
   $current_category_id = 0;
 }
// include the breadcrumb class and start the breadcrumb trail
 require(DIR_WS_CLASSES . 'breadcrumb.php');
 $breadcrumb = new breadcrumb;
 $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
 $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));
// add category names or the manufacturer name to the breadcrumb trail
 if (isset($cPath_array)) {
   for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {
  $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");
  if (tep_db_num_rows($categories_query) > 0) {
    $categories = tep_db_fetch_array($categories_query);
    $breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));
  } else {
    break;
  }
   }
 } elseif (isset($HTTP_GET_VARS['manufacturers_id'])) {
   $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
   if (tep_db_num_rows($manufacturers_query)) {
  $manufacturers = tep_db_fetch_array($manufacturers_query);
  $breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));
   }
 }
// add the products model to the breadcrumb trail
 if (isset($HTTP_GET_VARS['products_id'])) {
   $model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   if (tep_db_num_rows($model_query)) {
  $model = tep_db_fetch_array($model_query);
  $breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
   }
 }
// initialize the message stack for output messages
 require(DIR_WS_CLASSES . 'message_stack.php');
 $messageStack = new messageStack;

 $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");
 $category = tep_db_fetch_array($category_query);
 $categories_desc_query = tep_db_query("select categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[count($cPath_array)-1] . "' and language_id = '" . (int)$languages_id . "'");
 $categories_desc = tep_db_fetch_array($categories_desc_query);
?>

Share this post


Link to post
Share on other sites

OK I found a difference -

 

You have:

//BOF F: XSell
	  case 'buy_now' :		  if (isset($HTTP_GET_VARS['product_to_buy_id'])) {
	    if (tep_has_product_attributes($HTTP_GET_VARS['product_to_buy_id'])) {
			  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['product_to_buy_id']));
	    } else {
			  $cart->add_cart($HTTP_GET_VARS['product_to_buy_id'], $cart->get_quantity($HTTP_GET_VARS['product_to_buy_id'])+1);
	    }
													  } elseif (isset($HTTP_GET_VARS['products_id'])) {
// EOF: XSell
													    if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
															  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
													    } else {
															  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
													    }
													  }
													  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

 

I have:

 

// BOF: XSell
  case 'buy_now' :		 if (isset($HTTP_GET_VARS['products_id'])) {							  
															  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));							   
													  }
													  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
													  break;
// EOF: XSell
							 if (isset($HTTP_GET_VARS['products_id'])) {							  
															  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));							   
													  }
													  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
													  break;


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.

Share this post


Link to post
Share on other sites

It works great!

I supose you going to update your contribution.

 

 

Thank you very much and congratulations again! ;)

Share this post


Link to post
Share on other sites

Im Pleased it's now working for you


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.

Share this post


Link to post
Share on other sites

Hello, I just installed the Cross Sell (http://addons.oscommerce.com/info/8330 - is what i used) add-on in my store and I can't get it to show up - I see the new module in my admin area, I am able to link up products and everything seems to work fine from the admin side of my site, however, product listing pages are excatly the same and no products are suggested -after combing through this thread, i changed the code on product_info and now have a "customers also bought" section popping up on some of the product pages, but still not cross sell... and the pictures are also gigantic and a mess.. Any ideas on what might be the problem? I have no coding/php experience and was thrown into this project at work, so it's been a real steep learning curve. :o Any help is greatly appreciated. I"m suspecting it might something in my product_info.php file, so i'm posting that code - but this is just a stab in the dark. :unsure:

 

product_info.php:

<?php
/*
 $Id$
 adapted for Separate Pricing Per Customer v4.2 2007/06/23[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  Copyright (c) 2010 osCommerce[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  Released under the GNU General Public License
*/[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  require('includes/application_top.php');[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);
// BOF Separate Pricing per Customer
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
$customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
$customer_group_id = '0';
 }
// EOF Separate Pricing per Customer[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  require(DIR_WS_INCLUDES . 'template_top.php');[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  if ($product_check['total'] < 1) {
?>
<style type="text/css">
@[member='import'] url("SpryAssets/SpryCollapsiblePanel.css");
</style>
<div id="breadcrumb"><?php echo '' . $breadcrumb->trail('  »  '); ?></div>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]<div class="contentContainer">
 <div class="contentText">
<?php echo TEXT_PRODUCT_NOT_FOUND; ?>
 </div>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]  <div style="float: right;">
<?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
 </div>
</div>[/font][/color]

[color=#282828][font=helvetica, arial, sans-serif]<?php
 } else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]	tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]	if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
// BOF Separate Pricing per Customer
  if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail
	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
	if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
	  $product_info['products_price']= $scustomer_group_price['customers_group_price'];
   }
  } // end if ($customer_group_id > 0)
// EOF Separate Pricing per Customer
  $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
// BOF Separate Pricing per Customer
  if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail
	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
	if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
 $product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
  } // end if ($customer_group_id > 0)
// EOF Separate Pricing per Customer
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]	if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<h3>#' . $product_info['products_model'] . '</h3>';
} else {
  $products_name = $product_info['products_name'];
}
?>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>[/font][/color]

[color=#282828][font=helvetica, arial, sans-serif]<div id="breadcrumb"><?php echo '' . $breadcrumb->trail('  »  '); ?></div>
<div class="contentContainer" style="background:rgba(255,255,255,0.6);">

<div>
<?php
if (tep_not_null($product_info['products_image'])) {
  $pi_query = tep_db_query("select image, htmlcontent from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int)$product_info['products_id'] . "' order by sort_order");[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]	  if (tep_db_num_rows($pi_query) > 0) {
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/JavaScript" src="http://clairepettibone.com/lib/js/cloud-zoom.1.0.2.js"></script>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]<div id="adIMG">
<?php
	$pi_counter = 0;
	while ($pi = tep_db_fetch_array($pi_query)) {
	  $pi_counter++;[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]		  $pi_entry = '<a href="';[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]		  if (tep_not_null($pi['htmlcontent'])) {
		$pi_entry .= '#piGalimg_' . $pi_counter;
	  } else {
		$pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image']);
	  }[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]		  $pi_entry .= '" class="cloud-zoom-gallery" rel="useZoom:\'zoom1\', smallImage:\'' . tep_href_link(DIR_WS_IMAGES . $pi['image']) . ' \'">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>';[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]		  if (tep_not_null($pi['htmlcontent'])) {
		$pi_entry .= '<div style="display: none;"><div id="piGalimg_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div></div>';
	  }[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]		  $pi_entry .= '';[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]		  echo $pi_entry;
	}
?>
</div>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]<?php echo '<div id="prodIMG"><a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" class ="cloud-zoom" id="zoom1" rel="adjustX: 5,adjustY: -1, softFocus:false">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name'])) . '</a></div>'; ?>[/font][/color]

[color=#282828][font=helvetica, arial, sans-serif]<?php
  } else {
?>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]<div id="prodIMG">
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" class ="cloud-zoom" id="zoom1" rel="adjustX: 5,adjustY: -1, softFocus:false">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name'])) . '</a>'; ?>
</div>

<?php
  }
?>[/font][/color]

[color=#282828][font=helvetica, arial, sans-serif]<?php
}
?>
<div id="description">
<?php[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]   if ($product_check['total'] >= 1) {[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]	  include (DIR_WS_INCLUDES . 'products_next_previous.php');[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]   }[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]   ?>
<h1 style="padding-top:45px"><?php echo $products_name; ?></h1>
<p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php echo $products_price; ?>
<br />
<br />
<i>* Please take a moment to <strong><a href="http://clairepettibone.com/heirloom/shop/account_edit.php" style="color: #C99">confirm</a></strong> the measurements listed in your account are accurate to insure proper fit <i><p class="smalltext"><i>* All Heirloom products are made to order. Please allow 2-4 weeks to ship</i>.</p>
<table width="250" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#fff">
 <tbody>
<tr bgcolor="#efefef">
  <td width="20%" bgcolor="#FAF3E6" style="text-align: center">XS</td>
  <td width="20%" bgcolor="#FAF3E6" style="text-align: center">S</td>
  <td width="20%" bgcolor="#FAF3E6" style="text-align: center">M</td>
  <td width="20%" bgcolor="#FAF3E6" style="text-align: center">L</td>
  <td width="20%" bgcolor="#FAF3E6" style="text-align: center">XL</td>
</tr>
<tr bgcolor="#f5e9f2, opacity .6">
  <td bgcolor="#E8DFD0" style="text-align: center">2-4</td>
  <td bgcolor="#E8DFD0" style="text-align: center">4-6</td>
  <td bgcolor="#E8DFD0" style="text-align: center">6-8</td>
  <td bgcolor="#E8DFD0" style="text-align: center">8-10</td>
  <td bgcolor="#E8DFD0" style="text-align: center">10-12</td>
</tr>
 </tbody>
</table>
<?php
// BOF SPPC Hide attributes from customer groups
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
?>[/font][/color]

[color=#282828][font=helvetica, arial, sans-serif]	<p>
<?php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
	$products_options_array = array();
	$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
$list_of_prdcts_attributes_id = '';
$products_options = array(); // makes sure this array is empty again
	while ($_products_options = tep_db_fetch_array($products_options_query)) {
 $products_options[] = $_products_options;
 $list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
}[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]	if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') {
  $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
  $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
  while ($pag_array = tep_db_fetch_array($pag_query)) {
   $cg_attr_prices[] = $pag_array;
  }

  // substitute options_values_price and prefix for those for the customer group (if available)
  if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
   for ($n = 0 ; $n < count($products_options); $n++) {
	for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
	 if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
	  $products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
	  $products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
	 }
	} // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
   }
  } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
 } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]	 for ($n = 0 ; $n < count($products_options); $n++) {
  $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);
  if ($products_options[$n]['options_values_price'] != '0') {
   $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
  }
 }
// EOF SPPC attributes mod[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]		if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
	} else {
	  $selected_attribute = false;
	}
?>
  <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong> <?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?>
<?php
  }
?></p>
<?php
}
?>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]	 <?php
//added for cross -sell
  if ( (USE_CACHE == 'true') && !SID) {
echo tep_cache_also_purchased(3600);
include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);
} else {
include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS);
include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
}
?>


 <div class="buttonSet">
  <span class="buttonAction left"> <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'triangle-1-e', null, 'primary'); ?>
</span>

 </div>[/font][/color]

[color=#282828][font=helvetica, arial, sans-serif]</div>[/font][/color]

[color=#282828][font=helvetica, arial, sans-serif]<div class="clear"></div>
</div>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]</div>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]</form>
</td>
<td valign="top" width="180">[/font][/color]

[color=#282828][font=helvetica, arial, sans-serif]<p>
 <?php

 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
</p>
<p>.</p>[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]

Share this post


Link to post
Share on other sites

So it seems that it's calling up the also_purchased.php module, but not the xsell_products.... i've checked that xsell_products is up on the server... any ideaa? Also, assuming i can get this to work, how would i go about making changes to the layout of the suggested products?

Share this post


Link to post
Share on other sites

Hi

 

I have OSCommerce 2.3.1 on my website using mySQL 5.0.95 and PHPmyadmin 3.4.9

 

I am trying to create the table using products_xsell.sql. Nothing happens, but I get the following:

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Cross Sell', 'MAX_DISPLAY_XSELL', '6', 'Maximum number of products to display in the \'Cross Sell\' box', '3', '16', now());[color=#ff0000]# 1 row affected.[/color]

DROP TABLE IF EXISTS products_xsell;# MySQL returned an empty result set (i.e. zero rows).
CREATE TABLE products_xsell (
 ID int(10) NOT NULL auto_increment,
 products_id int(10) unsigned NOT NULL default '1',
 xsell_id int(10) unsigned NOT NULL default '1',
 sort_order int(10) unsigned NOT NULL default '1',
 PRIMARY KEY  (ID)
) TYPE=MyISAM;[color=#ff0000]# MySQL returned an empty result set (i.e. zero rows).[/color]

alter table products_xsell add index idx_products_id (products_id);[color=#ff0000]# MySQL returned an empty result set (i.e. zero rows).[/color]
alter table products_xsell add index idx_xsell_id (xsell_id);[color=#ff0000]# MySQL returned an empty result set (i.e. zero rows).[/color]

 

Please help.

Edited by dvharrison

Debbie Harrison

 

Share this post


Link to post
Share on other sites

How are you trying to run the sql?

Edited by Mort-lemur

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.

Share this post


Link to post
Share on other sites

I was just copying and pasting in the Sql tab in phpmyadmin but I have just imported the database and that seems to work. However, I have just gone through all the changes religiously and the product_info.php page does not display at all and on clicking the cross-sell link on the catalog box, I get a 404 page where its trying to look for www.mydomain.com/myadmin/filename_xsell_products?oscadminid=etc

 

and such a filename doesn't exist anyway.

 

Please advise.

Edited by dvharrison

Debbie Harrison

 

Share this post


Link to post
Share on other sites

@@dvharrison

 

Make sure you carried out the changes to filenames.php in both admin and catalog


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.

Share this post


Link to post
Share on other sites

@@Mort-lemur

 

Actually on the product info adjustment, you have one to many '}' listed. So it should be

 

<?php
//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);
}

?>

 

I have taken this out and the page at least shows. I haven't a clue if the rest works as I'm still going through it.

 

Hope this helps.

Edited by dvharrison

Debbie Harrison

 

Share this post


Link to post
Share on other sites

Any way I try to run the SQL I get this error:

 

Error
SQL query:
CREATE TABLE products_xsell(
ID INT( 10 ) NOT NULL AUTO_INCREMENT ,
products_id INT( 10 ) UNSIGNED NOT NULL DEFAULT  '1',
xsell_id INT( 10 ) UNSIGNED NOT NULL DEFAULT  '1',
sort_order INT( 10 ) UNSIGNED NOT NULL DEFAULT  '1',
PRIMARY KEY ( ID )
) TYPE = MYISAM ;
MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 7

 

This is on the latest version of MAMP. I have copied/pasted and imported and received the same error. I don't know enough about MySQL to fix it myself. Could anyone tell my what could be wrong?

Share this post


Link to post
Share on other sites

Hi There,

 

I have installed X_Sell_For_2.3.1_V3.0 onto OSC 2.3.1 I can add the cross sell items in the admin but when I look at the product http://pbagraphics.com/product_info.php?cPath=22&products_id=34 I get an Error :"Error!

 

Unable to determine the page link!"

 

I have double checked all uploaded files as well as the updated files everything seems to be in order.

 

Does anyone have any ideas as to how I can fix it?

 

Thanks in advance

Andrew

Share this post


Link to post
Share on other sites

@@plumbrokeacres

 

Fix cache first:

includes/function/cache.php

 

Change:

// try to open file
   if ($fp = @fopen($filename, 'r')) {
// read in serialized data
  $szdata = fread($fp, filesize($filename));
  fclose($fp);
// unserialze the data
  $var = unserialize($szdata);
  $success = true;
   }

 

To:

// try to open file
   if ( file_exists($filename) ) {
  if ($fp = @fopen($filename, 'r')) {
// read in serialized data
    $szdata = fread($fp, filesize($filename));
    fclose($fp);
// unserialze the data
    $var = unserialize($szdata);
    $success = true;
  }
   }

 

 

Next step

 

Fix includes/modules/xsell_products.php

 

Change to:

<?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 (c) 2002 osCommerce
Released under the GNU General Public License
*/
// require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_XSELL_PRODUCTS);
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(FILENAME_PRODUCT_INFO, 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);
?>
<!-- xsell_products_eof //-->
<?php
 }
}
?>


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

I have been playing with the includes.modules/xsell_products.php to try to get the look the same as the new prroducts module on 2.3.1.The below code works fine, but i would like others to see if i have misssed anything.

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 $xsell_query = tep_db_query("select distinct p.products_id, p.products_image, trim(substring(pd.products_description, 1, 90)) as products_description, pd.products_name, p.products_tax_class_id, products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, 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);
 if ($xsell_query > 0) {
   $counter = 0;
   $col = 0;
   $xsell_content = '<table border="0" width="100%" cellspacing="10" cellpadding="2">';
   while ($xsell = tep_db_fetch_array($xsell_query)) {
  $counter++;
  if ($col === 0) {
    $xsell_content .= '<tr>';
  }
  $xsell_content .= '<td width="33%" align="center" valign="top"><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']) . '" class="product_name">' . $xsell['products_name'] . '</a><br /> '. strip_tags($xsell['products_description']) . '... <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']). '" class="read_more">' . LINK_READ_MORE . '</a><br /><span class="productPrice">' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</span></td>';
  $col ++;
  if (($col > 2) || ($counter == $num_xsell)) {
    $xsell_content .= '</tr>';
    $col = 0;
  }
   }
   $xsell_content .= '</table>';
?>
 <h2><?php echo (TEXT_XSELL_PRODUCTS); ?></h2>
 <div class="contentText">
   <?php echo $xsell_content; ?>
 </div>
<?php
 }
?>


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

I have been playing with the includes.modules/xsell_products.php to try to get the look the same as the new prroducts module on 2.3.1.The below code works fine, but i would like others to see if i have misssed anything.

 

 

Steve, mine differs a bit, attached.

 

I did some work with cache in the file, as well, to get the box to display like the rest of the boxes in the shop I did some tweaking at the end as so:

 

<div class="ui-widget infoBoxContainer">
   <div class="ui-widget-header ui-corner-top infoBoxHeading">
  <span><?php echo TEXT_XSELL_PRODUCTS; ?></span>
   </div>
   <?php echo $xsell_prods_content; ?>
 </div>

 

I also see my query name differs, a result of working through this back when,I can't recall why I came up with that.

 

Forgive the residual comment out lines, that's left over from when i was futzing with the code to get things cleaned up and testing.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

how do i fix tis error

 

thanks

lenard

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX_DISPLAY_XSELL' at line 7

 

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, specials_new_products_price from products_xsell xp left join products p on xp.xsell_id = p.products_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = '1' left join specials s on p.products_id = s.products_id where xp.products_id = '120035' and p.products_status = '1' order by sort_order asc limit MAX_DISPLAY_XSELL

 

[TEP STOP]

Share this post


Link to post
Share on other sites

Any way I try to run the SQL I get this error:

 

Error
SQL query:
CREATE TABLE products_xsell(
ID INT( 10 ) NOT NULL AUTO_INCREMENT ,
products_id INT( 10 ) UNSIGNED NOT NULL DEFAULT  '1',
xsell_id INT( 10 ) UNSIGNED NOT NULL DEFAULT  '1',
sort_order INT( 10 ) UNSIGNED NOT NULL DEFAULT  '1',
PRIMARY KEY ( ID )
) TYPE = MYISAM ;
MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 7

 

This is on the latest version of MAMP. I have copied/pasted and imported and received the same error. I don't know enough about MySQL to fix it myself. Could anyone tell my what could be wrong?

 

Having the same issue when running the sql query via phpmyadmin

Share this post


Link to post
Share on other sites

Try changing

 

TYPE = MYISAM

 

to

 

Engine=MyISAM

 

I had a similar problem with something but to be honest cannot remember what, but that is the change i had to make.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×