Jump to content
Pronux

Simply Hide Products (SHP)

Recommended Posts

I think you are right. SHP stores all hidden articles in $_SESSION['hidden_products']. If you are hiding hundreds of articles it becomes to large for the session variable. Sorry, but I don't see a solution for this problem right now.

Thank you for your quick answer. I think, if I devide $_SESSION['hidden_products'] to more sessions (e.g. $_SESSION['hidden_products_1'], $_SESSION['hidden_products_2'], ...) it would be work correctly.

 

What do you think?

Share this post


Link to post
Share on other sites

Thank you for your quick answer. I think, if I devide $_SESSION['hidden_products'] to more sessions (e.g. $_SESSION['hidden_products_1'], $_SESSION['hidden_products_2'], ...) it would be work correctly.

 

What do you think?

 

It could work, but since SHP alters all categories/products related SQL queries (see /includes/functions/database.php) I don't recommend it, because it could make the SQL-queries in your shop too big. I recommend you to use another contribution which is better for your shop.


Specialist in end-to-end integration between osCommerce and Microsoft Dynamics NAV ERP System

About Pronux | Pronux Contributions and Add-Ons

Share this post


Link to post
Share on other sites

It could work, but since SHP alters all categories/products related SQL queries (see /includes/functions/database.php) I don't recommend it, because it could make the SQL-queries in your shop too big. I recommend you to use another contribution which is better for your shop.

Thank you, Pronux.

Can you recommend me any contribution for my shop?

Share this post


Link to post
Share on other sites

Hi,

 

This seems to be a bug which occurs only if you hide categories but no products. Please try the following fix:

 

Open file catalog/includes/functions/general.php, go to function tep_set_hidden_products and add near line 1400 the code:

 

else
{
  $has_hidden_categories = true;			
}

before:

 

//find hidden categories and also all products in there	
if($has_hidden_categories)
{

after it should look like:

 

else
{
  $has_hidden_categories = true;			
}

//find hidden categories and also all products in there	
if($has_hidden_categories)
{

Does this fix your problem ?

Share this post


Link to post
Share on other sites

Hi, I love this add-on. I am using several others, so I have manually added this to my code. I read about this line of code solving and issue in general.php (catalog)

 

else

{

$has_hidden_categories = true;

}

 

//find hidden categories and also all products in there

 

when I use the above code my customer can only see the first category and none of the subcategories.

If I don't use it they can see all catetories.

 

I would greatly appreciate you help with this.

 

 

Skylark

 

0

Share this post


Link to post
Share on other sites

awesome contrib!

 

i had several contrib installed which it had a conflict and post prior diagnosed it was with the string replace of "where" in /catalog/includes/functions/database.php

 

to fix it i went through several contributes and ensured that "where" on the query was on the same line as the whole query.

 

example//

 

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

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

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

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

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

and p.products_status = '1'

order by sort_order asc limit " . MAX_DISPLAY_XSELL);

 

had to be changed to

 

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

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

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

left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "'

and p.products_status = '1'

order by sort_order asc limit " . MAX_DISPLAY_XSELL);

 

 

MOVED the where up a line.

 

i hope this helps people as i spent 2 hours figuring it out! not a pro coder :(

Share this post


Link to post
Share on other sites

This is a great contribution! I need something more specific.

 

Is it possible to hide a certain product by a user's:

 

1) zip code (USA)

2) by IP address (USA)

 

My store is in the USA and a couple of products are restricted in certain states.

 

Is there a way I can hide the restricted products based on a user's IP address? Or when they order and fill out their shipping address, is there a way to check the zip code and then notify customer that the product is not available to their state?

 

Thanks in advance!

Edited by birdrockdesigns

Share this post


Link to post
Share on other sites

I've got a fresh install of OSC 2.3.1 and loaded the SHP files and instantly received:

Fatal error: Call to undefined function: tep_get_version() in /usr/local/pem/vhosts/208061/webspace/httpdocs/catalog/admin/includes/header.php on line 20

 

I tried some of the suggestions in this thread, and they certainly changed things, but I can't seem to fix whatever it is I need to fix. Anyone knows what I need to add/change to fix this?

 

Thanks

Share this post


Link to post
Share on other sites

Add the function to /catalog/admin/includes/functions/general.php

 

////
// Get the installed version number
 function tep_get_version() {
   static $v;

   if (!isset($v)) {
     $v = trim(implode('', file(DIR_FS_CATALOG . 'includes/version.php')));
   }

   return $v;
 }


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

Add the function to /catalog/admin/includes/functions/general.php

 

////
// Get the installed version number
 function tep_get_version() {
   static $v;

   if (!isset($v)) {
     $v = trim(implode('', file(DIR_FS_CATALOG . 'includes/version.php')));
   }

   return $v;
 }

 

Well, I got things working a bit better - but there is still one problem - my categories/products page is a bit wonky - I took a screen capture of it - maybe you can help:

5444209092_8975c9906d.jpg

 

i never know what size to make those things - i hope you can see the problem with the links on the left, have I done something bizzare?

 

Thanks for your help

Share this post


Link to post
Share on other sites

I recently added code that restricts use of the "contact me" form to only those customers with registered accounts. I now need to modify the text on my store's home page, removing the last line that says "If you believe you have reached this page in error, please contact me".

 

It's been several months since I initially added SHP, but if I recall correctly, there is some code somewhere that specifies a different "welcome" message than the TEXT_MAIN, and I cannot for the life of me remember where SHP's message is stored!! It's not in includes/languages/english/index.php, and I remember removing the TEXT_MAIN content when I added SHP, so I know it's out there somewhere.

 

Can anyone help remind me where SHP's welcome message text is stored? (On this site, SHP's message is everything from "Only clients of..." down.)

 

Thanks!!

- Jason

Share this post


Link to post
Share on other sites

Hi.

 

I building a script that sort products with diffrent sizes under a main product.

 

Ex.

1234 Shoe Model (main)

1234-10 Shoe Model Size 10

1234-11 Shoe Model Size 11

1234-12 Shoe Model Size 12

 

Using your script, and it works great except that hidden product cant be added to cart.

How do i change so that the product is hidden but can be added to cart?

Share this post


Link to post
Share on other sites

Im looking for a contribution that hides product or categories unless logged in. Is this the right one to use? I dont want to have to assign each customer to see the catergory. Thanks for any help :)

Share this post


Link to post
Share on other sites

HI pronux and thank you very much for your contribution.

I'm trying to install it on my web site which runs with 2.3.3 but I cannot find in catalog/admin/categories.php this part of code

while (list($key, $value) = each($HTTP_POST_VARS)) {
if (!is_array($HTTP_POST_VARS[$key])) {
echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
}

 

what can I do?

thank you very much

Riccardo

Edited by rikic

Share this post


Link to post
Share on other sites

hi pronux and thank you very much for your contribution.

I'm trying to install it on my website which runs with 2.3.3 but in catalog/admin/categories.php I cannot find this part of code:

while (list($key, $value) = each($HTTP_POST_VARS)) {
if (!is_array($HTTP_POST_VARS[$key])) {
echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
}

 

what can i do?

thank y ou very much.

riccardo

Edited by rikic

Share this post


Link to post
Share on other sites

Hello!

 

This is great I'm hoping to use it as a way of allowing me to limit categories for customers on my mobile site. I have installed on my main site (2.3.3) however everytime I press the Continue button or try to access the index page I get errors like:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where p.products_id not in(69, 54, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 5' at line 22

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 join products_description pd on pd.products_id = p.products_id join specials s on s.products_id = p.products_id where p.products_status = '1' and pd.language_id = '1' and s.status = '1' order by RAND() limit 6 where p.products_id not in(69, 54, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 31, 39, 35, 36, 37, 38, 624, 625, 623, 622, 145, 87,

 

Trying to access the index.php page:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where p.products_id not in(69, 54, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 5' at line 22[/b]

[b]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 join products_description pd on pd.products_id = p.products_id join specials s on s.products_id = p.products_id where p.products_status = '1' and pd.language_id = '1' and s.status = '1' order by RAND() limit 6 where p.products_id not in(69, 54, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 31, 39, 35, 36, 37, 38, 624, 625, 623, 622, 145, 87, 70, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,

 

I've made it so that I am the only customer to access certain categories and have pinned the problem down to being in the database.php file here it is:

 

<?php
/*
 $Id$
 adapted for Separate Pricing Per Customer 2005/03/04

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

 Copyright (c) 2007 osCommerce

 Released under the GNU General Public License
*/

 function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {
   global $$link;

   if (USE_PCONNECT == 'true') {
     $$link = mysql_pconnect($server, $username, $password);
   } else {
     $$link = mysql_connect($server, $username, $password);
   }

   if ($$link) mysql_select_db($database);

   return $$link;
 }

 function tep_db_close($link = 'db_link') {
   global $$link;

   return mysql_close($$link);
 }

 function tep_db_error($query, $errno, $error) { 
   die('<font color="#000000"><strong>' . $errno . ' - ' . $error . '<br /><br />' . $query . '<br /><br /><small><font color="#ff0000">[TEP STOP]</font></small><br /><br /></strong></font>');
 }

 function tep_db_query($query, $link = 'db_link') {
   global $$link;

   if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
     error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
   }

    //START SHP
   if(!empty($_SESSION['hidden_products']) && stristr($query, ' '.TABLE_PRODUCTS.' ') && !strstr($query, ' shp.products_id '))
   {
    if(strlen($_SESSION['hidden_products']) > 1)
    {     
   $prefix = "";
   if(stristr($query, " ".TABLE_PRODUCTS." p"))
   {
   $prefix = "p.";
   }

   $shp = " where ".$prefix."products_id not in(".mysql_real_escape_string($_SESSION['hidden_products']).")";

      if(substr($query, 0, 8) == 'describe')
{
  //do not modify query
}
else if(substr($query, 0, 8) == 'describe')
{
       //do not modify query
}
else if(stristr($query, " where "))
   {
   $query = str_ireplace(" where ", $shp." and ", $query);
   }
    else if(stristr($query, " GROUP BY "))
   {
   $query = str_ireplace(" GROUP BY ", $shp." GROUP BY ", $query);
   }
    else if(stristr($query, " ORDER BY "))
   {
   $query = str_ireplace(" ORDER BY ", $shp." ORDER BY ", $query);
   }      
   else
   {
   $query .=  $shp;
   }
    }              
   }

   if(!empty($_SESSION['hidden_categories']) && stristr($query, ' '.TABLE_CATEGORIES.' ') && !strstr($query, ' shp.categories_id '))
   {
    if(strlen($_SESSION['hidden_categories']) > 1)
    {     
   $prefix = "";
   if(stristr($query, " ".TABLE_CATEGORIES." c"))
   {
   $prefix = "c.";
   }

   $shp = " where ".$prefix."categories_id not in(".mysql_real_escape_string($_SESSION['hidden_categories']).")";

      if(substr($query, 0, 8) == 'describe')
{
  //do not modify query
}
else if(substr($query, 0, 8) == 'describe')
{
       //do not modify query
}
else if(stristr($query, " where "))
   {
   $query = str_ireplace(" where ", $shp." and ", $query);
   }
   else if(stristr($query, " GROUP BY "))
   {
   $query = str_ireplace(" GROUP BY ", $shp." GROUP BY ", $query);
   }
    else if(stristr($query, " ORDER BY "))
   {
   $query = str_ireplace(" ORDER BY ", $shp." ORDER BY ", $query);
   }      
   else
   {
   $query .=  $shp;
   }
    }              
   }
   //END SHP

   $result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

   if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
      $result_error = mysql_error();
      error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
   }

   return $result;
 }

 function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {
   reset($data);
   if ($action == 'insert') {
     $query = 'insert into ' . $table . ' (';
     while (list($columns, ) = each($data)) {
       $query .= $columns . ', ';
     }
     $query = substr($query, 0, -2) . ') values (';
     reset($data);
     while (list(, $value) = each($data)) {
       switch ((string)$value) {
         case 'now()':
           $query .= 'now(), ';
           break;
         case 'null':
           $query .= 'null, ';
           break;
         default:
           $query .= '\'' . tep_db_input($value) . '\', ';
           break;
       }
     }
     $query = substr($query, 0, -2) . ')';
   } elseif ($action == 'update') {
     $query = 'update ' . $table . ' set ';
     while (list($columns, $value) = each($data)) {
       switch ((string)$value) {
         case 'now()':
           $query .= $columns . ' = now(), ';
           break;
         case 'null':
           $query .= $columns .= ' = null, ';
           break;
         default:
           $query .= $columns . ' = \'' . tep_db_input($value) . '\', ';
           break;
       }
     }
     $query = substr($query, 0, -2) . ' where ' . $parameters;
   }

   return tep_db_query($query, $link);
 }

 function tep_db_fetch_array($db_query) {
   return mysql_fetch_array($db_query, MYSQL_ASSOC);
 }

 function tep_db_num_rows($db_query) {
   return mysql_num_rows($db_query);
 }

 function tep_db_data_seek($db_query, $row_number) {
   return mysql_data_seek($db_query, $row_number);
 }

 function tep_db_insert_id($link = 'db_link') {
   global $$link;

   return mysql_insert_id($$link);
 }

 function tep_db_free_result($db_query) {
   return mysql_free_result($db_query);
 }

 function tep_db_fetch_fields($db_query) {
   return mysql_fetch_field($db_query);
 }

 function tep_db_output($string) {
   return htmlspecialchars($string);
 }

 function tep_db_input($string, $link = 'db_link') {
   global $$link;

   if (function_exists('mysql_real_escape_string')) {
     return mysql_real_escape_string($string, $$link);
   } elseif (function_exists('mysql_escape_string')) {
     return mysql_escape_string($string);
   }

   return addslashes($string);
 }

 function tep_db_prepare_input($string) {
   if (is_string($string)) {
     return trim(tep_sanitize_string(stripslashes($string)));
   } elseif (is_array($string)) {
     reset($string);
     while (list($key, $value) = each($string)) {
       $string[$key] = tep_db_prepare_input($value);
     }
     return $string;
   } else {
     return $string;
   }
 }
// BOF Separate Pricing Per Customer, adapted from sample code in user comments on
 // http://www.php.net/manual/en/function.mysql-list-tables.php
 // Wrap DB_DATABASE with Back Ticks, Fixes Hyphens in Database Name, code from
 // Jef Stumpf/Krumbsnatcher: http://forums.oscommerce.com/index.php?showtopic=53436&view=findpost&p=563454
 function tep_db_table_exists($table, $link = 'db_link') {
$result = tep_db_query("show table status from `" . DB_DATABASE . "`");
while ($list_tables = tep_db_fetch_array($result)) {
  if ($list_tables['Name'] == $table) {
  return true;
  }
}
return false;
 }

 function tep_db_check_age_specials_retail_table() {
$result = tep_db_query("show table status from `" . DB_DATABASE . "`");
$last_update_table_specials = "2000-01-01 12:00:00";
$table_srp_exists = false;
while ($list_tables = tep_db_fetch_array($result)) {
if ($list_tables['Name'] == TABLE_SPECIALS_RETAIL_PRICES) {
  $table_srp_exists = true;
  $last_update_table_srp = $list_tables['Update_time'];
}
  if ($list_tables['Name'] == TABLE_SPECIALS) {
  $last_update_table_specials = $list_tables['Update_time'];
  }
} // end while

if(!$table_srp_exists || ($last_update_table_specials > $last_update_table_srp)) {
   if ($table_srp_exists) {
   $query1 = "truncate " . TABLE_SPECIALS_RETAIL_PRICES . "";
   if (tep_db_query($query1)) {
$query2 = "insert into " . TABLE_SPECIALS_RETAIL_PRICES . " select s.products_id, s.specials_new_products_price, s.status, s.customers_group_id from " . TABLE_SPECIALS . " s where s.customers_group_id = '0'";
$result =  tep_db_query($query2);
}
   } else { // table specials_retail_prices does not exist
   $query1 = "create table " . TABLE_SPECIALS_RETAIL_PRICES . " (products_id int NOT NULL default '0', specials_new_products_price decimal(15,4) NOT NULL default '0.0000', status tinyint, customers_group_id smallint, primary key (products_id) )" ;
   $query2 = "insert into " . TABLE_SPECIALS_RETAIL_PRICES . " select s.products_id, s.specials_new_products_price, s.status, s.customers_group_id from " . TABLE_SPECIALS . " s where s.customers_group_id = '0'";
   if( tep_db_query($query1) && tep_db_query($query2) ) {
; // execution succesfull
}
} // end else
} // end if(!$table_srp_exists || ($last_update_table_specials....
}

 function tep_db_check_age_products_group_prices_cg_table($customer_group_id) {
$result = tep_db_query("show table status from `" . DB_DATABASE . "`");
$last_update_table_pgp = strtotime('2000-01-01 12:00:00');
$table_pgp_exists = false;
while ($list_tables = tep_db_fetch_array($result)) {
if ($list_tables['Name'] == TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id) {
$table_pgp_exists = true;
$last_update_table_pgp = strtotime($list_tables['Update_time']);
} elseif ($list_tables['Name'] == TABLE_SPECIALS ) {
$last_update_table_specials = strtotime($list_tables['Update_time']);
} elseif ($list_tables['Name'] == TABLE_PRODUCTS ) {
$last_update_table_products = strtotime($list_tables['Update_time']);
} elseif ($list_tables['Name'] == TABLE_PRODUCTS_GROUPS ) {
$last_update_table_products_groups = strtotime($list_tables['Update_time']);
}
} // end while

   if ($table_pgp_exists == false) {
     $create_table_sql = "create table " . TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id . " (products_id int NOT NULL default '0', products_price decimal(15,4) NOT NULL default '0.0000', specials_new_products_price decimal(15,4) default NULL, status tinyint, primary key (products_id) )" ;
     $fill_table_sql1 = "insert into " . TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id ." select p.products_id, p.products_price, NULL as specials_new_products_price, NULL as status FROM " . TABLE_PRODUCTS . " p";
     $update_table_sql1 = "update " . TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id ." ppt left join " . TABLE_PRODUCTS_GROUPS . " pg using(products_id) set ppt.products_price = pg.customers_group_price where ppt.products_id = pg.products_id and pg.customers_group_id ='" . $customer_group_id . "'";
     $update_table_sql2 = "update " . TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id ." ppt left join " . TABLE_SPECIALS . " s using(products_id) set ppt.specials_new_products_price = s.specials_new_products_price, ppt.status = s.status where ppt.products_id = s.products_id and s.customers_group_id = '" . $customer_group_id . "'";
if ( tep_db_query($create_table_sql) && tep_db_query($fill_table_sql1) && tep_db_query($update_table_sql1) && tep_db_query($update_table_sql2) ) {
return true;
}
} // end if ($table_pgp_exists == false)

if ( ($last_update_table_pgp < $last_update_table_products && (time() - $last_update_table_products > (int)MAXIMUM_DELAY_UPDATE_PG_PRICES_TABLE * 60) ) || $last_update_table_specials > $last_update_table_pgp || $last_update_table_products_groups > $last_update_table_pgp ) { // then the table should be updated
     $empty_query = "truncate " . TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id . "";
     $fill_table_sql1 = "insert into " . TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id ." select p.products_id, p.products_price, NULL as specials_new_products_price, NULL as status FROM " . TABLE_PRODUCTS . " p";
     $update_table_sql1 = "update " . TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id ." ppt left join " . TABLE_PRODUCTS_GROUPS . " pg using(products_id) set ppt.products_price = pg.customers_group_price where ppt.products_id = pg.products_id and pg.customers_group_id ='" . $customer_group_id . "'";
     $update_table_sql2 = "update " . TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id ." ppt left join " . TABLE_SPECIALS . " s using(products_id) set ppt.specials_new_products_price = s.specials_new_products_price, ppt.status = s.status where ppt.products_id = s.products_id and s.customers_group_id = '" . $customer_group_id . "'";
     if ( tep_db_query($empty_query) && tep_db_query($fill_table_sql1) && tep_db_query($update_table_sql1) && tep_db_query($update_table_sql2) ) {
    return true;
     }
} else { // no need to update
return true;
} // end checking for update

 }

// EOF Separate Pricing Per Customer
?>

 

Can you point me in the right direction please. Not a coder!

 

Lorraine

Share this post


Link to post
Share on other sites

I've decided after further playing around that the error is something to with the queries in index.php

 

The error only happens when I select a customer to allow categories for. The error is:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where p.products_id not in(1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118,' at line 22

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 join products_description pd on pd.products_id = p.products_id join specials s on s.products_id = p.products_id where p.products_status = '1' and pd.language_id = '1' and s.status = '1' order by RAND() limit 6 where p.products_id not in(1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, 1154, 1155, 1158, 1160, 1161)

[color="#ff0000"][TEP STOP]

[/color]

Could someone possible look at my index.php and possibly point out any issues? I've tried working through various fixes. Using 2.3.3

 

Thanks!

 

<?php
/*
 $Id$
 adapted for Separate Pricing per Customer 2007/06/24, Hide products and categories from groups 2008/08/03

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

 Copyright (c) 2010 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 . "'");
   $categories_products = tep_db_fetch_array($categories_products_query);
   if ($categories_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);

 require(DIR_WS_INCLUDES . 'template_top.php');

 if ($category_depth == 'nested') {
// BOF SPPC Hide categories from groups
   $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 . "' and find_in_set('".$customer_group_id."', categories_hide_from_groups) = 0");
// EOF SPPC Hide categories from groups
   $category = tep_db_fetch_array($category_query);
?>

<h1><?php echo $category['categories_name']; ?></h1>

<div class="contentContainer">
 <div class="contentText">
   <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++) {
// BOF SPPC Hide categories from groups
       $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 . "' and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0");
       $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 . "' and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 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 . "' and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by sort_order, cd.categories_name");
   }
// EOF SPPC Hide categories from groups

   $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>

   <br />

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

 </div>
</div>

<?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'])) && (preg_match('/^[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) { // changed for SPPC hide categories -- ok in mysql 5
$listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 90)) as products_description, 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 left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id), " . TABLE_MANUFACTURERS . " m 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 and 
// SPPC hide categories for groups
$listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 90)) as products_description, 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 left join " . TABLE_CATEGORIES . " c using(categories_id) 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) {
       $listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 90)) as products_description, 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) left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c using(categories_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 & SPPC hide categories
       $listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 90)) as products_description, 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 left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c using(categories_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, SPPC hide categories for groups added
       $listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 90)) as products_description, 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 left join " . TABLE_CATEGORIES . " c using(categories_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 . "'"; 
       } else { // either retail or no need to get correct special prices -- ok for mysql 5
// SPPC hide categories for groups added
       $listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 90)) as products_description, 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) left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_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) { // ok in mysql 5
// SPPC hide categories for groups added
       $listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 90)) as products_description, 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 left join " . TABLE_CATEGORIES . " c using(categories_id) 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
// SPPC hide categories for groups added
       $listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 90)) as products_description, 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 left join " . TABLE_CATEGORIES . " c using(categories_id) 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
     }
   }
// BOF SPPC Hide products and categories from groups
$listing_sql .= " and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 ";
$listing_sql .= " and find_in_set('" . $customer_group_id . "', c.categories_hide_from_groups) = 0 ";
// EOF SPPC Hide products and categories from groups

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!preg_match('/^[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;
     }
   }

   $catname = HEADING_TITLE;
   if (isset($HTTP_GET_VARS['manufacturers_id'])) {
     $image = tep_db_query("select manufacturers_image, manufacturers_name as catname from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
     $image = tep_db_fetch_array($image);
     $catname = $image['catname'];
   } elseif ($current_category_id) {
     $image = tep_db_query("select c.categories_image, cd.categories_name as catname from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
     $image = tep_db_fetch_array($image);
     $catname = $image['catname'];
   }
?>

<h1><?php echo $catname; ?></h1>

<div class="contentContainer">

<?php
// optional Product List Filter
// BOF SPPC Hide products and categories from groups
   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 find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 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 left join " . TABLE_CATEGORIES . " using(categories_id), " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 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";
     }
// EOF SPPC Hide products and categories from groups
     $filterlist_query = tep_db_query($filterlist_sql);
     if (tep_db_num_rows($filterlist_query) > 1) {
       echo '<div>' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . '<p align="right">' . 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() . '</p></form></div>' . "\n";
     }
   }

   include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);
?>

</div>

<?php
 } else { // default page
// Start Modular Front Page
?>

<div class="contentContainer">

<?php echo $oscTemplate->getBlocks('front_page'); ?>

</div>

<?php
 // End Modular Front Page
?>

<?php
 }

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

Share this post


Link to post
Share on other sites

The problem is that you have two where clauses in your SQL:

 

where p.products_status = '1' and pd.language_id = '1' and s.status = '1' order by RAND() limit 6

where p.products_id not in(1110, .... )

 

That needs to be

 

where p.products_status = '1' and pd.language_id = '1' and s.status = '1' and p.products_id not in(1110, .... ) order by RAND() limit 6

 

 

I can't find that in the code that you posted. It's probably somewhere in the SPPC changes; possibly a conflict with something else that you've added.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

hi Lorraine,

I have the same problem.

the problem (but I don't have the solution.... :( ) is in includes/functions/general.php in part part of code:

//Simply Hide Products (SHP)
function tep_set_hidden_products($force_recheck = false){	   
$recheck_time_seconds = 100;	
if(!isset($_SESSION['hidden_products_timestamp']) || !isset($_SESSION['hidden_products'])) {
   $force_recheck = true;
   }
if($force_recheck || $_SESSION['hidden_products_timestamp'] < time()) {			
if(!$force_recheck) {
 $check_query = tep_db_query("SELECT unixtime FROM hidden_products WHERE unixtime > ".((int)$_SESSION['hidden_products_timestamp'] - $recheck_time_seconds));
 if (tep_db_num_rows($check_query) == 0) {
 $_SESSION['hidden_products_timestamp'] = time() + $recheck_time_seconds;			 
return;
} else if (USE_CACHE == 'true') {
if ($dir = @opendir(DIR_FS_CACHE)) {
 while ($cache_file = readdir($dir)) {
if (stristr($cache_file, 'categories_box-')) {
 @unlink(DIR_FS_CACHE . $cache_file);				   
 }
}			
closedir($dir);
   }
   }   
 }			 
 $hidden_products_timestamp = time() + $recheck_time_seconds;
 if(!tep_session_is_registered('hidden_products') || !tep_session_is_registered('hidden_categories') || !tep_session_is_registered('hidden_products_timestamp')) {
  tep_session_register('hidden_products');
  tep_session_register('hidden_categories'); 
  tep_session_register('hidden_products_timestamp');
   }   
//find hidden products
   if(isset($_SESSION['customer_id']) && !empty($_SESSION['customer_id'])) {	
   $shp_cust_where = " WHERE products_id NOT IN (SELECT products_id FROM hidden_products WHERE customers_id = '" . (int) $_SESSION['customer_id']."')";   
   $shp_cat_where  = " AND categories_id NOT IN (SELECT categories_id FROM hidden_products WHERE customers_id = '" . (int) $_SESSION['customer_id']."')";
   }	  
   $check_query    = tep_db_query("SELECT DISTINCT products_id FROM hidden_products ".$shp_cust_where);
   $has_hidden_categories  = false;
   $hidden_categories   = "0";
   $hidden_products   = "0";	  
if (tep_db_num_rows($check_query) > 0) {  
 while($h_prods = tep_db_fetch_array($check_query)) {					   
  if($h_prods['products_id'] == '0') {  
   $has_hidden_categories = true;
    continue;
   } 
 $hidden_products .= $h_prods['products_id'].', ';						   
 }				
 if($hidden_products != "0") {
 if(substr($hidden_products, 0, 1) == '0') {
 $hidden_products = substr($hidden_products, 1);
   }   
 $hidden_products = substr($hidden_products, 0, -2);					   
//find hidden categories			   
$check_cats_query = tep_db_query("SELECT DISTINCT shp.categories_id FROM ".TABLE_CATEGORIES." shp WHERE shp.categories_id > 0 AND shp.categories_id NOT IN (SELECT categories_id FROM ".TABLE_PRODUCTS_TO_CATEGORIES." WHERE products_id NOT IN (".$hidden_products.")) AND shp.categories_id IN (SELECT categories_id FROM ".TABLE_PRODUCTS_TO_CATEGORIES.")");		   
if (tep_db_num_rows($check_cats_query) > 0) {		 
while($h_cats = tep_db_fetch_array($check_cats_query)) {		  
 $hidden_categories .= $h_cats['categories_id'].", ";		  
  }
 $hidden_categories  = substr($hidden_categories, 1, -2);						
 }
  }										
}  
//find hidden categories and also all products in there
if($has_hidden_categories){		
$check_query = tep_db_query("SELECT DISTINCT shp.categories_id FROM hidden_products shp WHERE shp.categories_id > 0 ".$shp_cat_where);
$all_categories_temp = ""; 
while(tep_db_num_rows($check_query) > 0) {
  $hidden_categories_temp = "";   
 while($h_prods = tep_db_fetch_array($check_query)) {						
   $hidden_categories_temp .= $h_prods['categories_id'].", ";						   
    }
 $all_categories_temp .= $hidden_categories_temp;																								
$check_query = tep_db_query("SELECT DISTINCT shp.categories_id FROM ".TABLE_CATEGORIES." shp WHERE shp.parent_id IN (".substr($hidden_categories_temp, 0, -2).")"); 
  } 
if($all_categories_temp != "") {
 $all_categories_temp = substr($all_categories_temp, 0, -2); 
if($hidden_categories == '0') {
 $hidden_categories  = $all_categories_temp;
} else {
 $hidden_categories .= ", ".$all_categories_temp;
 }  
$check_query = tep_db_query("SELECT DISTINCT shp.products_id FROM ".TABLE_PRODUCTS." shp WHERE shp.products_id NOT IN (".$hidden_products.") AND shp.products_status = '1' AND shp.products_id IN (SELECT products_id FROM ".TABLE_PRODUCTS_TO_CATEGORIES." WHERE categories_id IN (".$all_categories_temp."))");		   
if (tep_db_num_rows($check_query) > 0){	
if($hidden_products != "0") {
 $hidden_products .= ", ";
} else {
 $hidden_products = "";
}	  
while($h_prods = tep_db_fetch_array($check_query)) {								
 $hidden_products .= $h_prods['products_id'].", ";						   
 }
 $hidden_products = substr($hidden_products, 0, -2);					 
  }		   
 }	
}
$_SESSION['hidden_products'] = $hidden_products; 
$_SESSION['hidden_categories']  = $hidden_categories; 
$_SESSION['hidden_products_timestamp'] = $hidden_products_timestamp;   
}	 
}

 

where in this 2 queries appears two times the clauses where

 

$check_cats_query = tep_db_query("SELECT DISTINCT shp.categories_id FROM ".TABLE_CATEGORIES." shp WHERE shp.categories_id > 0 AND shp.categories_id NOT IN (SELECT categories_id FROM ".TABLE_PRODUCTS_TO_CATEGORIES." WHERE products_id NOT IN (".$hidden_products.")) AND shp.categories_id IN (SELECT categories_id FROM ".TABLE_PRODUCTS_TO_CATEGORIES.")");

 

$check_query = tep_db_query("SELECT DISTINCT shp.products_id FROM ".TABLE_PRODUCTS." shp WHERE shp.products_id NOT IN (".$hidden_products.") AND shp.products_status = '1' AND shp.products_id IN (SELECT products_id FROM ".TABLE_PRODUCTS_TO_CATEGORIES." WHERE categories_id IN (".$all_categories_temp."))");

 

I'm not a coder, please tell me if you find how to solve it.

bye

riccardo

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

×