Jump to content
Pronux

Simply Hide Products (SHP)

Recommended Posts

This could be dificult for me.

 

I have 142contributions installed and in any moment this going to blow up. When I install a new contrib other 2 or 3 begins to fault.

 

Im a semi-coder not programer.

 

Where do you thing the querie error are?? On what archive???

 

application_top.php

cache.php

database.php

split_page_results.php

Share this post


Link to post
Share on other sites

Also the index.php archive.

 

I look this:

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

 

application_top.php

      // custom product builder add to cart from builder_info page
     case 'add_build' :      if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                               if ($_POST['uncloaked_build'] == '0') {
                                 tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '1' where products_id = '" . $_POST['products_id'] . "' and products_quantity > '" . $cart->get_quantity(tep_get_uprid($_POST['products_id'],$_POST['id'])) . "'");
                               }
                               $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                               if ($_POST['disable_build'] == '1' or $_POST['uncloaked_build'] =='0') {
                                 tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . $_POST['products_id'] . "'");
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;

 

// add category names or the manufacturer name to the breadcrumb trail
 if (isset($cPath_array)) {
   for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {
     $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");
     if (tep_db_num_rows($categories_query) > 0) {
       $categories = tep_db_fetch_array($categories_query);
       $breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));
     } else {
       break;
     }
   }
 } elseif (isset($HTTP_GET_VARS['manufacturers_id'])) {
   $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
   if (tep_db_num_rows($manufacturers_query)) {
     $manufacturers = tep_db_fetch_array($manufacturers_query);
     $breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));
   }
 }

// add the products model to the breadcrumb trail
 if (isset($HTTP_GET_VARS['products_id'])) {
   $model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   if (tep_db_num_rows($model_query)) {
     $model = tep_db_fetch_array($model_query);
     $breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
   }
 }

 

cache.php

//! Cache the categories box
// Cache the categories box
 function tep_cache_categories_box($auto_expire = false, $refresh = false) {
   global $cPath, $language, $languages_id, $tree, $cPath_array, $categories_string;

   $cache_output = '';

   if (($refresh == true) || !read_cache($cache_output, 'categories_box-' . $language . '.cache' . $cPath, $auto_expire)) {
     ob_start();
     include(DIR_WS_BOXES . 'categories.php');
     $cache_output = ob_get_contents();
     ob_end_clean();
     write_cache($cache_output, 'categories_box-' . $language . '.cache' . $cPath);
   }

   return $cache_output;
 }

 

 

The 1064 error says ".....describe categories status where categories_id not in(924, 240,...."

 

Loking the database tables there is any column named as "category_status" or "status"

Share this post


Link to post
Share on other sites

Sorry, but I can't see the ".....describe categories status where categories_id not in(924, 240,...." in you code snippet.

 

Please go through each file of your shop and find the query -> use an editor which scans all files for the word "describe".


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
editor which scans all files

 

ok, i will find for it tomorrow.

 

Thanks for your moment Prounx.

 

Im thinking that the problem could be "Custom Computer Creator" or "Custom Product Builder".

These contributions creates "extrange virtual" products in catalog.

Share this post


Link to post
Share on other sites

I've received the following question via mail:

 

---------------------------------------------------------------

Hi here!

 

I would like to know how it would be possible to hide products without an assigned category.

 

I want to hide products from the main store but make them available to those that link directly to them.

 

This would be used for google advertising.

 

Thank you

---------------------------------------------------------------

 

Answer:

Yes, you can hide products without an assigned category. BUT: you must define the customer(s) who can see the products (you have to select this customres in the admin for each product)

So I'm not sure if this is the right contribution for your scenario.


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

You have to find the sql query which causes the error. If you copy it here into this thread I will fix it.

 

Hi Pronux , this contribution is just great. When I tested it I have got the same error:

 

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 categories_id not in(113, 112)' at line 1

Select count(*) as count, parent_id from categories GROUP BY parent_id where categories_id not in(113, 112)

 

Then I found out that I am using category_css menu contribution for STS which is causing problem . If I use category.php instead of category_css.php everything works jus fine. I wonder if there is any way to have my categery_css together with this beautiful contribution. Here is how this file looks like.

 

<?php

/*

$Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<?php

// cssMenu - Begin of configuration //

$cssMenuConfig = array();

$cssMenuConfig['ShowEmptyCategories'] = true;

$cssMenuConfig['includeProducts'] = false; // Should CSSMenu show products

$cssMenuConfig['maxProductsInMenu'] = 8; // Maximum number of products to show in a menu ( stops massive menus being created )

$cssMenuConfig['moreText'] = "More...."; // Maximum number of products to show in a menu ( stops massive menus being created )

$cssMenuConfig['showSubMenu'] = true; // Show category dependent menu

// $cssMenuConfig['idSubMenu'] = array('619', '620'); // Category id for the dependent menu

 

// cssMenu - End of configuration //

 

$categories_subs = array();

$categories_start = array();

 

$categories_subs_query = tep_db_query("select count(*) as count, parent_id from " . TABLE_CATEGORIES . " GROUP BY parent_id");

while($row = tep_db_fetch_array($categories_subs_query)) {

$categories_subs[$row['parent_id']] = $row['count'];

}

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' order by sort_order, cd.categories_name");

while($row = tep_db_fetch_array($categories_query)) {

$categories_start['S_' . $row['categories_id'] . '_' . $row['parent_id'] . '_E'] = $row;

}

 

?>

<script type="text/javascript">

 

//SuckerTree Vertical Menu (Aug 4th, 06)

//By Dynamic Drive: http://www.dynamicdrive.com/style/

 

var menuids=["suckertree1"] //Enter id(s) of SuckerTree UL menus, separated by commas

 

function buildsubmenus(){

for (var i=0; i<menuids.length; i++){

var ultags=document.getElementById(menuids).getElementsByTagName("ul")

for (var t=0; t<ultags.length; t++){

ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"

ultags[t].parentNode.onmouseover=function(){

this.getElementsByTagName("ul")[0].style.display="block"

}

ultags[t].parentNode.onmouseout=function(){

this.getElementsByTagName("ul")[0].style.display="none"

}

}

}

}

 

if (window.addEventListener)

window.addEventListener("load", buildsubmenus, false)

else if (window.attachEvent)

window.attachEvent("onload", buildsubmenus)

 

</script>

<?php

 

 

function PrintProducts( $category_id, $categories_string , $includeul, $languageID)

{

global $cssMenuConfig;

 

$product_path="product_info.php?cPath=".$category_id."&products_id=";

$products_query = tep_db_query("select pc.products_id, pc.categories_id from products_to_categories pc, products p where pc.categories_id = " . $category_id . " and p.products_id = pc.products_id and products_status=1 order by products_price");

 

$productsDisplay=mysql_num_rows( $products_query );

$addMore= false;

 

if ( $includeul && $productsDisplay > 0 ) {

$returnval .= "<ul>";

 

}

 

if ( $productsDisplay > $cssMenuConfig['maxProductsInMenu'] ) {

$productsDisplay=$cssMenuConfig['maxProductsInMenu'];

$addMore= true;

}

 

$count_string = '';

 

if (SHOW_COUNTS == 'true') {

if ($totalitemsincategory > 0) {

$count_string = ' (' . $totalitemsincategory . ')';

}

}

 

$i=0;

while ($i < $productsDisplay) {

$products = tep_db_fetch_array($products_query);

$product_query = tep_db_query("select products_name from products_description where products_id = " . $products['products_id'] . " AND language_id = ".$languageID );

$product = tep_db_fetch_array($product_query);

$returnval .= "<li><a href='".$product_path.$products['products_id']."'>".$product['products_name']."</a></li>\n";

$i++;

}

 

if ( $addMore ) {

$returnval .= "<li><a href='".$categories_string."'>".$cssMenuConfig['moreText']."</a></li>\n";

}

 

if ( $productsDisplay > 0 || !$includeul ) {

$returnval .= "</ul>";

}

 

return $returnval;

}

 

function PrintSubMenus( $parentID, $languageID, $start_path ){

 

global $cssMenuConfig, $categories_subs, $categories_start;

 

$returnval = '';

if (($start_path == '') && ($parentID > 0)) {

$start_path = $parentID;

} else {

if ($parentID > 0) $start_path .= "_" . $parentID;

}

if ($parentID != 0) {

$returnval .= "<ul>";

} else {

$returnval .= "<div class='suckerdiv'>";

$returnval .= "<ul id='suckertree1'>";

}

// $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '".$parentID."' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languageID ."' order by sort_order, cd.categories_name");

$cat_subs = array();

foreach($categories_start as $key => $value) {

if(strstr($key, '_' . $parentID . '_E')) {

$cat_subs[$parentID][] = substr($key, 2, strpos($key, "_", 2) - 2);

}

}

 

// if (!isset($_GET['cPath'])) {

 

foreach ($cat_subs[$parentID] as $v) { //$categories = tep_db_fetch_array($categories_query)

$categories = $categories_start['S_' . $v . '_' . $parentID . '_E'];

 

if ($start_path == "") {

$grouppath = $categories['categories_id'];

} else {

$grouppath = $start_path . "_" . $categories['categories_id'];

}

$cPath_new = 'cPath=' . $grouppath;

$categories_string = tep_href_link(FILENAME_DEFAULT, $cPath_new);

$totalitemsincategory = tep_count_products_in_category($categories['categories_id']);

 

$count_string = '';

 

if ((SHOW_COUNTS == 'true') && ($totalitemsincategory > 0) ){

$count_string = ' (' . $totalitemsincategory . ')';

}

 

if (cssMenu_ShowCategory($cssMenuConfig['ShowEmptyCategories'], $totalitemsincategory)) {

$returnval .= "<li><a href='".$categories_string."'>".$categories['categories_name'].$count_string."</a>\n";

}

 

if (array_key_exists($categories['categories_id'], $categories_subs)) { //tep_has_category_subcategories($categories['categories_id'])

$returnval .= PrintSubMenus( $categories['categories_id'], $languageID, $start_path );

if ( $cssMenuConfig['includeProducts'] ) {

$returnval .= PrintProducts($categories['categories_id'],$categories_string, false, $languageID);

}

} else {

if ( $cssMenuConfig['includeProducts'] ) {

$returnval .= PrintProducts($categories['categories_id'],$categories_string, true, $languageID);

}

}

if (cssMenu_ShowCategory($cssMenuConfig['ShowEmptyCategories'], $totalitemsincategory)) {

$returnval .= "</li>";

}

}

// }

if ( !$cssMenuConfig['includeProducts'] ) {

$returnval .= "</ul>";

}

if ($parentID == 0) $returnval .= "</div>";

return $returnval;

}

 

function cssMenu_ShowCategory( $switch, $products) {

if ( $switch == 1 ) {

return true;

} else {

if ($products > 0) {

return true;

} else {

return false;

}

}

}

?>

<!-- categories //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 

new infoBoxHeading($info_box_contents, true, false);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => PrintSubMenus( 0, $languages_id, '' ));

 

 

new infoBox($info_box_contents);

 

?>

</td>

</tr>

<!-- MenuConfigategories_eof //-->

Share this post


Link to post
Share on other sites

Hi

Just started to implement this contribution - just wondering - is there another way to search for the customers like a text box to write there surname in, instead of the drop down menu.

 

I have about 10000 customers in my database, so scrolling through all the b ' s to get to a name is a bit of a chore !!

 

thanks

Share this post


Link to post
Share on other sites

I am also receiving the error

 

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 categories_id not in(36, 36)' at line 1

describe categories status where categories_id not in(36, 36)

 

not sure what it corresponds to but it only appears in my /shop/index.php page

 

help ?

Edited by fernyburn

Share this post


Link to post
Share on other sites

ok ....

 

have whittered it down to this piece of code in database.php

 

//START SHP

if(stristr($query, ' '.TABLE_PRODUCTS.' ') && !strstr($query, ' shp.products_id ') && isset($_SESSION['hidden_products']))

{

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(stristr($query, " where "))

{

$query = str_ireplace(" where ", $shp." and ", $query);

}

else

{

$query .= $shp;

}

}

}

 

if(stristr($query, ' '.TABLE_CATEGORIES.' ') && !strstr($query, ' shp.categories_id ') && isset($_SESSION['hidden_categories']))

{

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(stristr($query, " where "))

{

$query = str_ireplace(" where ", $shp." and ", $query);

}

else

{

$query .= $shp;

}

}

}

//END SHP

 

this is what is causing the database error

Share this post


Link to post
Share on other sites

hi fernyburn

 

Can you post the complete query which fails please (you can do this by placing echo $query; at database.php before //START SHP

 

Just started to implement this contribution - just wondering - is there another way to search for the customers like a text box to write there surname in, instead of the drop down menu.

 

I have about 10000 customers in my database, so scrolling through all the b ' s to get to a name is a bit of a chore !!

 

I know, but we have no time at the moment, sorry.


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

hi fernyburn

 

Can you post the complete query which fails please (you can do this by placing echo $query; at database.php before //START SHP

 

ok

 

on database.php

 

I have showing at the very top of the page (up before the header)

 

select configuration_key as cfgKey, configuration_value as cfgValue from configurationselect value from sessions where sesskey = 'a1487fd9968d54d2919d4ca98e768278' and expiry > '1271262053'

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/****/public_html/shop/includes/functions/database.php:43) in /home/****/public_html/shop/includes/functions/sessions.php on line 102

select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from currenciesSELECT unixtime FROM hidden_products WHERE unixtime > 1271259570delete from whos_online where time_last_click < '1271261153'select count(*) as count from whos_online where session_id = 'a1487fd9968d54d2919d4ca98e768278'insert into whos_online (customer_id, full_name, session_id, ip_address, hostname, time_entry, time_last_click, last_page_url, http_referer, user_agent) values ('0', 'Guest', 'a1487fd9968d54d2919d4ca98e768278', '79.64.167.75', '79-64-167-75.dynamic.dsl.as9105.com', '1271262053', '1271262053', '/shop/', 'http://www.****.co.uk/shop/', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)')select banners_id, date_scheduled from banners where date_scheduled != ''select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from banners b, banners_history bh where b.status = '1' and b.banners_id = bh.banners_id group by b.banners_idselect specials_id from specials where status = '1' and now() >= expires_date and expires_date > 0

 

and then actually on the index page

 

describe categories status1064 - 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 categories_id not in(39, 38, 21)' at line 1

 

describe categories status where categories_id not in(39, 38, 21)

 

[TEP STOP]

 

select count(*) as total from sessions where sesskey = 'a1487fd9968d54d2919d4ca98e768278'update sessions set expiry = '1271276453', value = 'cart|O:12:\"shoppingCart\":7:{s:8:\"contents\";a:1:{i:65;a:1:{s:3:\"qty\";i:1;}}s:5:\"total\";d:40;s:6:\"weight\";d:2000;s:6:\"cartID\";s:5:\"95721\";s:12:\"content_type\";s:8:\"physical\";s:13:\"total_virtual\";d:40;s:14:\"weight_virtual\";d:979976;}language|s:7:\"english\";languages_id|s:1:\"1\";currency|s:3:\"GBP\";navigation|O:17:\"navigationHistory\":2:{s:4:\"path\";a:1:{i:0;a:4:{s:4:\"page\";s:9:\"index.php\";s:4:\"mode\";s:6:\"NONSSL\";s:3:\"get\";a:0:{}s:4:\"post\";a:0:{}}}s:8:\"snapshot\";a:4:{s:4:\"page\";s:11:\"account.php\";s:4:\"mode\";s:6:\"NONSSL\";s:3:\"get\";a:0:{}s:4:\"post\";a:0:{}}}hidden_products|s:62:\"28, 29, 39, 42, 47, 91, 74, 75, 76, 77, 83, 84, 87, 88, 89, 94\";hidden_categories|s:10:\"39, 38, 21\";hidden_products_timestamp|i:1271262153;referral_id|s:0:\"\";cartID|R:7;onepage|a:6:{s:4:\"info\";a:4:{s:14:\"payment_method\";s:0:\"\";s:15:\"shipping_method\";s:0:\"\";s:8:\"comments\";s:0:\"\";s:6:\"coupon\";s:0:\"\";}s:8:\"customer\";a:16:{s:9:\"firstname\";N;s:8:\"lastname\";N;s:7:\"company\";N;s:14:\"street_address\";N;s:6:\"suburb\";N;s:4:\"city\";N;s:8:\"postcode\";N;s:5:\"state\";N;s:7:\"zone_id\";N;s:7:\"country\";a:4:{s:2:\"id\";N;s:5:\"title\";N;s:10:\"iso_code_2\";N;s:10:\"iso_code_3\";N;}s:9:\"format_id\";N;s:9:\"telephone\";s:0:\"\";s:13:\"email_address\";s:0:\"\";s:8:\"password\";s:0:\"\";s:10:\"newsletter\";s:0:\"\";s:10:\"country_id\";N;}s:8:\"delivery\";a:12:{s:9:\"firstname\";N;s:8:\"lastname\";N;s:7:\"company\";N;s:14:\"street_address\";N;s:6:\"suburb\";N;s:4:\"city\";N;s:8:\"postcode\";N;s:5:\"state\";N;s:7:\"zone_id\";N;s:7:\"country\";a:4:{s:2:\"id\";N;s:5:\"title\";N;s:10:\"iso_code_2\";N;s:10:\"iso_code_3\";N;}s:10:\"country_id\";N;s:9:\"format_id\";N;}s:7:\"billing\";a:12:{s:9:\"firstname\";N;s:8:\"lastname\";N;s:7:\"company\";N;s:14:\"street_address\";N;s:6:\"suburb\";N;s:4:\"city\";N;s:8:\"postcode\";N;s:5:\"state\";N;s:7:\"zone_id\";N;s:7:\"country\";a:4:{s:2:\"id\";N;s:5:\"title\";N;s:10:\"iso_code_2\";N;s:10:\"iso_code_3\";N;}s:10:\"country_id\";N;s:9:\"format_id\";N;}s:14:\"create_account\";b:0;s:15:\"shippingEnabled\";b:1;}payment|b:0;billto|N;sendto|N;' where sesskey = 'a1487fd9968d54d2919d4ca98e768278'

 

Any clues ?

Share this post


Link to post
Share on other sites

hI

Can any one help with the below error

 

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 categories_id not in(36, 36)' at line 1

 

describe categories status where categories_id not in(36, 36)

 

I have done the split results code changes - but it doesn't make any difference.

I have installed the Simply hide products contribution this is what gives the error .... but it only shows on /shop/index.php - the error doesnt show on any other page.

 

Any help pleeeeeze

Share this post


Link to post
Share on other sites

hey fernyburn,

 

go into the file catalog/includes/functions/database.php and REPLACE:

 

if(stristr($query, " where "))

 

WITH:

 

if(substr($query, 0, 8) == 'describe')
{
   //do not modify query
}
else if(stristr($query, " where "))

 

(2 times: near line 53 and near line 93)

 

does it help ?


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

hey fernyburn,

 

go into the file catalog/includes/functions/database.php and REPLACE:

 

if(stristr($query, " where "))

 

WITH:

 

if(substr($query, 0, 8) == 'describe')
{
   //do not modify query
}
else if(stristr($query, " where "))

 

(2 times: near line 53 and near line 93)

 

does it help ?

Share this post


Link to post
Share on other sites

My Hero !!

 

yes it does - thankyou so much....

 

This is perfect for me as I can now lose our trade site, as we have different prices for them, and yet more different prices for overseas trade, and I can make certain customers only see certain prices

 

Fab - Thanks Again !

Share this post


Link to post
Share on other sites

Hi

Im using this contribution for wholesale/trade dropshipping.

 

Ive noticed that the entries of whom is allowed to see certain products / categories is pulkled from the address book.

 

This means that when I send somthing I need to change the shipping address, therefore the list of customers in the categories shows the drop ship customers name instead of the company that will be billed for it.

 

How can I update the information to show billing address not address book address

 

Thanks

Ron

Share this post


Link to post
Share on other sites

Ive found the places

 

$query = tep_db_query("SELECT c.customers_id, a.entry_company, a.entry_firstname, a.entry_lastname, a.entry_city FROM ".TABLE_CUSTOMERS." c, ".address_book." a WHERE c.customers_default_address_id = a.address_book_id ORDER BY entry_company, entry_lastname");

 

 

$query = tep_db_query("SELECT hp.hidden_products_id, c.customers_id, a.entry_company, a.entry_firstname, a.entry_lastname, a.entry_city FROM ".TABLE_CUSTOMERS." c, ".address_book." a, hidden_products hp WHERE hp.customers_id = c.customers_id AND c.customers_default_address_id = a.address_book_id AND ".$query_id." ORDER BY entry_company, entry_lastname");

 

Do i simply change TABLE_CUSTOMERS & address_book to orders and billing_company ?

Share this post


Link to post
Share on other sites

Hello Pronux,

 

I first want to say that I think your script is a great add-on for anyone doing e-commerce and should be an already built in feature. I have not yet fully tested it but so far it is looking great.

 

I just wanted to pass along a feature that would be nice to have incorporated in to SHP, the allowing of using customer names OR customer groups. I also have the add-on "Separate Price Per Customer" installed which allows the creation of user groups so it would be nice to choose groups instead of each individual user.

 

I would even be willing to try and incorporate it myself but I am not a PHP expert so I am not exactly sure which code and in which file I would need to edit.

 

Anyways, keep up the great work.

 

Andy

Share this post


Link to post
Share on other sites

@fernyburn:

 

Do i simply change TABLE_CUSTOMERS & address_book to orders and billing_company ?

You've found the right places, but I don't think that this would work. SHP needs the customer_id and from the customer record from (table customers) you can only find the customers_default_address_id in table address_book. If you are very clever, you can go to table orders and lookup the relevant billing_address_format_id. You have to try it.

 

 

@goodolandy: Thanks for your feedback. You are not the first person who suggests the feature you mentioned (customer groups in combination with SSPC). Unfortunately it's not an easy thing to do. If osCommerce 3.0 will not have built-in this feature, we will develop it. For osCommerce 2.x we think it's too late.

Edited by Pronux

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

Hi Pronux,

your contribution is great, but I have a little problem.

My shop has about 80.000 products. Some category has 500 products, some 20.000 products, ... . If I hide category with 20.000 products, contribution doesn't work. Can you help me?

Share this post


Link to post
Share on other sites

but does it work when you hide a small category?

Yes, it's work. Problem is with large category only. I think that $_SESSION['hidden_products'] is to large. Variable $hidden_products has about 300.000 chars. What do you think about it?

Edited by bouliniatko

Share this post


Link to post
Share on other sites

I think that $_SESSION['hidden_products'] is to large. Variable $hidden_products has about 300.000 chars. What do you think about it?

 

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.


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

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

×