Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Hi,

 

I have SPPC installed and working properly except for one thing, when i try to copy a product, it gives me a 1062 - Duplicate entry '0-638' for key 1.

 

When you hit the back button, the new product has been copied correctly and appears in the list.

 

Now, when you browse the product listing on the main site, the price is displayed correctly, but when you click into a product info page, the price appears as 0.00. However, when you add the product anyway, the price in the shopping cart appears correctly.

 

So, its just the product info page which seems to get affected by this problem. Would anyone have any idea why this is happening?

 

Thanks.

Link to comment
Share on other sites

Interesting :'(

It looks like the first one (customer_group_id) was added to the table because that field is earlier in the query where you get the error Unknown column 'customers_group_ra'. Perhaps that field was already in there...

 

Those fields need to be added to that table one way or another. You can do several things.

 

A. Manually add those fields to that table using phpMyAdmin

B. Splitting up that query and see which one fails with an error and then we can see why. So start with (check that customer_group_id is already there):

ALTER TABLE customers ADD customers_group_ra enum('0','1') NOT NULL;

Then:

ALTER TABLE customers ADD customers_payment_allowed varchar(255) NOT NULL default '';

etcetera.

Perhaps because of the error. First get rid of the errors by adding those fields.

All the other errors are a results of those missing fields, nothing to get scared off.

 

 

Thank you for the help. Everything seems to work now. I still have the warning under customers but its workable. Under catalog/categories editing page still looks king of funny to me: (Catalog/categories on my editing page (no idea if it supposes to look like that) at the bottom of everything has the catalog/categories page and the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/admin/includes/functions/database.php on line 99) but still workable.

Again thank you

Link to comment
Share on other sites

I still have the warning under customers but its workable. Under catalog/categories editing page still looks king of funny to me: (Catalog/categories on my editing page (no idea if it supposes to look like that) at the bottom of everything has the catalog/categories page and the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/admin/includes/functions/database.php on line 99) but still workable.

Since the sql install for SPPC went wrong in the very first part I wonder if the rest now has been inserted. I mean the part:

DROP TABLE IF EXISTS products_groups;
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)
);

ALTER TABLE specials
ADD customers_group_id smallint UNSIGNED NOT NULL default '0';

DROP TABLE IF EXISTS customers_groups;
CREATE TABLE customers_groups (
customers_group_id smallint UNSIGNED NOT NULL,
customers_group_name varchar(32) NOT NULL default '',
customers_group_show_tax enum('1','0') NOT NULL,
customers_group_tax_exempt enum('0','1') NOT NULL,
group_payment_allowed varchar(255) NOT NULL default '',
group_shipment_allowed varchar(255) NOT NULL default '',
PRIMARY KEY (customers_group_id)
);

INSERT INTO customers_groups VALUES('0','Retail','1','0','','');

ALTER TABLE address_book 
ADD entry_company_tax_id VARCHAR(32) DEFAULT NULL AFTER entry_company;

Please check if those fields/table have been added to the database.

Link to comment
Share on other sites

Since the sql install for SPPC went wrong in the very first part I wonder if the rest now has been inserted. I mean the part:

DROP TABLE IF EXISTS products_groups;
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)
);

ALTER TABLE specials
ADD customers_group_id smallint UNSIGNED NOT NULL default '0';

DROP TABLE IF EXISTS customers_groups;
CREATE TABLE customers_groups (
customers_group_id smallint UNSIGNED NOT NULL,
customers_group_name varchar(32) NOT NULL default '',
customers_group_show_tax enum('1','0') NOT NULL,
customers_group_tax_exempt enum('0','1') NOT NULL,
group_payment_allowed varchar(255) NOT NULL default '',
group_shipment_allowed varchar(255) NOT NULL default '',
PRIMARY KEY (customers_group_id)
);

INSERT INTO customers_groups VALUES('0','Retail','1','0','','');

ALTER TABLE address_book 
ADD entry_company_tax_id VARCHAR(32) DEFAULT NULL AFTER entry_company;

Please check if those fields/table have been added to the database.

 

 

Fields in database are:

customers_group_id smallint(5) unsigned

customers_group_name varchar(32)

customers_group_show_tax enum('1','0')

customers_group_tax_exempt enum('0','1')

group_payment_allowed varchar(255)

group_shipment_allowed varchar(255)

PRIMARY customers_group_id

 

 

entry_company_tax_id varchar(32) YES

Link to comment
Share on other sites

None of the additional session values used by SPPC have been added. This is the task of login.php. Can you double check that file?

I LOVE YOU! I have been trying to get this contribution to work for several hours and you just competely solved my problem. I rechecked my login.php code and then it worked! Thank you so much! :D

Link to comment
Share on other sites

Fields in database are:

customers_group_id smallint(5) unsigned

customers_group_name varchar(32)

customers_group_show_tax enum('1','0')

customers_group_tax_exempt enum('0','1')

group_payment_allowed varchar(255)

group_shipment_allowed varchar(255)

PRIMARY customers_group_id

 

 

entry_company_tax_id varchar(32) YES

 

I also realized that I cannot edit under configuration/customer details 'Default Customer Group and Visitor Pricing Group': I have this error: Fatal error: Call to undefined function tep_cfg_pull_down_cg_list() in /home/xxxxxx/public_html/admin/configuration.php(125) : eval()'d code on line 1

 

Warning: call_user_func(tep_cfg_get_customer_group) [function.call-user-func]: First argument is expected to be a valid callback in /home/xxxxxx/public_html/admin/includes/functions/general.php on line 1315

Link to comment
Share on other sites

Hi

I'm sorry of being a bother. I have a few problems with this contribution and I need help to fix them.

1. When logged in all products are visible even if I hide them from a group.

2. When I go to login I don't get a choice of groups or enything like that.

3. I have so far 2 groups when I tried to add another I got this message at login: Warning: implode() [function.implode]: Bad arguments. in /home/xxxxxx/public_html/includes/functions/general.php on line 1339

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 ')' at line 1

 

select p.products_id, find_in_set('1', products_hide_from_groups) as hide_or_not, find_in_set('1', categories_hide_from_groups) as in_hidden_category from products p left join products_to_categories p2c using(products_id) left join categories c using(categories_id) where p.products_id in ()

 

4. I cannot edit in admin under configuration/customer details 'Default Customer Group and Visitor Pricing Group': I have this error: Fatal error: Call to undefined function tep_cfg_pull_down_cg_list() in /home/xxxxxx/public_html/admin/configuration.php(125) : eval()'d code on line 1

 

Warning: call_user_func(tep_cfg_get_customer_group) [function.call-user-func]: First argument is expected to be a valid callback in /home/xxxxxx/public_html/admin/includes/functions/general.php on line 1315

 

5. In admin catalog/products when at editing that page still looks funny. Its like two pages in one. "categories/products and edit in one page".

 

Thanks to JanZ some errors before where fixed.

 

Fields in database are:

customers_group_id smallint(5) unsigned

customers_group_name varchar(32)

customers_group_show_tax enum('1','0')

customers_group_tax_exempt enum('0','1')

group_payment_allowed varchar(255)

group_shipment_allowed varchar(255)

PRIMARY customers_group_id

 

 

entry_company_tax_id varchar(32) YES

Link to comment
Share on other sites

I'm still having problems being able to get any product attributes into the shopping cart. I updated the changes you suggested to fix the problem of getting any product into the shopping cart. That worked for products without an attribute. When I try to add an attribute to the cart I get:

 

Error Please select your desired option from the available choices.

 

I'm wondering if I did something wrong in trying to integrate the multi stores in two sections of the shopping_cart.php. Specifically around lines 438 (specials) and 478 (attributes).

Have not looked very hard at those lines since you said it happens when adding a product with an attribute (correct?) to the cart. Looking at the function add_cart (starting around line 183 in your file) it seems fine to me.

 

However, for the life of me I cannot find the error phrase "Please select your desired option from the available choices." in the osC code. Perhaps that gives a clue to what happens (you could check the table customers_basket to see if the add to cart went OK but the error is originating somewhere else).

Link to comment
Share on other sites

I've noticed that when I try to change the customer group in the admin panel, the group does not change. I've rechecked my file but don't see where the problem may be. Any assistance would be appreciated.
Strange, looks fine to me. You don't happen to have a register_globals problem do you?

Otherwise change the $HTTP_POST_VARS for SPPC specific variables to $_POST ones like in the top of the file:

// BOF Separate Pricing per Customer
$customers_group_id = tep_db_prepare_input($HTTP_POST_VARS['customers_group_id']);

to:

// BOF Separate Pricing per Customer
$customers_group_id = tep_db_prepare_input($_POST['customers_group_id']);

In that case you should also change the $listing on line 1246 (in your file) to a $_GET like:

<?php  // BOF customer_sort_admin_v1 adapted for Separate Pricing Per Customer
	  switch ($_GET['listing']) {

Link to comment
Share on other sites

I have SPPC installed and working properly except for one thing, when i try to copy a product, it gives me a 1062 - Duplicate entry '0-638' for key 1.

 

When you hit the back button, the new product has been copied correctly and appears in the list.

 

Now, when you browse the product listing on the main site, the price is displayed correctly, but when you click into a product info page, the price appears as 0.00. However, when you add the product anyway, the price in the shopping cart appears correctly.

The question is which query went wrong? I have seen it before, where some other contribution was added which apparently had not completely clear instructions. Some code ended up somewhere else where the products_id of the new product (copy as duplicate) was not known yet. Then the product would not end up in the products_to_categories table (I presume, so wouldn't be listed in a category).
Link to comment
Share on other sites

I have installed the latest version of this contribution and it seems to be working just fine except i get the following error when i select a manufacture from the pull down manufacturer infobox:

 

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

 

1054 - Unknown column 'p.products_id' in 'on clause'

 

select count(p.products_id) as total from products p, products_description pd, manufacturers m left join specials_retail_prices s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '0'

 

[TEP STOP]

 

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

 

I didn't know which file to look into so any help would be much appreciated.

Link to comment
Share on other sites

I also realized that I cannot edit under configuration/customer details 'Default Customer Group and Visitor Pricing Group': I have this error: Fatal error: Call to undefined function tep_cfg_pull_down_cg_list() in /home/xxxxxx/public_html/admin/configuration.php(125) : eval()'d code on line 1
This is not a function in SPPC (or my text editor cannot search properly anymore). You might have stuff left from another contribution you tried but not removed completely?
Link to comment
Share on other sites

3. I have so far 2 groups when I tried to add another I got this message at login: Warning: implode() [function.implode]: Bad arguments. in /home/xxxxxx/public_html/includes/functions/general.php on line 1339

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 ')' at line 1

 

select p.products_id, find_in_set('1', products_hide_from_groups) as hide_or_not, find_in_set('1', categories_hide_from_groups) as in_hidden_category from products p left join products_to_categories p2c using(products_id) left join categories c using(categories_id) where p.products_id in ()

Now that is totally weird. It is from the function restore_contents in includes/classes/shopping_cart.php around line 118:

// reset per-session cart contents, but not the database contents
  $this->reset(false);

  $products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
// BOF SPPC hide products and categories from groups
		$no_of_products_in_basket = 0;
  while ($_products = tep_db_fetch_array($products_query)) {
	$temp_post_get_array[] = $_products['products_id'];
			$products[] = $_products;
			$no_of_products_in_basket += 1;
		}
 if ($no_of_products_in_basket > 0) {
			$hide_status_products = array();
			$hide_status_products = tep_get_hide_status($hide_status_products, $this->cg_id, $temp_post_get_array);

Now this code (tep_get_hide_status, which is causing the error) is only executed when the number of products in basket is more than zero. Still from the errors you get, there are no products in table customers_basket.... ????

Link to comment
Share on other sites

JanZ,

 

I mucking around with the attribute issue, I came across another error. I added some items to my basket (no attributes would go in & they are not in the database). I then went to checkout and needed to log into my account. After entering the email and password, I got an error

 

Fatal error: Call to undefined function: tep_get_hide_status() in /home/infinity/public_html/catalog/includes/classes/shopping_cart.php on line 130 - which is $hide_status_products- tep_get_hide_status...

 

// BOF SPPC hide products and categories from groups
           $no_of_products_in_basket = 0;
     while ($_products = tep_db_fetch_array($products_query)) {
       $temp_post_get_array[] = $_products['products_id'];
               $products[] = $_products;
               $no_of_products_in_basket += 1;
           }
 if ($no_of_products_in_basket > 0) {
               $hide_status_products = array();
               $hide_status_products = tep_get_hide_status($hide_status_products, $this->cg_id, $temp_post_get_array);
               for ($i=0; $i < $no_of_products_in_basket; $i++) {
                   foreach($hide_status_products as $key => $subarray) {
                       if ($subarray['products_id'] == tep_get_prid($products[$i]['products_id']) && $subarray['hidden'] == '0') {
                   // not hidden for this customer, can be added to the object shoppingCart
       $this->contents[$products[$i]['products_id']] = array('qty' => $products[$i]['customers_basket_quantity']);
// attributes

 

If I hit the back button on the browser to the login.php page I'm actually logged into the account.

 

Any ideas?

 

Thanks!

 

Joanne

Edited by reelwild
Link to comment
Share on other sites

Try this post for fixes.

 

Thanks for that post. It fixed my problem with manufacturer. Now i got another problem. My search and advanced search do not work .. I keep getting this:

 

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

1066 - Not unique table/alias: 'pd'

 

select count(p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%bug%' or p.products_model like '%bug%' or m.manufacturers_name like '%bug%') )

 

[TEP STOP]

 

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

 

I also altered the the advanced_search_result.php and thats the above error i am getting. This is a snippet of the part that was changed:

 

   if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . $product_prices_table . " as tmp_pp using(products_id)";
  } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id";
  } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";          
  }
// EOC - Separate Pricing Per Customer v4.1.5a


 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   $select_str .= ", SUM(tr.tax_rate) as tax_rate ";
 }

// BOC - Separate Pricing Per Customer v4.1.5a
//  $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id"; <--- Quoted by Separate Pricing Per Customer v4.1.5a
     if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
     } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
     } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
     }
// EOC - Separate Pricing Per Customer v4.1.5a


 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   if (!tep_session_is_registered('customer_country_id')) {
     $customer_country_id = STORE_COUNTRY;
     $customer_zone_id = STORE_ZONE;
   }
   $from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }

 $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 

I did do a search for this error and found posts but no solution yet. Do you have one for this please?

Link to comment
Share on other sites

Try this post for fixes.

 

Thanks for that post. It fixed my problem with manufacturer. Now i got another problem. My search and advanced search do not work .. I keep getting this:

 

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

1066 - Not unique table/alias: 'pd'

 

select count(p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%bug%' or p.products_model like '%bug%' or m.manufacturers_name like '%bug%') )

 

[TEP STOP]

 

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

 

I also altered the the advanced_search_result.php and thats the above error i am getting. This is a snippet of the part that was changed:

 

   if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . $product_prices_table . " as tmp_pp using(products_id)";
  } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id";
  } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";          
  }
// EOC - Separate Pricing Per Customer v4.1.5a


 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   $select_str .= ", SUM(tr.tax_rate) as tax_rate ";
 }

// BOC - Separate Pricing Per Customer v4.1.5a
//  $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id"; <--- Quoted by Separate Pricing Per Customer v4.1.5a
     if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
     } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
     } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
     }
// EOC - Separate Pricing Per Customer v4.1.5a


 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   if (!tep_session_is_registered('customer_country_id')) {
     $customer_country_id = STORE_COUNTRY;
     $customer_zone_id = STORE_ZONE;
   }
   $from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }

 $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 

I did do a search for this error and found posts but no solution yet. Do you have one for this please?

Link to comment
Share on other sites

Sorry for some reason it got posted twice. If a mod can delete one of the posts would be great.

 

Also i merged the changes with winmerge and according to that the following code should not be in at all:

 

  if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
   $select_str .= ", SUM(tr.tax_rate) as tax_rate ";
 }

// BOC - Separate Pricing Per Customer v4.1.5a
//  $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id"; <--- Quoted by Separate Pricing Per Customer v4.1.5a
     if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
     } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
     } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
     }
// EOC - Separate Pricing Per Customer v4.1.5a

 

Should i remove this code because if i do i get this 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 'from products p left join manufacturers m using(manufacturers_id) left join spec' at line 1

 

from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%bug%' or p.products_model like '%bug%' or m.manufacturers_name like '%bug%') ) order by pd.products_name limit 0, 25

 

[TEP STOP]

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

 

Thanks JanZ

Link to comment
Share on other sites

Now that is totally weird. It is from the function restore_contents in includes/classes/shopping_cart.php around line 118:

// reset per-session cart contents, but not the database contents
  $this->reset(false);

  $products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
// BOF SPPC hide products and categories from groups
		$no_of_products_in_basket = 0;
  while ($_products = tep_db_fetch_array($products_query)) {
	$temp_post_get_array[] = $_products['products_id'];
			$products[] = $_products;
			$no_of_products_in_basket += 1;
		}
 if ($no_of_products_in_basket > 0) {
			$hide_status_products = array();
			$hide_status_products = tep_get_hide_status($hide_status_products, $this->cg_id, $temp_post_get_array);

Now this code (tep_get_hide_status, which is causing the error) is only executed when the number of products in basket is more than zero. Still from the errors you get, there are no products in table customers_basket.... ????

 

 

These lines are the same as in my file.

Link to comment
Share on other sites

Also i merged the changes with winmerge and according to that the following code should not be in at all:

All sorts of code seems to have moved from one place to another. A bigger snippet as how it should look like:

   tep_db_check_age_products_group_prices_cg_table($customer_group_id);
  $status_tmp_product_prices_table = true;   
  } elseif ((tep_not_null($pfrom) || tep_not_null($pto) || $status_need_to_get_prices == true) && $customer_group_id == '0') {
  // to be able to sort on retail prices we *need* to get the special prices instead of leaving them
  // NULL and do product_listing the job of getting the special price
  // first make sure that table exists and needs no updating
  tep_db_check_age_specials_retail_table();
  $status_tmp_special_prices_table = true;
  } // end elseif ((tep_not_null($pfrom) || (tep_not_null($pfrom)) && .... 

  if ($status_tmp_product_prices_table == true) {
  $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, 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 ";
  } elseif ($status_tmp_special_prices_table == true) {
 $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, 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 ";	
  } else {
 $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, NULL as specials_new_products_price, NULL as final_price ";	
  }
  // next line original select query
  // $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, 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 ";


 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
$select_str .= ", SUM(tr.tax_rate) as tax_rate ";
 }

  if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . $product_prices_table . " as tmp_pp using(products_id)";
  } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id ";
  } else {
$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) ";
  }
 // EOF Separate Pricing Per Customer

 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
if (!tep_session_is_registered('customer_country_id')) {
  $customer_country_id = STORE_COUNTRY;
  $customer_zone_id = STORE_ZONE;
}
$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }

 $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

 $where_str = " where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";

 if (isset($HTTP_GET_VARS['categories_id']) && tep_not_null($HTTP_GET_VARS['categories_id'])) {
if (isset($HTTP_GET_VARS['inc_subcat']) && ($HTTP_GET_VARS['inc_subcat'] == '1')) {
  $subcategories_array = array();
  tep_get_subcategories($subcategories_array, $HTTP_GET_VARS['categories_id']);

Link to comment
Share on other sites

I found where the error message is and where it calls for it. It's in the product_info.php lines 18-23. I don't really understand what it's function is supposed to do. Any ideas?

Looking at the first part of the file I notice that hide products code is not added to it:

//rmh M-S_select begin
 if ( (isset($HTTP_GET_VARS['attrib_error'])) && ($HTTP_GET_VARS['attrib_error'] = '1')) {
$messageStack->add_session('product_info', ERROR_NO_ATTRIBUTE);
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
 }
//rmh M-S_select end
//rmh M-S_multi-stores edited next line
 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_STORES . " p2s where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and p.products_id = p2s.products_id and p2s.stores_id = '" . STORES_ID . "' and pd.language_id = '" . (int)$languages_id . "'");

With "hide products" the code to determine the customer group id is moved above the $product_check_query and the $product_check_query contains sql to see if the product or category it is in is hidden for the customer group.

Regarding the attrib_error, somewhere the HTTP_GET_VARS['attrib_error'] is generated but since it is set to 1 with $HTTP_GET_VARS['attrib_error'] = '1' instead checked whether it is equivalent to '1' ($HTTP_GET_VARS['attrib_error'] == '1') it looks like an error is generated always whenever that GET variable is set.

Link to comment
Share on other sites

After entering the email and password, I got an error

 

Fatal error: Call to undefined function: tep_get_hide_status() in /home/infinity/public_html/catalog/includes/classes/shopping_cart.php on line 130 - which is $hide_status_products- tep_get_hide_status...

The error is clear: you didn't add the function tep_get_hide_status (and possibly also not the function tep_get_hide_status_single) to the bottom of includes/functions/general.php or you added them after the closing php tag (?>). Perhaps you added it to the admin side, where a file with the same name and path can be found.

Link to comment
Share on other sites

I need a little help, before I get stuck in a mental home.

 

I've got the SPPC running with Multi-stores and it all seems to be working fine, apart from one major thing - it's making all the accounts when logged in TAX EXEMPT but I can show tax when the user is not logged in. Is there any reason for this or anywhere I could be looking to fix it? I've looked in the admin and the groups are set to show tax, but it's just not doing it.

 

Any help would be appreciated...

Edited by xdam
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...