Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Can anybody suggest where I have gone wrong on installing 4.2.2 on 2.3.1 as when I go into customer in the admin section I get this error message saying

 

 

1146 - Table 'naturesn_mtsmmx.TABLE_CUSTOMERS_GROUPS' doesn't exist

 

 

 

I have run the sql account so I am afraid I am lost.

 

Regards

 

Liz

 

Still trying to learn!

Liz

 

A very appreciative member still attempting to climb the steep learning curve!

Link to comment
Share on other sites

Can anybody suggest where I have gone wrong on installing 4.2.2 on 2.3.1 as when I go into customer in the admin section I get this error message saying

 

1146 - Table 'naturesn_mtsmmx.TABLE_CUSTOMERS_GROUPS' doesn't exist

 

I have run the sql account so I am afraid I am lost.

 

Regards

 

Liz

 

Still trying to learn!

 

Hi Liz,

 

The clue is that TABLE_CUSTOMERS_GROUPS is still all upper case. It should have been translated into the actual name of your customer groups table. This translation is defined in the file admin/includes/database_tables.php

 

Probably you missed out the changes to this file, or missed out uploading it.

Edited by JohnAtYM

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

I am not sure if I am on the correct thread but I have just installed SPPC 4.2.2 on a modified 2.3.1 osCommerce. All seemed to go well and after adding the .sql file I got this message:-

ALTER TABLE `customers`

ADD customers_group_id smallint UNSIGNED NOT NULL default '0',

ADD customers_group_ra enum('0','1') NOT NULL,

ADD customers_payment_allowed varchar(255) NOT NULL default '',

ADD customers_shipment_allowed varchar(255) NOT NULL default '',

ADD customers_order_total_allowed varchar(255) NOT NULL default '',

ADD customers_specific_taxes_exempt varchar(255) NOT NULL default '',

ADD entry_company_tax_id VARCHAR(32) DEFAULT NULL;# 2 row(s) affected.

 

 

DROP TABLE IF EXISTS `products_groups`;# MySQL returned an empty result set (i.e. zero rows).

 

CREATE TABLE products_groups (

customers_group_id smallint UNSIGNED NOT NULL default '0',

customers_group_price decimal(15,4) NOT NULL default '0.0000',

products_id int(11) NOT NULL default '0',

PRIMARY KEY (customers_group_id, products_id)

);# MySQL returned an empty result set (i.e. zero rows).

 

 

ALTER TABLE `specials`

ADD customers_group_id smallint UNSIGNED NOT NULL default '0';# MySQL returned an[...]

 

Yet when I go into admin be it customers or customer groups I get a message along these lines :-

 

1146 - Table 'naturesn_mtsmmx.TABLE_CUSTOMERS_GROUPS' doesn't exist

 

select count(*) as total from TABLE_CUSTOMERS_GROUPS g

 

I have looked in my database and there is a customers-groups listed in the database but I still get these messages. CAn somebody spot my mistake and advise me how to get it right?

 

Hoping for a bit of help, fingers crossed.

Liz

 

A very appreciative member still attempting to climb the steep learning curve!

Link to comment
Share on other sites

I have looked in my database and there is a customers-groups listed in the database but I still get these messages. CAn somebody spot my mistake and advise me how to get it right?

Looks like a missing define in /admin/includes/database_tables.php:

 

// BOF Separate Pricing Per Customer
 define('TABLE_PRODUCTS_GROUPS', 'products_groups');
 define('TABLE_CUSTOMERS_GROUPS', 'customers_groups');
 define('TABLE_PRODUCTS_GROUP_PRICES', 'products_group_prices_cg_');
 define('TABLE_PRODUCTS_ATTRIBUTES_GROUPS', 'products_attributes_groups');
// EOF Separate Pricing Per Customer

Link to comment
Share on other sites

Looks like a missing define in /admin/includes/database_tables.php:

 

// BOF Separate Pricing Per Customer
 define('TABLE_PRODUCTS_GROUPS', 'products_groups');
 define('TABLE_CUSTOMERS_GROUPS', 'customers_groups');
 define('TABLE_PRODUCTS_GROUP_PRICES', 'products_group_prices_cg_');
 define('TABLE_PRODUCTS_ATTRIBUTES_GROUPS', 'products_attributes_groups');
// EOF Separate Pricing Per Customer

 

 

Thanks Jan I will go and have a look now, will report back shortly!

Liz

 

A very appreciative member still attempting to climb the steep learning curve!

Link to comment
Share on other sites

Jan and John thanks very much, you were both correct, somehow in comparing fiules and making necessary alterations I had missed a line of coding from admin/includes/database_tables.php. I have now added it and everything seems fine thanks very much for your help and advice on this matter - you are both brill.

 

Thanks again.

Liz

 

A very appreciative member still attempting to climb the steep learning curve!

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

I have installed v4.2.2 sppc everything works perfectly except for one thing.

 

I have changed the layout of my site.

 

If I am on the index page, and click a category I do not see the adjusted price for that group.

While on all other pages he neatly reflects the adjusted price.

 

Can someone help me.

To get the code in to my index.php so when I click on a category, he also displays the correct price for this group.

 

Sincerely,

 

Badmaus.

 

My index.php

 

 

<?php
/*
 $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
// 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

// the following cPath references come from application_top.php
 $category_depth = 'top';
 if (isset($cPath) && tep_not_null($cPath)) {
   $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
   $cateqories_products = tep_db_fetch_array($categories_products_query);
   if ($cateqories_products['total'] > 0) {
     $category_depth = 'products'; // display products
   } else {
     $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
     $category_parent = tep_db_fetch_array($category_parent_query);
     if ($category_parent['total'] > 0) {
       $category_depth = 'nested'; // navigate through the categories
     } else {
       $category_depth = 'products'; // category has no products, but display the 'no products' message
     }
   }
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
   <td valign="top" class="col_left">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </td>
<!-- body_text //-->
<?php
 if ($category_depth == 'nested') {
   $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);
?>
   <td width="100%" class="col_center">


<?php tep_draw_heading_top();?>

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

<?php tep_draw_heading_top_3();?>


				<table cellpadding="0" cellspacing="0" border="0"><tr><td height="6"></td></tr></table>
				<table border="0" cellspacing="0" cellpadding="0" align="center" class="box_width_cont product">
					<tr>
<?php
if (isset($cPath) && strpos('_', $cPath)) {
// check to see if there are deeper categories within the current category
  $category_links = array_reverse($cPath_array);
  for($i=0, $n=sizeof($category_links); $i<$n; $i++) {
	$categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
	$categories = tep_db_fetch_array($categories_query);
	if ($categories['total'] < 1) {
	  // do nothing, go through the loop
	} else {
	  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
	  break; // we've found the deepest category the customer is in
	}
  }
} else {
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
}

$number_of_categories = tep_db_num_rows($categories_query);
$rows = 0;
while ($categories = tep_db_fetch_array($categories_query)) {

  $rows++;
  $cPath_new = tep_get_path($categories['categories_id']);

$p_pic_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a>';

$p_name_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a>';

  $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
  echo '               

	<td width="' . $width . '">'.tep_draw_prod_top().'
			<table cellpadding="0" cellspacing="0" border="0">
				<tr>
					<td class="vam" style="height:43px "><span>'.$p_name_sub.'</span></td>
				</tr>
			</table>'.tep_draw_prod_pic_top().''.$p_pic_sub.''.tep_draw_prod_pic_bottom().'
	'.tep_draw_prod_bottom().'</td>
  ' . "\n";
			  if ($col!=(MAX_DISPLAY_CATEGORIES_PER_ROW-1)){
			  echo '
					<td class="bg_line_y">'.tep_draw_separator('spacer.gif', '32', '1').'</td>					
					';
			  }
			 else{	

  if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
	echo '              
</tr><tr><td colspan="'.(MAX_DISPLAY_CATEGORIES_PER_ROW + MAX_DISPLAY_CATEGORIES_PER_ROW -1).'">'.tep_draw_separator('spacer.gif', '1', '10').'</td></tr>' . "\n";
	echo '              <tr>' . "\n";
  }
}
if ($col==MAX_DISPLAY_CATEGORIES_PER_ROW-1){
$col=0;
}else{
$col++;
}
}	

// needed for the new products module shown below
$new_products_category_id = $current_category_id;
?>					

			</table>

<?php tep_draw_heading_bottom_3();?>

<?php tep_draw_heading_bottom();  ?>

<?php /*  tep_draw_separate();  */ ?>  <!--  /////////  -->

<?php tep_draw_heading_top();  ?>

<?php new contentBoxHeading_WHATS_NEW($info_box_contents, true, false);?>

<?php tep_draw_heading_top_3();?>			

		<?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?>

<?php tep_draw_heading_bottom_3();?>

<?php tep_draw_heading_bottom();?>		

</td>
<?php
 } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {
// create column list
   $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
                        'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                        'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
                        'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
                        'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                        'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
                        'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
                        'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

   asort($define_list);

   $column_list = array();
   reset($define_list);
   while (list($key, $value) = each($define_list)) {
     if ($value > 0) $column_list[] = $key;
   }
// BOF Separate Pricing Per Customer
// this will build the table with specials prices for the retail group or update it if needed
// this function should have been added to includes/functions/database.php
  if ($customer_group_id == '0') {
  tep_db_check_age_specials_retail_table();
  }
  $status_product_prices_table = false;
  $status_need_to_get_prices = false;

  // find out if sorting by price has been requested
  if ( (isset($HTTP_GET_VARS['sort'])) && (ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) && (substr($HTTP_GET_VARS['sort'], 0, 1) <= sizeof($column_list)) && $customer_group_id != '0' ){
   $_sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
   if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') {
     $status_need_to_get_prices = true;
     }
  }

  if ($status_need_to_get_prices == true && $customer_group_id != '0') {
  $product_prices_table = TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id;
  // the table with product prices for a particular customer group is re-built only a number of times per hour
  // (setting in /includes/database_tables.php called MAXIMUM_DELAY_UPDATE_PG_PRICES_TABLE, in minutes)
  // to trigger the update the next function is called (new function that should have been
  // added to includes/functions/database.php)
  tep_db_check_age_products_group_prices_cg_table($customer_group_id);
  $status_product_prices_table = true;

  } // end if ($status_need_to_get_prices == true && $customer_group_id != '0')
// EOF Separate Pricing Per Customer

   $select_column_list = '';

   for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
     switch ($column_list[$i]) {
       case 'PRODUCT_LIST_MODEL':
         $select_column_list .= 'p.products_model, ';
         break;
       case 'PRODUCT_LIST_NAME':
         $select_column_list .= 'pd.products_name, ';
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $select_column_list .= 'm.manufacturers_name, ';
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $select_column_list .= 'p.products_quantity, ';
         break;
       case 'PRODUCT_LIST_IMAGE':
         $select_column_list .= 'p.products_image, ';
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $select_column_list .= 'p.products_weight, ';
         break;
     }
   }

// show the products of a specified manufacturer
   if (isset($HTTP_GET_VARS['manufacturers_id'])) {
     if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
// BOF Separate Pricing Per Customer
if ($status_product_prices_table == true) { // ok in mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd , " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
} else { // either retail or no need to get correct special prices -- changed for mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
} // end else { // either retail...
// EOF Separate Pricing Per Customer
     } else {
// We show them all
// BOF Separate Pricing Per Customer
       if ($status_product_prices_table == true) { // ok in mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
} else { // either retail or no need to get correct special prices -- changed for mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
} // end else { // either retail...
// EOF Separate Pricing Per Customer
     }
   } else {
// show the products in a given categorie
     if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory;
// BOF Separate Pricing Per Customer
       if ($status_product_prices_table == true) { // ok for mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
       } else { // either retail or no need to get correct special prices -- ok in mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id) where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
       } // end else { // either retail...
// EOF Separate Pricing Per Customer
     } else {
// We show them all
// BOF Separate Pricing Per Customer --last query changed for mysql 5 compatibility
       if ($status_product_prices_table == true) {
// original, no need to change for mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
       } else { // either retail or no need to get correct special prices -- changed for mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
     } // end else { // either retail...
// EOF Separate Pricing per Customer
       }
   }

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;
       }
     }
   } else {
     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);

     switch ($column_list[$sort_col-1]) {
       case 'PRODUCT_LIST_MODEL':
         $listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_NAME':
         $listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_IMAGE':
         $listing_sql .= " order by pd.products_name";
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_PRICE':
         $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
     }
   }
?>
   <td width="100%" class="col_center">

<?php tep_draw_heading_top();?>		





<?php
// optional Product List Filter
/*      if (PRODUCT_LIST_FILTER > 0) {
     if (isset($HTTP_GET_VARS['manufacturers_id'])) {
       $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";
     } else {
       $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
     }
     $filterlist_query = tep_db_query($filterlist_sql);
     if (tep_db_num_rows($filterlist_query) > 1) {
       echo '            <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';
       if (isset($HTTP_GET_VARS['manufacturers_id'])) {
         echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
         $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
       } else {
         echo tep_draw_hidden_field('cPath', $cPath);
         $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
       }
       echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
       while ($filterlist = tep_db_fetch_array($filterlist_query)) {
         $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
       }
       echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');
       echo tep_hide_session_id() . '</form></td>' . "\n";
     }
   }
 */
// Get the right image for the top-right
   $image = DIR_WS_IMAGES . 'table_background_list.gif';
   if (isset($HTTP_GET_VARS['manufacturers_id'])) {
     $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
     $image = tep_db_fetch_array($image);
     $image = $image['manufacturers_image'];
   } elseif ($current_category_id) {
     $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
     $image = tep_db_fetch_array($image);
     $image = $image['categories_image'];
   }
?>
     <?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?>

<?php tep_draw_heading_bottom_3();?>

<?php tep_draw_heading_bottom();?>		

  </td>
<?php
 } else { // default page
?>
   <td width="100%" class="col_center">



<?php /*  require(DIR_WS_BOXES . 'panel_top.php');  */ ?>

<?php tep_draw_heading_top();?>

<?php /*  new contentBoxHeading_ProdNew($info_box_contents);  */  ?>

<?php tep_draw_heading_top_3();?>


	<?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?>
	<?php include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS); ?>


<?php tep_draw_heading_bottom_3();?>

<?php tep_draw_heading_bottom();?>		

	</td>
<?php
 }
?>
<!-- body_text_eof //-->
   <td class="col_right">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //--></body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

 

And de page of de sppc v4.2.2.

 

 

 

<?php
/*
 $Id: index.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing per Customer 2007/06/24

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
// 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

// the following cPath references come from application_top.php
 $category_depth = 'top';
 if (isset($cPath) && tep_not_null($cPath)) {
   $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
   $cateqories_products = tep_db_fetch_array($categories_products_query);
   if ($cateqories_products['total'] > 0) {
     $category_depth = 'products'; // display products
   } else {
     $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
     $category_parent = tep_db_fetch_array($category_parent_query);
     if ($category_parent['total'] > 0) {
       $category_depth = 'nested'; // navigate through the categories
     } else {
       $category_depth = 'products'; // category has no products, but display the 'no products' message
     }
   }
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
<?php
 if ($category_depth == 'nested') {
   $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);
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
<?php
   if (isset($cPath) && strpos('_', $cPath)) {
// check to see if there are deeper categories within the current category
     $category_links = array_reverse($cPath_array);
     for($i=0, $n=sizeof($category_links); $i<$n; $i++) {
       $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
       $categories = tep_db_fetch_array($categories_query);
       if ($categories['total'] < 1) {
         // do nothing, go through the loop
       } else {
         $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
         break; // we've found the deepest category the customer is in
       }
     }
   } else {
     $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
   }

   $number_of_categories = tep_db_num_rows($categories_query);

   $rows = 0;
   while ($categories = tep_db_fetch_array($categories_query)) {
     $rows++;
     $cPath_new = tep_get_path($categories['categories_id']);
     $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
     echo '                <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n";
     if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
       echo '              </tr>' . "\n";
       echo '              <tr>' . "\n";
     }
   }

// needed for the new products module shown below
   $new_products_category_id = $current_category_id;
?>
             </tr>
           </table></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
         </tr>
       </table></td>
     </tr>
   </table></td>
<?php
 } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {
// create column list
   $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
                        'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                        'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
                        'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
                        'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                        'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
                        'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
                        'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

   asort($define_list);

   $column_list = array();
   reset($define_list);
   while (list($key, $value) = each($define_list)) {
     if ($value > 0) $column_list[] = $key;
   }
// BOF Separate Pricing Per Customer
// this will build the table with specials prices for the retail group or update it if needed
// this function should have been added to includes/functions/database.php
  if ($customer_group_id == '0') {
  tep_db_check_age_specials_retail_table();
  }
  $status_product_prices_table = false;
  $status_need_to_get_prices = false;

  // find out if sorting by price has been requested
  if ( (isset($HTTP_GET_VARS['sort'])) && (ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) && (substr($HTTP_GET_VARS['sort'], 0, 1) <= sizeof($column_list)) && $customer_group_id != '0' ){
   $_sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
   if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') {
     $status_need_to_get_prices = true;
     }
  }

  if ($status_need_to_get_prices == true && $customer_group_id != '0') {
  $product_prices_table = TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id;
  // the table with product prices for a particular customer group is re-built only a number of times per hour
  // (setting in /includes/database_tables.php called MAXIMUM_DELAY_UPDATE_PG_PRICES_TABLE, in minutes)
  // to trigger the update the next function is called (new function that should have been
  // added to includes/functions/database.php)
  tep_db_check_age_products_group_prices_cg_table($customer_group_id);
  $status_product_prices_table = true;

  } // end if ($status_need_to_get_prices == true && $customer_group_id != '0')
// EOF Separate Pricing Per Customer

   $select_column_list = '';

   for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
     switch ($column_list[$i]) {
       case 'PRODUCT_LIST_MODEL':
         $select_column_list .= 'p.products_model, ';
         break;
       case 'PRODUCT_LIST_NAME':
         $select_column_list .= 'pd.products_name, ';
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $select_column_list .= 'm.manufacturers_name, ';
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $select_column_list .= 'p.products_quantity, ';
         break;
       case 'PRODUCT_LIST_IMAGE':
         $select_column_list .= 'p.products_image, ';
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $select_column_list .= 'p.products_weight, ';
         break;
     }
   }

// show the products of a specified manufacturer
   if (isset($HTTP_GET_VARS['manufacturers_id'])) {
     if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
// BOF Separate Pricing Per Customer
if ($status_product_prices_table == true) { // ok in mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd , " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";		
} else { // either retail or no need to get correct special prices -- changed for mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
} // end else { // either retail...
// EOF Separate Pricing Per Customer
     } else {
// We show them all
// BOF Separate Pricing Per Customer
       if ($status_product_prices_table == true) { // ok in mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";	
} else { // either retail or no need to get correct special prices -- changed for mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
} // end else { // either retail...
// EOF Separate Pricing Per Customer
     }
   } else {
// show the products in a given categorie
     if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory;  
// BOF Separate Pricing Per Customer
       if ($status_product_prices_table == true) { // ok for mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";	
       } else { // either retail or no need to get correct special prices -- ok in mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id) where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
       } // end else { // either retail...
// EOF Separate Pricing Per Customer
     } else {
// We show them all
// BOF Separate Pricing Per Customer --last query changed for mysql 5 compatibility
       if ($status_product_prices_table == true) {
// original, no need to change for mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
       } else { // either retail or no need to get correct special prices -- changed for mysql 5
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; 
     } // end else { // either retail...
// EOF Separate Pricing per Customer
     }
   }

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;
       }
     }
   } else {
     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);

     switch ($column_list[$sort_col-1]) {
       case 'PRODUCT_LIST_MODEL':
         $listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_NAME':
         $listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_IMAGE':
         $listing_sql .= " order by pd.products_name";
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_PRICE':
         $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
     }
   }
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<?php
// optional Product List Filter
   if (PRODUCT_LIST_FILTER > 0) {
     if (isset($HTTP_GET_VARS['manufacturers_id'])) {
       $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";
     } else {
       $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
     }
     $filterlist_query = tep_db_query($filterlist_sql);
     if (tep_db_num_rows($filterlist_query) > 1) {
       echo '            <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';
       if (isset($HTTP_GET_VARS['manufacturers_id'])) {
         echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
         $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
       } else {
         echo tep_draw_hidden_field('cPath', $cPath);
         $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
       }
       echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
       while ($filterlist = tep_db_fetch_array($filterlist_query)) {
         $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
       }
       echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');
       echo tep_hide_session_id() . '</form></td>' . "\n";
     }
   }

// Get the right image for the top-right
   $image = DIR_WS_IMAGES . 'table_background_list.gif';
   if (isset($HTTP_GET_VARS['manufacturers_id'])) {
     $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
     $image = tep_db_fetch_array($image);
     $image = $image['manufacturers_image'];
   } elseif ($current_category_id) {
     $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
     $image = tep_db_fetch_array($image);
     $image = $image['categories_image'];
   }
?>
           <td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>
     </tr>
   </table></td>
<?php
 } else { // default page
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="main"><?php echo tep_customer_greeting(); ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_MAIN; ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
         </tr>
<?php
   include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);
?>
       </table></td>
     </tr>
   </table></td>
<?php
 }
?>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Hi,

 

I have installed v4.2.2 sppc everything works perfectly except for one thing.

 

I have changed the layout of my site.

 

If I am on the index page, and click a category I do not see the adjusted price for that group.

While on all other pages he neatly reflects the adjusted price.

 

Can someone help me.

To get the code in to my index.php so when I click on a category, he also displays the correct price for this group.

 

Sincerely,

 

Badmaus.

 

 

Hi, I'm assuming you mean that when it shows a list of products in the category, the adjusted price is not shown.

 

The coding for this is in

[catalog]/includes/modules/product_listing.php

so you need to check your changes in this file.

 

If you can't find the problem, post that file here.

 

John

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Hi, I'm assuming you mean that when it shows a list of products in the category, the adjusted price is not shown.

 

The coding for this is in

[catalog]/includes/modules/product_listing.php

so you need to check your changes in this file.

 

If you can't find the problem, post that file here.

 

John

 

Hello JohnAtYM,

 

Thank you, this was indeed the problem. I had just forgotten to adapt the file product_listing.php.

 

If you must manually change so many files, chances are that you overlook somthing...

 

Thanks again.

 

Sincerely,

 

Badmaus.

Link to comment
Share on other sites

Good morning to all of you.

I really need your help because i already have made two times a fatal error to my website.

I need to install a module to create separate prices for resellers.

I already have found the module "Separate prices pre customer" but i can't find the appropriate istructions to install it into an oscommerce 2.3.1 e-shop.

Is that possible?

The instructions that they excist into the file that i had download, they are sending you to read the 2.2 instalation faq way, but when i am openning my oscommerce files, there aren't in there the lines that the file is saying to . Can you please help me?

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

Good morning to all of you.

I really need your help because i already have made two times a fatal error to my website.

I need to install a module to create separate prices for resellers.

I already have found the module "Separate prices pre customer" but i can't find the appropriate istructions to install it into an oscommerce 2.3.1 e-shop.

Is that possible?

The instructions that they excist into the file that i had download, they are sending you to read the 2.2 instalation faq way, but when i am openning my oscommerce files, there aren't in there the lines that the file is saying to . Can you please help me?

 

Hi,

 

What version of Separate Pricing Per Customer do you use?

 

I have lookt in the osc code 2.3.1. and find the code to be change.

 

Is your osc 2.3.1 layout been modified, use the tool Compare & Merge or similar, to find de code to change.

If yes, you will have to install Separate Pricing Per Customer manually.

 

if your site is modified, the code is not always at the same line.

 

I use Separate Pricing Per Customer 4.2.2. with osCommerce Online Merchant v2.2 RC2a works perfectly

 

Gr Badmaus.

Link to comment
Share on other sites

Hi,

 

What version of Separate Pricing Per Customer do you use?

 

I have lookt in the osc code 2.3.1. and find the code to be change.

 

Is your osc 2.3.1 layout been modified, use the tool Compare & Merge or similar, to find de code to change.

If yes, you will have to install Separate Pricing Per Customer manually.

 

if your site is modified, the code is not always at the same line.

 

I use Separate Pricing Per Customer 4.2.2. with osCommerce Online Merchant v2.2 RC2a works perfectly

 

Gr Badmaus.

 

Good evening

I am using osc 2.3.1 and sppc (separate_price_per_customers_4.2.2) for_2.3.1.

My example site is not modified yet. But when i put all the files from the catalog directly to my store then everything becomes a mess.

When i am trying to find the code for example in catalog/admin/includes/boxes/customers.php it sais go to Line 4 and find **AFTER**

$Id: customers.php 1739 2007-12-20 00:52:16Z hpdl $ **ADD** adapted for Separate Pricing Per Customer v4.0 2005/01/28.

But when i am looking ti this file the line that he ssaid to add it is allready there but the line he said to find is missing. So what do i have to do?

Is it ok if copy all the files directly to the catalog and if yes why until now is not working this method?

Edited by apolyshow

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

Good evening

I am using osc 2.3.1 and sppc (separate_price_per_customers_4.2.2) for_2.3.1.

My example site is not modified yet. But when i put all the files from the catalog directly to my store then everything becomes a mess.

When i am trying to find the code for example in catalog/admin/includes/boxes/customers.php it sais go to Line 4 and find **AFTER**

$Id: customers.php 1739 2007-12-20 00:52:16Z hpdl $ **ADD** adapted for Separate Pricing Per Customer v4.0 2005/01/28.

But when i am looking ti this file the line that he ssaid to add it is allready there but the line he said to find is missing. So what do i have to do?

Is it ok if copy all the files directly to the catalog and if yes why until now is not working this method?

 

The instructions for editing the code only apply to 2.2 stores.

 

For an unmodified 2.3.1 store you can copy the files from "Full set of new and amended files for SPPC 4.2.2 on oscommerce 2.3.1" into your store. But FIRST, reinstall your store and make sure it's working ok.

 

As well as copying the files, there are two other steps:

- Run the spcc_v421_install.sql database installation file on your MySQL database.

- Modify the catalog/includes/languages/english/login.php file to include the Site Administrator's email address. This email address is used for wholesale account notifications. You can find the appropriate section of that file by doing a search for the keyword root.

 

If you get in another mess, be more explicit about what the mess is and we can try to work out what you're doing wrong. It sounds like this is your first install of an add-on, and it's very easy to copy files into the wrong directory, especially to mix up files that should be in the catalog directories with ones that should be in the admin directories. It may also useful to know how you installed your site (from download, cpanel etc).

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

The instructions for editing the code only apply to 2.2 stores.

 

For an unmodified 2.3.1 store you can copy the files from "Full set of new and amended files for SPPC 4.2.2 on oscommerce 2.3.1" into your store. But FIRST, reinstall your store and make sure it's working ok.

 

As well as copying the files, there are two other steps:

- Run the spcc_v421_install.sql database installation file on your MySQL database.

- Modify the catalog/includes/languages/english/login.php file to include the Site Administrator's email address. This email address is used for wholesale account notifications. You can find the appropriate section of that file by doing a search for the keyword root.

 

If you get in another mess, be more explicit about what the mess is and we can try to work out what you're doing wrong. It sounds like this is your first install of an add-on, and it's very easy to copy files into the wrong directory, especially to mix up files that should be in the catalog directories with ones that should be in the admin directories. It may also useful to know how you installed your site (from download, cpanel etc).

 

 

When i copy files i am getting in my first page of my store :

 

1054 - Unknown column 's.customers_group_id' in 'where clause'

 

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '1' and s.status = '1' and s.customers_group_id = '0' order by s.specials_date_added desc limit 10

 

[TEP STOP]

 

The administrator panel i think it is ok...

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

When i copy files i am getting in my first page of my store :

 

1054 - Unknown column 's.customers_group_id' in 'where clause'

 

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '1' and s.status = '1' and s.customers_group_id = '0' order by s.specials_date_added desc limit 10

 

[TEP STOP]

 

The administrator panel i think it is ok...

 

 

Ok i didn't install the sql database and now i am trying to configure the email adress. Sorry and thank you very much

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

You mean here :

 

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

<tr>

<td class="fieldKey"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>

<td class="fieldValue"><?php echo tep_draw_input_field('email_address'); ?></td>

</tr>

<tr>

<td class="fieldKey"><?php echo ENTRY_PASSWORD; ?></td>

<td class="fieldValue"><?php echo tep_draw_password_field('password'); ?></td>

</tr>

</table>

 

And something else. How can i configure that the prices will not be visible by a specific categorie of customers?

Edited by apolyshow

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

You mean here :

 

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

<tr>

<td class="fieldKey"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>

<td class="fieldValue"><?php echo tep_draw_input_field('email_address'); ?></td>

</tr>

<tr>

<td class="fieldKey"><?php echo ENTRY_PASSWORD; ?></td>

<td class="fieldValue"><?php echo tep_draw_password_field('password'); ?></td>

</tr>

</table>

 

No, you configure the email address by editing the file

catalog/includes/languages/english/login.php

not

catalog/login.php

 

...as I said, it's easy to look in the wrong folder!

 

Change the line

define('SPPC_TOGGLE_LOGIN_PASSWORD', 'root@localhost');

to read something like

define('SPPC_TOGGLE_LOGIN_PASSWORD', '[email protected]');

 

And something else. How can i configure that the prices will not be visible by a specific categorie of customers?

 

From the documentation:

How It Works

 

The first thing you will want to do after installation is to create customer groups. These groups are created by going into your site's osC Admin and selecting the Customers link. After that you will see a link called Customers Groups. Click on that and you will see the default Retail Group. Select Insert to create a new group. At this point you can choose the name, whether to display the price with tax included, whether the group should be taxed and also define which Payment & Shipping methods will apply to that group. Create as many groups as are required for your business.

 

The next step will be to edit your existing products and enter the new pricing for each product. You do this in the conventional osC manner, by going into the osC Admin and clicking on Catalog and editing each product. Once you edit a product you will see a field for each customer group you created. Enter the discounted pricing you desire in each field.

 

This shows a different price to each customer group. If you want to hide the product altogether from some customer groups, you need an extra add-on as well as SPPC: "Hide products from customer groups for SPPC"

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Thank you very much about your advices they are very helpfull to a newby like me.The best of them was this on with the winmerge.

What a tool... It reminds me an axplorer that was alive somewhere in '95.He was finding also the doubles etc.

Now i have another one question :Does the SPPC is sending an email verification for the account or do i have to install another module?

This module is capable to not leave a customer see the prices if is not been veryfied?

And for the last another one.

I have made all the changes that i want until now and because of a problem with login i took the discision to delete the .htpassword and htaccess from admin directory.Now i always take the message in the admin panel:

 

Additional Protection With htaccess/htpasswd

This osCommerce Online Merchant Administration Tool installation is not additionally secured through htaccess/htpasswd means.

 

The following files need to be writable by the web server to enable the htaccess/htpasswd security layer:

•/home/mydomain/public_html/Estore/admin/.htaccess

•/home/mydomain/public_html/Estore/admin/.htpasswd_oscommerce

 

Reload this page to confirm if the correct file permissions have been set.

 

 

Is there a way to fix it?

Edited by apolyshow

One amateur made the Arc, 5.000 pro made the Titanic...

Link to comment
Share on other sites

Thank you very much about your advices they are very helpfull to a newby like me.The best of them was this on with the winmerge.

What a tool... It reminds me an axplorer that was alive somewhere in '95.He was finding also the doubles etc.

Now i have another one question :Does the SPPC is sending an email verification for the account or do i have to install another module?

This module is capable to not leave a customer see the prices if is not been veryfied?

And for the last another one.

I have made all the changes that i want until now and because of a problem with login i took the discision to delete the .htpassword and htaccess from admin directory.Now i always take the message in the admin panel:

 

Additional Protection With htaccess/htpasswd

This osCommerce Online Merchant Administration Tool installation is not additionally secured through htaccess/htpasswd means.

 

The following files need to be writable by the web server to enable the htaccess/htpasswd security layer:

•/home/mydomain/public_html/Estore/admin/.htaccess

•/home/mydomain/public_html/Estore/admin/.htpasswd_oscommerce

 

Reload this page to confirm if the correct file permissions have been set.

 

 

Is there a way to fix it?

To fix it you need to put back the files you deleted ;)

 

In all seriousness, this is an essential security measure.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Hi!

 

Do somebody know how can I prevent linked products showing in products_new.php when using also contribution "Hide products from customer groups for SPPC"? The problem seems to be related to changed queries of that contribution. Problem may occur in other listings too(specials, reviews).

So it don't look nice when same product is multiple times in those pages...:)

Link to comment
Share on other sites

Hi!

 

Do somebody know how can I prevent linked products showing in products_new.php when using also contribution "Hide products from customer groups for SPPC"? The problem seems to be related to changed queries of that contribution. Problem may occur in other listings too(specials, reviews).

So it don't look nice when same product is multiple times in those pages...:)

 

My guess would be it's a problem with the implementation of the add-on you're using to link products rather than the Hide Products changes, which only add a couple of ...and find in set... clauses to the end of the select. I don't see how this would make anything appear twice, but if you post the query I'll have a look.

 

If it occurs in specials it's definitely not a problem with Hide Products, which doesn't change the specials processing.

Edited by JohnAtYM

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

My guess would be it's a problem with the implementation of the add-on you're using to link products rather than the Hide Products changes, which only add a couple of ...and find in set... clauses to the end of the select. I don't see how this would make anything appear twice, but if you post the query I'll have a look.

 

If it occurs in specials it's definitely not a problem with Hide Products, which doesn't change the specials processing.

 

 

Thanks,there can be something wrong with the implementation but I can't figure out what it is. Otherwise it works fine.

 

 

Here is my slightly altered query:

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' and p.products_id = pd.products_id and TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < '" . NEW_PRODUCT_DAYS . "' and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";

 

 

Here under is the basic query from "Hide products from customer groups for SPPC"?

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";

 

Both of these queries return multiple linked products for me in the New products page.

 

But if i use the basic query for SPPC it works perfectly in that respect. Ofcourse hiding doesn't work then.

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

$products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

Link to comment
Share on other sites

Thanks,there can be something wrong with the implementation but I can't figure out what it is. Otherwise it works fine.

 

 

Here is my slightly altered query:

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' and p.products_id = pd.products_id and TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < '" . NEW_PRODUCT_DAYS . "' and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";

 

 

Here under is the basic query from "Hide products from customer groups for SPPC"?

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";

 

Both of these queries return multiple linked products for me in the New products page.

 

But if i use the basic query for SPPC it works perfectly in that respect. Ofcourse hiding doesn't work then.

 

$products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

$products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 

I think you found a bug in Hide Products; I've just reproduced it on a 2.3.1 installation. I surmise that you have products that you've linked to additional categories and that's why they appear more than once; whether they're linked to other products or not is irrelevant. If you're not hiding a whole category from your users then you can simply omit the two clauses in the query that refer to categories, so it ends up like this:

 

 $products_new_query_raw = "select  p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < '" . NEW_PRODUCT_DAYS . "' and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";

 

Caveat: I haven't actually tested that, so make sure you do properly. If you do need the hide categories processing, you'll have to wait until I've figured out how to add 'distinct' to the query without breaking the page split functionality.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...