Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Why cant i add more than 100 items? ... please help

That is because of the setting of MAX_QTY_IN_CART (maximum values in the shop admin configuration) that is standard set at 99. This is from the oscommerce.sql that installs the shop:

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Product Quantities In Shopping Cart', 'MAX_QTY_IN_CART', '99', 'Maximum number of product quantities that can be added to the shopping cart (0 for no limit)', '3', '19', now());

Share this post


Link to post
Share on other sites

That is because of the setting of MAX_QTY_IN_CART (maximum values in the shop admin configuration) that is standard set at 99. This is from the oscommerce.sql that installs the shop:

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Product Quantities In Shopping Cart', 'MAX_QTY_IN_CART', '99', 'Maximum number of product quantities that can be added to the shopping cart (0 for no limit)', '3', '19', now());

 

Thanks Jan, :blush: Sleep deprivation, myself and basic oscommerce configuration don't mix.

Share this post


Link to post
Share on other sites

I don't think that this is a repeat question, I apologize if it is - there is a LOT of posts in this topic.

 

I'm getting an error when the function tep_get_hide_status() is called (when customer logs in with 1 item in cart, and this is supposed to remove any hidden items from that cart) I am getting a query error on the $hide_query the variable $list_of_products_ids comes up blank so I get the following 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 ')' at line 1

 

select p.products_id, find_in_set('0', products_hide_from_groups) as hide_or_not, find_in_set('0', 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 ()

 

I am assuming it's causing it in the shopping_cart class file because I do have another addon (Zappos Options Types) installed. I'm going to keep looking but thought another pair of eyes might help. Can anyone see where I'm missing a variable defined?

 

Below is the portion of code that I **THINK** is what is causing problems but I'm not really sure.

 

$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);
           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['products_id']] = array('qty' => $products[$i]['customers_basket_quantity']);
// attributes
//BOF - Zappo - Option Types v2 - Update query to pull attribute value_text. This is needed for text attributes.
       $attributes_query = tep_db_query("select products_options_id, products_options_value_id, products_options_value_text from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products[$i]['products_id']) . "'");
       while ($attributes = tep_db_fetch_array($attributes_query)) {
         $this->contents[$products[$i]['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
         // - Zappo - Option Types v2 - If attribute is Text, set additional information
         if ($attributes['products_options_value_id'] == OPTIONS_VALUE_TEXT_ID) {
           $this->contents[$products[$i]['products_id']]['attributes_values'][$attributes['products_options_id']] = $attributes['products_options_value_text'];
         }
//EOF - Zappo - Option Types v2 - Update query to pull attribute value_text. This is needed for text attributes.
       } // end while 
     } elseif ($subarray['products_id'] == tep_get_prid($products[$i]['products_id']) && $subarray['hidden'] == '1') {
// product is hidden for the customer, don't add to object shoppingCart, delete from db next
               $products_to_delete_from_cb[] = $products[$i]['products_id'];
               } // end if/elseif
             }// end foreach ($hide_status_products as $key => $subarray)
           } // end for ($i=0 ; $i < $no_of_products_in_basket; $i++)
           // delete from the database those products that are hidden from this customer
     if (tep_not_null($products_to_delete_from_cb)) {
        $no_of_iterations = count($products_to_delete_from_cb);
// since the products_id in the table customer_basket and customer_basket_attributes can contain
// attributes like 1{4}2{3}6 we need to delete them one by one for the two tables
       for ($y = 0; $y < $no_of_iterations; $y++) {
          tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and (products_id = '" . (int)$products_to_delete_from_cb[$y] . "' or products_id REGEXP '^" .  (int)$products_to_delete_from_cb[$y] . "{');");
          tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and (products_id = '" . (int)$products_to_delete_from_cb[$y] . "' or products_id REGEXP '^" .  (int)$products_to_delete_from_cb[$y] . "{');");
        } // end for ($y = 0; $y < $no_of_iterations; $y++)
     } // end if (tep_not_null($products_to_delete_from_cb))
} // end if ($no_of_products_in_basket > 0)
// EOF SPPC Hide products and categories from groups
$this->cleanup();
   }

Share this post


Link to post
Share on other sites

I'm getting an error when the function tep_get_hide_status() is called (when customer logs in with 1 item in cart, and this is supposed to remove any hidden items from that cart) I am getting a query error on the $hide_query the variable $list_of_products_ids comes up blank so I get the following error:

Weird error. tep_get_hide_status is called only if there is more than zero products in the basket. But the error is caused by the fact that there are no product_ids (so no products...):

where p.products_id in ()

 

Doesn't look this has anything to do with the Options Types contribution. I don't see how this can go wrong but it does... :blink:

Share this post


Link to post
Share on other sites

Weird error. tep_get_hide_status is called only if there is more than zero products in the basket. But the error is caused by the fact that there are no product_ids (so no products...):

where p.products_id in ()

 

Doesn't look this has anything to do with the Options Types contribution. I don't see how this can go wrong but it does... :blink:

 

 

I feel really stupid now. I actually found it, I had typed wrong in the first $products_query

 

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

 

The while condition should be $_products NOT $products... DoH!

 

Good grief. :blush:

Share this post


Link to post
Share on other sites

The while condition should be $_products NOT $products...

Ah, well I missed that completely too. Hard to spot error IMHO. You shouldn't feel bad about that.

Share this post


Link to post
Share on other sites

I have been searching a lot for this function at no avail.

 

Is there any way of displaying the different groups and their respective product price underneath the price in product info page for customers to see what the difference in prices are in the different groups so they can see the savings there are in the different groups?

 

Reason for that is i have a membership based site and if people can see the different prices in the groups and hence the savings in the different groups they can buy membership for that group.

 

Feature to look something like Display MSRP & Savings contribution.

 

Any help would be much appreciated.

Share this post


Link to post
Share on other sites

I have been searching a lot for this function at no avail.

 

Is there any way of displaying the different groups and their respective product price underneath the price in product info page for customers to see what the difference in prices are in the different groups so they can see the savings there are in the different groups?

That's a bit of custom coding that very few people will need because normally you wouldn't want others to know they pay a higher price than someone else :)

 

The query to get customer group prices together with the name of the customer group in product_info.php would be:

 

select customers_group_price, customers_group_name from products_groups pg, customers_groups cg where pg.customers_group_id = cg.customers_group_id and pg.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "';

Share this post


Link to post
Share on other sites

That's a bit of custom coding that very few people will need because normally you wouldn't want others to know they pay a higher price than someone else :)

 

The query to get customer group prices together with the name of the customer group in product_info.php would be:

 

select customers_group_price, customers_group_name from products_groups pg, customers_groups cg where pg.customers_group_id = cg.customers_group_id and pg.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "';

 

I am sorry but i don't know anything about programming. i just know how to follow instructions and try to learn form them. I am going through the product_info.php file trying to figure out where and how i put this query in and showing the output of it. i only need to show this output for new comers and not for logged in users.

 

If you could please show this it would be much appreciated.

Edited by CGhoST

Share this post


Link to post
Share on other sites

Hi All!

Trying to contol currency from customer group I have put the following in my includes/languages/english.php

  $aresult = tep_db_query("select customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" . (int)$customer_group_id . " '");
 $aresult_array = tep_db_fetch_array($aresult);
 if ($aresult_array['customers_group_name'] != "Some Group") {
 define('LANGUAGE_CURRENCY', 'GBP');
 }
 else
 {
 define('LANGUAGE_CURRENCY', 'SEK');
 }

Does'nt work. Is it possible to pull this off somehow?

//Micke

Share this post


Link to post
Share on other sites

Hi All!

Trying to contol currency from customer group I have put the following in my includes/languages/english.php

  $aresult = tep_db_query("select customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" . (int)$customer_group_id . " '");
 $aresult_array = tep_db_fetch_array($aresult);
 if ($aresult_array['customers_group_name'] != "Some Group") {
 define('LANGUAGE_CURRENCY', 'GBP');
 }
 else
 {
 define('LANGUAGE_CURRENCY', 'SEK');
 }

Does'nt work. Is it possible to pull this off somehow?

Actually, you don't need to do a query. If a customer is logged-in the customer group id will be set in her/his session: $_SESSION['sppc_customer_group_id']

So if that is set and it is of the value not belonging to the "Some Group" you can do the same thing.

 

However, if the session variable for currency is already set, this define will do nothing because if you check application_top.php around line 307 you will notice that that takes precedence:

 

// currency
 if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {
   if (!tep_session_is_registered('currency')) tep_session_register('currency');

   if (isset($HTTP_GET_VARS['currency']) && $currencies->is_set($HTTP_GET_VARS['currency'])) {
     $currency = $HTTP_GET_VARS['currency'];
   } else {
     $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
   }
 }

 

So I would suggest that on logging-in you also set the session variable for currency there, depending on the customer group. Of course you will need to remove or adapt the part in application_top.php that enables customers to change their currency:

 

   if (isset($HTTP_GET_VARS['currency']) && $currencies->is_set($HTTP_GET_VARS['currency'])) {
     $currency = $HTTP_GET_VARS['currency'];
   } else {
     $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
   }

 

I'm not sure if there are other parts that need tweaking (where customers can change currency).

Share this post


Link to post
Share on other sites

For those of you using Separate Pricing Per Customer & Quantity Price Breaks with Zappo's Options Types... There is a query error when customers with text attributes (if they include a comma in their text) get when they log back in. I found a fix for this and thought I would share:

 

In /catalog/includes/classes/PriceFormatterStore.php

Find...

if (tep_not_null($valid_value)) {
				  $product_id_list_array[] = $valid_value;
         }

 

And replace with...

 

if (tep_not_null($valid_value)&&is_numeric($valid_value)) {
				  $product_id_list_array[] = $valid_value;
         }

 

This way the product_id array only returns numeric values. :D Hope this helps someone else.

Share this post


Link to post
Share on other sites

I am having trouble with SPPC and easypopulate, in that the prices are only showing as Retail Prices for any Price Group.

However it correctly shows the seperate prices for Seperate price groups if the value uploaded from the easy populate .csv is below $10.00 in any of the v_Customer_price_n cells.

 

Secondly the Customers Groups does not show under Customers in the LHS Admin area.

 

I created another store and installed the SPPC & Easypopulate Contributions again, The seperate pricing problem remains the same, however this time the Customers Groups does show up in the Admin Area.

 

I have compared the 2 stores over the past few days and cannot pick up where the problem(s) may be.

 

Hoping you may be able to help.

 

Regards

 

My Settings and Info are:-

 

EP vers: 2.76i-MS2

osCommerce Online Merchant v2.2 RC2a

OS:

HTTP: Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

DB: MySQL 5.1.41

PHP: 5.3.1 (Zend: 2.3.0)

 

Temp Directory:

C:/xampp/htdocs/catalog/temp/

Temp Dir is Writable

Magic Quotes is: off

register_globals is: off

Split files on: 300 records

Model Num Size: 15

Price with tax: false

Calc Precision: 2

Replace quotes: false

Field seperator: comma

Excel safe output: true

Preserve tab/cr/lf: false

Category depth: 7

Enable attributes: true

SEF Froogle URLS: false

 

Other Support:

MVS Support: false

Additional Images: false

More Pics: false

UltraPics Pics: false

HTC: false

SPPC: true

Extra Fields: false

PDF Upload: false

Share this post


Link to post
Share on other sites

Hey Guys, tried reading a lot, but have some basic questions.

I need a store where it has two groups, retailers and wholesaler, and thus separate pricing for both but none would see any prices unless they are logged in. So as per what I understood after reading all the posts, this is what I planned, Step 1> Install SPPC (I downloaded 4.2.2), step 2> make three groups, 1st one being default, other two which i require, the default prices are the ones which generally one can see without having to log in, Now step 3> Install Hide prices if zero contribution and make the default prices to be zero so they will not be displayed nor the add now button.

 

Problem 1> Hide prices contribution says I need to have qty price break with SPPC 4.1.1 contribution pre-installed, Why do I need this??? Can I not install directly, also it says Qty rice break with sppc 4.1.1, where else I am installing 4.2.2

 

2> Is there an alternative to above solution?

 

Regards,

Kedar

Share this post


Link to post
Share on other sites

Problem 1> Hide prices contribution says I need to have qty price break with SPPC 4.1.1 contribution pre-installed, Why do I need this???

You don't need Quantity Price Breaks for using the Hide products from customer groups contribution. You do would need SPPC installed but you already understood that.

Share this post


Link to post
Share on other sites

You don't need Quantity Price Breaks for using the Hide products from customer groups contribution. You do would need SPPC installed but you already understood that.

 

 

Hey Jan,

 

Am not installing Hide products, WHat am installing is hide prices when entered zero.

 

Kedar.

Share this post


Link to post
Share on other sites

Am not installing Hide products, WHat am installing is hide prices when entered zero.

Then you still don't need the Quantity Price Breaks contribution. But if you would have the QPB contribution added, you would have to change the code of the HIde Price if zero contribution because of the way QPB handles the price. Perhaps a misunderstanding due to a an upload with a fix for that issue?

Share this post


Link to post
Share on other sites

Then you still don't need the Quantity Price Breaks contribution. But if you would have the QPB contribution added, you would have to change the code of the HIde Price if zero contribution because of the way QPB handles the price. Perhaps a misunderstanding due to a an upload with a fix for that issue?

 

can u plz confirm once again

 

http://www.oscommerce.com/community/contributions,4001

 

4001 is part of the link.

 

above is the link that clearly says, that it requires QPB.

Edited by kedar00

Share this post


Link to post
Share on other sites

above is the link that clearly says, that it requires QPB.

You are right, complete forgot about that one. I assumed you were talking about the Hide Price if $0 contribution (that needs a little fix if you use QPB).

Share this post


Link to post
Share on other sites

Has anyone got this contribution working with Custom Product Builder (http://addons.oscommerce.com/info/6328).

 

I have been trying from the little knowledge i can gather but i can't get the seperate group pricing from the above contribution.

 

Any help is much appreciated please.

Share this post


Link to post
Share on other sites

Hi, I want to install the SPPC contribution, I wonder if this version is the most appropriate, SPPC_Price_Break_v2_0, si tiene unos requerimientos, y si necesita otra contribucion adicional, thanks

Share this post


Link to post
Share on other sites

I want to install the SPPC contribution, I wonder if this version is the most suitable, if you have some requirements, and if you need further contribution.

Share this post


Link to post
Share on other sites

I have installed this version of SPPC SPPC_Price_Break_v2_0, i have tried with the sp_autoinstaller, but not works,

Well yes, that autoinstaller needs your files to be writable and security wise that is not good so I'm not surprised if you do that online and not on your own computer.

Share this post


Link to post
Share on other sites

Sppc Breadcrumb trail help

 

original code:

// add the products model to the breadcrumb trail
//  if (isset($HTTP_GET_VARS['products_id'])) {
// BOF SPPC Hide products and categories from groups
//    $model_query = tep_db_query("select p.products_model from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0");
// EOF SPPC Hide products and categories from groups
//    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']));
//    }
//  }

 

 

working:

// add the products name to the breadcrumb trail
if (isset($HTTP_GET_VARS['products_id'])) {

  $crumb_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . $languages_id . "'");

if (tep_db_num_rows($crumb_query)) {
  $crumb = tep_db_fetch_array($crumb_query);
   $breadcrumb->add($crumb['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
  }
 }

 

not working:

// add the products name to the breadcrumb trail sppc
 if (isset($HTTP_GET_VARS['products_id'])) {
// BOF SPPC Hide products and categories from groups
   $crumb_query = tep_db_query("select p.products_model, p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " .  TABLE_PRODUCTS_DESCRIPTION . " pd  left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0");
// EOF SPPC Hide products and categories from groups
 if (tep_db_num_rows($crumb_query)) {
   $model = tep_db_fetch_array($crumb_query);
     $breadcrumb->add($crumb['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
  }
}

 

some suggestion?

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

×