Jump to content
Johnson

Master Products - MS2

Recommended Posts

If the buy now button does not work then you have not installed properly (most likely application_top.php)

 

 

Sonia


If you want to make your dreams come true, the first thing you have to do is wake up

Share this post


Link to post
Share on other sites

this is my application_top.php under /includes

 

<?php
/*
 $Id: application_top.php,v 1.280 2003/07/12 09:38:07 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Master Products - JOHNSON - 05/07/2003 matti@suomedia.com

 Copyright (c) 2003 Suomedia - Dynamic Content Management  

 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 if register_globals is enabled.
// since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 if (function_exists('ini_get')) {
ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');
 }

// Set the local configuration parameters - mainly for developers
 if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

// include server parameters
 require('includes/configure.php');

 if (strlen(DB_SERVER) < 1) {
if (is_dir('install')) {
  header('Location: install/index.php');
}
 }

// define the project version
 define('PROJECT_VERSION', 'osCommerce 2.2-MS2');

// set the type of request (secure or not)
 $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

// set php_self in the local scope
 if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];

 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');

// customization for the design layout
 define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

// 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));
  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');

// some code to solve compatibility issues
 require(DIR_WS_FUNCTIONS . 'compatibility.php');

// check if sessions are supported, otherwise use the php3 compatible session class
 if (!function_exists('session_start')) {
define('PHP_SESSION_NAME', 'osCsid');
define('PHP_SESSION_PATH', $cookie_path);
define('PHP_SESSION_DOMAIN', $cookie_domain);
define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);

include(DIR_WS_CLASSES . 'sessions.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);
 }

// 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;
 }

// 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 & fix the cart if necesary
 if (tep_session_is_registered('cart') && is_object($cart)) {
if (PHP_VERSION < 4) {
  $broken_cart = $cart;
  $cart = new shoppingCart;
  $cart->unserialize($broken_cart);
}
 } else {
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'])) {
  if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
} else {
  $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
}
 }

// navigation history
 if (tep_session_is_registered('navigation')) {
if (PHP_VERSION < 4) {
  $broken_navigation = $navigation;
  $navigation = new navigationHistory;
  $navigation->unserialize($broken_navigation);
}
 } else {
tep_session_register('navigation');
$navigation = new navigationHistory;
 }
 $navigation->add_current_page();

// 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') {
	$parameters = array('action', 'pid', 'products_id');
  } 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 {
							  if (PHP_VERSION < 4) {
								// if PHP3, make correction for lack of multidimensional array.
								reset($HTTP_POST_VARS);
								while (list($key, $value) = each($HTTP_POST_VARS)) {
								  if (is_array($value)) {
									while (list($key2, $value2) = each($value)) {
									  if (ereg ("(.*)\]\[(.*)", $key2, $var)) {
										$id2[$var[1]][$var[2]] = $value2;
									  }
									}
								  }
								}
								$attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$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'])) {
							$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  //Master Products						 
  // customer adds multiple products from the master_listing page
  case 'add_slave' :	
						  while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) { 
							 if (substr($key,0,11) == "Qty_ProdId_") { 
							 $prodId = substr($key,11); 
							 $qty = $val; 
							 if ($qty <= 0 ) continue; 

							 $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS['id']))+($qty), $HTTP_POST_VARS['id']);

							} 
						  } 
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break; 
  //Master Products EOF													
  // performed by the 'buy now' button in product listings and review page
  case 'buy_now' :		if (isset($HTTP_GET_VARS['products_id'])) {
							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();

// 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;

// set which precautions should be checked
 define('WARN_INSTALL_EXISTENCE', 'true');
 define('WARN_CONFIG_WRITEABLE', 'true');
 define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true');
 define('WARN_SESSION_AUTO_START', 'true');
 define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');
?>

 

 

 

 

 

 

 

:huh: the buy it now for both Master & Slave products do not work!

Edited by babielo

Share this post


Link to post
Share on other sites
nevermind. i abandoned the master/slave. just install Xsell . thats the best contribution

 

 

That depends on what you are doing ;)

 

I think the fix for some environments is to do the following in application_top.php:

 

directly after:

 

case 'add_slave' :

 

add:

 

reset($HTTP_POST_VARS);

 

That should fix any problems :)

 

 

Sonia


If you want to make your dreams come true, the first thing you have to do is wake up

Share this post


Link to post
Share on other sites

This Contribution has been out for awhile now. Does anybody have or know of instructions to get this to work with BTS? If not it looks really difficult.

Share this post


Link to post
Share on other sites

I had master products working but somewhere along the line I have made it not work and only just realised. I have no idea which contribution I have corrupted MP with.

 

The slaves are not being added to the cart, just the master, is this function addressed in admin/categories.php? Or should I be focusing my efforts elsewhere?


For my contribution (to society) see my profile link.

--

my new charity store features: STSv4.5.2 and HTCv2.6.3 Bundle, Australian Post Shipping, Paymate, Category Trees Minimum Order Quantity, Enable/Disable Categories, Super Download Store, Paypal IPN, Free Dowloads, Anti-Robot Registration 2.6, Master Products, Lightbox for STS ... the rebuild continues...

Share this post


Link to post
Share on other sites
I had master products working but somewhere along the line I have made it not work and only just realised. I have no idea which contribution I have corrupted MP with.

 

The slaves are not being added to the cart, just the master, is this function addressed in admin/categories.php? Or should I be focusing my efforts elsewhere?

 

So what happens to this contribution now that the driving force (johnson) has been banned from these forums? Are bannings usually permanent?


For my contribution (to society) see my profile link.

--

my new charity store features: STSv4.5.2 and HTCv2.6.3 Bundle, Australian Post Shipping, Paymate, Category Trees Minimum Order Quantity, Enable/Disable Categories, Super Download Store, Paypal IPN, Free Dowloads, Anti-Robot Registration 2.6, Master Products, Lightbox for STS ... the rebuild continues...

Share this post


Link to post
Share on other sites
I had master products working but somewhere along the line I have made it not work and only just realised. I have no idea which contribution I have corrupted MP with.

 

The slaves are not being added to the cart, just the master, is this function addressed in admin/categories.php? Or should I be focusing my efforts elsewhere?

 

 

It's official, I'm an idiot. I forgot the $masterproducts tag. I use a different page template for the master products and at some stage had deleted the mp tag in the normal pages. d'oh.


For my contribution (to society) see my profile link.

--

my new charity store features: STSv4.5.2 and HTCv2.6.3 Bundle, Australian Post Shipping, Paymate, Category Trees Minimum Order Quantity, Enable/Disable Categories, Super Download Store, Paypal IPN, Free Dowloads, Anti-Robot Registration 2.6, Master Products, Lightbox for STS ... the rebuild continues...

Share this post


Link to post
Share on other sites

Hellpppp. I can't install master products. I keep getting this error in my phpmyadmin:

 

 

Error

SQL query:

 

# Affected rows: 1

INSERT INTO configuration_group

VALUES ( 16, 'Slave Products', 'Slave Product Listing - configuration options', 16, 1 ) ;

 

 

MySQL said:

 

#1062 - Duplicate entry '16' for key 1

 

 

 

What do I do? I really need this contribution!! Thank you for any help of guidance!!

 

-Jason-

Share this post


Link to post
Share on other sites

it looks like you have a configuration group 16 already? Have a look at your configuration_group table and see what the last entry is, then go and change the '16' in the sql that affects configuration and configuration_group to whatever the number after your last row in configuration_group is.

Share this post


Link to post
Share on other sites

Thank you so much for replying!!! I looked at my number 16 in configuration_group and number 16 is the last entry and says "Slave Products". This is part of the contribution I'm trying to add. Should I delete line 16 and try adding the contributions .sql file over again?

 

Please let me know. I really would love to have this contribution!!

 

Thanks Again,

Jason

Share this post


Link to post
Share on other sites

The weird thing is, I took a look at my database before I added this file and there's only 15 lines. The 16th line is the line the contribution is adding but also saying it's a duplicate line. Haaalllpppppp!!!!!

 

Any help would be greatly appreciated!!!

 

Thanks, Jason

Share this post


Link to post
Share on other sites

I am having a very persistant problem. I can't add slaves to the cart, whenever I click "add to cart" it adds the master.

 

I am a beginner at php, but I still am capable of quite a bit. My site is already quite hacked, and I believe the problems I'm having is working around previous hacks.

If I change product_info, "add_product" to "add_slave" in

 

<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity'

, tep_href_link(FILENAME_PRODUCT_INFO

, tep_get_all_get_params(array('action')) . 'action=add_product'));

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

 

to

 

<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity'

, tep_href_link(FILENAME_PRODUCT_INFO

, tep_get_all_get_params(array('action')) . 'action=add_slave'));

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

 

Nothing adds to the cart. I click add to cart, and the page reloads and then the cart remains the same. When it was set to 'add_product' it would only add the master product.

 

I figure its something in the 'application_top' where the 'add_product' and 'add_slave' are defined, but I can't get it to add a slave in any instance, unless I use the 'buy_now' function of that individual slave, in the product search page.

 

The problem I think it might be, is that my site does not rely on item quantities. So if you look at an item's quantity it is always a negative number of how many we sold. This might affect the add slave, because I think it relies on a positive item quantity.

 

The application top coding is as follows:

 

 

case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

 

//Master Products

// customer adds multiple products from the master_listing page

 

case 'add_slave' :

 

 

while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {

if (substr($key,0,11) == "Qty_ProdId_") {

$prodId = substr($key,11);

$qty = $val;

if ($qty <= 0 ) continue;

 

$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS['id']))+($qty), $HTTP_POST_VARS['id']);

 

}

}

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

break;

//Master Products EOF

// performed by the 'buy now' button in product listings and review page

 

case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {

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;

 

 

 

Can Someone please help me? I'm sorry I didn't paste the code in an easy to read format. Please?

Thanks,

Adam

Share this post


Link to post
Share on other sites

Matti,

First your link to the new MP v2.00 isn't working and your contributions link returns nothing. Weird since you have contributed more than a GREAT deal to this project.

 

Now, I need some help on this add_slave and update_cart areas.

 

I have the latest options as images installed and I have some sample products. When I have a text field or textarea as an option type ALONG with a radio and/or checkbox it adds to the cart correctly. However, if you leave the text box area empty when adding to cart and then click update you will now have a duplicate item in your cart. If you remove the first item and click update all is well. If you remove the second item instead and then click update it will dup it again. This is the only time the duplicating scenario can occur. No matter how many more times you click update after it duplicates it will not duplicate again. A one time occurance.

 

If you enter text and then add to cart - all is well.

If you only have a text type option - all is well even if the text field is left empty.

If you only have radio and/or checkbox and/or select - all is well.

 

I have checked the hidden field values and I have found these values:

 

This one is an option type combo and the text field was given a value

<input type="hidden" name="id[30][txt_1]" value="zsdfghujio"><input type="hidden" name="id[30][3]" value="2"><input type="hidden" name="id[30][4]" value="3"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListing">

 

As you can see, this is after I clicked update and the values are unchanged.

<input type="hidden" name="id[30][txt_1]" value="zsdfghujio"><input type="hidden" name="id[30][3]" value="2"><input type="hidden" name="id[30][4]" value="3"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListing">

 

Here the text field was left blank then added to cart and this is what you see after clicking update.

The ones with the curly braces are the 'new' values in the new product that it duplicated from the original (sans curlies)

<input type="hidden" name="id[30][3]" value="2"><input type="hidden" name="id[30][4]" value="3"><input type="hidden" name="id[30{3}2{4}3][3]" value="2"><input type="hidden" name="id[30{3}2{4}3][4]" value="3"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="productListing">

 

Again, just to be clear, the new one there, if Keep it and delete the other from my cart then all is well.

 

 

I have been looking for a solution for two days now and haven't found anything. There was one here by abra that I tried to no avail.

 

One last thing. I also notice that I cannot under any circumstances add a subsequent item with just different text. All I will see in my cart is an updated quantity with the new text.

Edited by HallMarc

Share this post


Link to post
Share on other sites

:D Ok gang. I have found the offending section of code that was causing the duplication glitch. It is from a different contribution, SPPC Hide products and categories from groups.

 

I still haven't found why I can't add a product with different options. >_<

Share this post


Link to post
Share on other sites
The problem I think it might be, is that my site does not rely on item quantities. So if you look at an item's quantity it is always a negative number of how many we sold. This might affect the add slave, because I think it relies on a positive item quantity.

 

 

Can Someone please help me? I'm sorry I didn't paste the code in an easy to read format. Please?

Thanks,

Adam

 

If you think that problem might be with stock level then check configuration setting at

 

configuration->stock

 

Check Stock Level = false

Subtract stock = false // this will stop negative values

Allow Checkout = true

 

Check these settings and try again. If it works then all good else problem should be some where in the code. Good luck

Share this post


Link to post
Share on other sites
The weird thing is, I took a look at my database before I added this file and there's only 15 lines. The 16th line is the line the contribution is adding but also saying it's a duplicate line. Haaalllpppppp!!!!!

 

Any help would be greatly appreciated!!!

 

Thanks, Jason

 

1) Check your configuration table.

If there are 12 entries with configuration_group_id set to 16 then it should be alright.

No need to delete or update configuration_group table.

Else there are 2 things you can do.

 

Delete all the entries from "configuration" table with configuration_group_id = 16

Then just update the database with first 12 lines of code from the sql file.

 

Or

 

update the fields that are missing. Match the configuration_key where configuration_group_id = 16 to the sql statements in the file and run the missing ones.

 

In the end you should have 12 unique configuration_key with configuration_group_id = 16 in "configuration" table.

 

 

2) There are 3 database entries after

INSERT INTO configuration_group VALUES (16, 'Slave Products', 'Slave Product Listing - configuration options', 16, 1);

 

 

ALTER TABLE products ADD products_master VARCHAR( 50 ) NOT NULL DEFAULT '0';
ALTER TABLE products ADD products_master_status tinyint(2) NOT NULL default '0';
ALTER TABLE products ADD products_listing_status tinyint(2) NOT NULL default '1';

 

Check products table if there are these 3 fields (products_master,products_master_status,products_listing_status)

 

If they are present then your database has been successfully updated. You should be able to update the files.

If product table is not updated then just run above 3 lines.

Share this post


Link to post
Share on other sites

I have a queries question which I'm sure someone here will be able to easily see the answer to :)

 

I am adding the products to my Dynamenu (product categories menu) and I'm running into an issue I have had before, and I just can't seem to find what the fix was. The products are showing up in the menu (YAY!) but it is showing both the slaves and the master and I only want the master to show up.

 

You can see it here:

http://www.mmherbs.dreamhosters.com (vertical flyout menu on left)

 

Now - being I have a good amount of contrib's installed I've had to go about things slightly different from a stock osC store. I have STS v4.2 - so this is how I've done this so far (Thanks to hawgwired for the starting point with this project!!!)

 

In my sts_column_left file I call the menu - the bit of code in that file that has to do with adding the products to the menu is as follows:

// mikeys product listing
$products_in_category_query = tep_products_in_category($key);

while ($products_in_category = tep_db_fetch_array($products_in_category_query)) {

$product_id_h = 'products_id='.$products_in_category ['product_id'];
$product_name_h = $products_in_category ['product'];

if ($GLOBALS['products_id'] == $products_in_category ['product_id']) {
$that_expanded = '1';
$that_selected = 'dmselected';
} else {
$that_expanded = '';
$that_selected = '';
}

if ($menu_use_titles) {
$that_title = $product_name_h;
} else {
$that_title = '';
}

$output .= str_repeat(".", $level+2).'|'.$product_name_h.'|'.tep_href_link(FILENAME_PRODUCT_INFO, $product_id_h).'|'.$that_title.'|'.$menu_icon_file.'|'.$that_selected.'|'.$that_expanded."\n";
} //EOF mikeys product listing

 

Then - in my general.php file (includes/functions) I have the query that this bit of code refers to:

//for products in Dynamenu
function tep_products_in_category($category_id, $include_inactive = false) {

if ($include_inactive) {
$products_query = tep_db_query("select p.products_id, p.products_master_status, p.products_model, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' and p.products_id = pd.products_id AND p.products_master_status='1' order by pd.products_name");
} else {
$products_query = tep_db_query("select p.products_id, p.products_master_status, p.products_model, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' and p.products_id = pd.products_id AND p.products_master_status='1' order by pd.products_name");
}

return $products_query;
}

 

If I remember correctly, the AND p.products_master_status='1' bit of code is what fixed the problem on my "All Products" page - but for some reason it doesn't seem to have fixed the problem in the menu. :huh:

 

Anybody have any ideas?

 

TIA! :D


~Tracy
 

Share this post


Link to post
Share on other sites
I have a queries question which I'm sure someone here will be able to easily see the answer to :)

 

I am adding the products to my Dynamenu (product categories menu) and I'm running into an issue I have had before, and I just can't seem to find what the fix was. The products are showing up in the menu (YAY!) but it is showing both the slaves and the master and I only want the master to show up.

 

You can see it here:

http://www.mmherbs.dreamhosters.com (vertical flyout menu on left)

 

Ok - we might have a slight correction to the above post - it almost appears as though it is only pulling the master product - but it's pulling it three times??? :huh:


~Tracy
 

Share this post


Link to post
Share on other sites

Well - on top of the "getting products into Dynamenu" fun - I have got the most bizzare thing happening :huh:

 

When I view a main category page, the subcategories are showing up double in the product_listing table :( This does not happen in IE7 - but started happening in FireFox once I installed Netscape yesterday for another test browser - it also happens in Netscape. What makes it even more weird is it only happens visually - if I view the source code the subcategories are only in there once :blink:

 

I have been scouring the forums via Google searches and I haven't come accross this issue yet.

 

Since I have both SPPC and Master Products installed I figure it could be a glitch with the code in either contrib - or in the way they combine and work together on the product_listing.php page. For this reason I'm posting this in both contrib's support forums ;)

 

Any thoughts on what's causing this?

 

You can see the issue in Firefox or Netscape here:

http://mmherbs.dreamhosters.com

 

Here's my product_listing.php code:

(I did modify the code some so that the table would only show the name of the subcategory, and I think I left the image there too even though I am not using it)

<?php
/*
 $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $
 adapted for Separate Pricing Per Customer v4 2005/02/26

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

 Copyright (c) 2003 osCommerce

 Master Products  - JOHNSON - 05/07/2003 matti@suomedia.com

 Copyright (c) 2003 Suomedia - Dynamic Content Management  

 Released under the GNU General Public License
*/

 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }

 $list_box_contents = array();

 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
switch ($column_list[$col]) {
  case 'PRODUCT_LIST_IMAGE':
	$lc_text = TABLE_HEADING_IMAGE;
	$lc_align = 'center';
	break;
  case 'PRODUCT_LIST_NAME':
	$lc_text = TABLE_HEADING_PRODUCTS;
	$lc_align = '';
	break;

}

  // if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
 // $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
//}

$list_box_contents[0][] = array('align' => $lc_align,
								'params' => 'class="productListing-heading"',
								'text' => ' ' . $lc_text . ' ');
 }

 if ($listing_split->number_of_rows > 0) {

$rows = 0;
$listing_query = tep_db_query($listing_split->sql_query);
// BOF Separate Pricing per Customer
$no_of_listings = tep_db_num_rows($listing_query);
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 if ( !isset($_SESSION['sppc_customer_group_id']) ) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $_SESSION['sppc_customer_group_id'];
 }


while ($_listing = tep_db_fetch_array($listing_query)) {
  $listing[] = $_listing;
$list_of_prdct_ids[] = $_listing['products_id'];
} 
// next part is a debug feature, when uncommented it will print the info that this module receives
/*
  echo '<pre>';
  print_r($listing);
  echo '</pre>';
*/  
 $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
 if ($no_of_listings > 1) {
  for ($n = 1; $n < count($list_of_prdct_ids); $n++) {
  $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' "; 
  }
}

// get all product prices for products with the particular customer_group_id
// however not necessary for customer_group_id = 0
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."' ");
//   $no_of_pg_products = tep_db_num_rows($pg_query);
while ($pg_array = tep_db_fetch_array($pg_query)) {
$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '', 'final_price' => $pg_array['price']);
}
  for ($x = 0; $x < $no_of_listings; $x++) {
// replace products prices with those from customers_group table
  if(!empty($new_prices)) {
	 for ($i = 0; $i < count($new_prices); $i++) {
	if( $listing[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
	$listing[$x]['products_price'] = $new_prices[$i]['products_price'];
	$listing[$x]['final_price'] = $new_prices[$i]['final_price'];
	}
	}
} // end if(!empty($new_prices)
$listing[$x]['specials_new_products_price'] = ''; // makes sure that a retail specials price doesn't carry over to another customer group
$listing[$x]['final_price'] = $listing[$x]['products_price']; // final price should not be the retail special price
  } // end for ($x = 0; $x < $no_of_listings; $x++)
} // end if ($customer_group_id != '0')

// an extra query is needed for all the specials

$specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "'");
while ($specials_array = tep_db_fetch_array($specials_query)) {
$new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']);
}

// add the correct specials_new_products_price and replace final_price
for ($x = 0; $x < $no_of_listings; $x++) {

	if(!empty($new_s_prices)) {
	for ($i = 0; $i < count($new_s_prices); $i++) {
	 if( $listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
	   $listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price'];
	   $listing[$x]['final_price'] = $new_s_prices[$i]['final_price'];
	 }
	   }
   } // end if(!empty($new_s_prices)
} // end for ($x = 0; $x < $no_of_listings; $x++)

//	while ($listing = tep_db_fetch_array($listing_query)) { (was original code)
for ($x = 0; $x < $no_of_listings; $x++) {

  $rows++;

  if (($rows/2) == floor($rows/2)) {
	$list_box_contents[] = array('params' => 'class="productListing-even"');
  } else {
	$list_box_contents[] = array('params' => 'class="productListing-odd"');
  }

  $cur_row = sizeof($list_box_contents) - 1;

  for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
	$lc_align = '';

	switch ($column_list[$col]) {
	  case 'PRODUCT_LIST_IMAGE':
		$lc_align = 'center';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
		}
		break;
	  case 'PRODUCT_LIST_NAME':
		$lc_align = '';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>';
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a> ';
		}
		break;
	   // EOF Separate Pricing per Customer
//Master Products			
		if ($listing[$x]['products_master_status'] != '1' && $listing[$x]['products_master'] == '0') {
				$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
			} elseif ($listing[$x]['products_master'] != '0') {
	   		 $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_master']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
			} else {
				$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
			}
//Master Products EOF			
		break;
	}

	$list_box_contents[$cur_row][] = array('align' => $lc_align,
										   'params' => 'class="productListing-data"',
										   'text'  => $lc_text);
  }
}

new productListingBox($list_box_contents);
 } else {
$list_box_contents = array();

$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
							   'text' => TEXT_NO_PRODUCTS);

new productListingBox($list_box_contents);
 }

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>
<?php
 }
?>


~Tracy
 

Share this post


Link to post
Share on other sites
Ok - we might have a slight correction to the above post - it almost appears as though it is only pulling the master product - but it's pulling it three times??? :huh:

 

I think what is happening is that it is pulling each of the three languages for three listings of the same item - however, when I include

AND pd.language_id = '" . (int)$language . "'

into the $products_query strings I end up with no products showing up in my menu.

 

:blink:


~Tracy
 

Share this post


Link to post
Share on other sites
I think what is happening is that it is pulling each of the three languages for three listings of the same item - however, when I include
AND pd.language_id = '" . (int)$language . "'

into the $products_query strings I end up with no products showing up in my menu.

 

:blink:

 

YAY!!! I GOT IT!!! :D :D

 

Ok - I was right, it was pulling the product for each of the 3 languages (hence listing it 3 times) so I did need the pd.language_id = '" .(int)$language ."' bit of code - but what I didn't realize is I needed to declare the $language in the query - so my query now looks like this:

 

//for products in Dynamenu
function tep_products_in_category($category_id, $language = '', $include_inactive = false) {

global $languages_id;

if (empty($language)) $language = $languages_id;

if ($include_inactive) {
$products_query = tep_db_query("select p.products_id, p.products_master_status, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' AND pd.language_id = '" . (int)$language . "' and p.products_id = pd.products_id AND p.products_master_status='1' order by pd.products_name");
} else {
$products_query = tep_db_query("select p.products_id, p.products_master_status, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' AND pd.language_id = '" . (int)$language . "' and p.products_id = pd.products_id AND p.products_master_status='1' order by pd.products_name");
}

return $products_query;
}

 

That bit at the top had to be changed to include the language information. Hopefully this will help somebody else too! :D

 

<doin' my happy dance!> :D


~Tracy
 

Share this post


Link to post
Share on other sites
When I view a main category page, the subcategories are showing up double in the product_listing table :( This does not happen in IE7 - but started happening in FireFox once I installed Netscape yesterday for another test browser - it also happens in Netscape. What makes it even more weird is it only happens visually - if I view the source code the subcategories are only in there once :blink:

 

I have been scouring the forums via Google searches and I haven't come accross this issue yet.

 

Since I have both SPPC and Master Products installed I figure it could be a glitch with the code in either contrib - or in the way they combine and work together on the product_listing.php page. For this reason I'm posting this in both contrib's support forums ;)

 

Any thoughts on what's causing this?

 

PS - I do still have this issue unresolved :blush:


~Tracy
 

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

×