Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I used xsell v 2.3

 

 

So here's what I did: I attempted to alter your code to work with the newest versions of X-Sell and SPPC. No luck. Every time I tried, all 6 times, the X-Sell box simply wouldn't show up for the "wholesale" accounts so I had no way of knowing if the correct prices were getting pulled from the database or not. I tried it with and without the cache mod.

 

I then uninstalled the version I was using, v2.5.2, and then installed v2.3 as I figured maybe I had to downgrade a bit. No luck. So then I uninstalled that and I went on to install version 2.2 thinking that I hadn't downgraded enough perhaps. Still nothing.

 

I'm totally confused and out of ideas. I just don't get how this isn't working. It seems that it would be a relatively simple edit to make the correct prices display but it's turning into a headache.

 

If you have any other ideas please feel free to send them my way. Thanks again.

Link to comment
Share on other sites

:huh:

 

hi, all.

I have installed, QPBPP 1.3.5 for SPPC 4.2.2 in my store , 2.2Rc2a, with a few adons installed.

with customer groups of retail and wholesale setup.

price break levels of 2 only for test.

when I try to add or edit a product with price breaks, it shows the following error.

 

(with some test values)-----------------------------------------

 

...$_POST[products_price_break]... Array...

...pbb_cg_id... 0...

... price_break_array ... Array...

... price_break_array value... 0...

 

Warning: Invalid argument supplied for foreach() in /home/catalog/admin/categories.php on line 484

...pbb_cg_id... 1...

... price_break_array ... Array...

... price_break_array value... 0...

 

Warning: Invalid argument supplied for foreach() in /home/catalog/admin/categories.php on line 484

 

( then it showed /admin/function/general.php line 22, header already sent .... ( now, it doesn't show, so I couldn't copy here))

 

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

 

first I installed, SPPC 4.2.2 and checked working fine.

then installed QPBPP 1.3.5 for SPPC 4.2.2 from JanZ & Zappo 2008/11/23 version.

 

as you can see, I tested the values for foreach call,

can someone have answers for it?

this is the portion of the code in /admin/categories.php near that lines.

 

// BOF entries in products_price_break
// TEST *************
echo '... $_POST[products_price_break] ... ' . $_POST['products_price_break'][0] . '...<br><br>';

 foreach ($_POST['products_price_break'] as $pbb_cg_id => $price_break_array) {
// TEST *************
echo '...pbb_cg_id... ' . $pbb_cg_id . '...<br><br>';
echo '... price_break_array ... ' . $price_break_array . '...<br><br>';
echo '... price_break_array value... ' . (int)$_POST['products_qty'][$pbb_cg_id][$price_break_array] . '...<br><br>';

   foreach ($price_break_array as $key1 => $products_price) {
// TEST *************
echo '...key1 ... ' . $key1 . '...<br><br>';
echo '... products_price ... ' . $products_price . '...<br><br>';

     $pb_action = 'insert'; // re-set default to insert
     $where_clause = '';
     if (isset($_POST['products_delete'][$pbb_cg_id][$key1]) && $_POST['products_delete'][$pbb_cg_id][$key1] == 'y' && isset($_POST['products_price_break_id'][$pbb_cg_id][$key1])) {
       $delete_from_ppb_array[] = (int)$_POST['products_price_break_id'][$pbb_cg_id][$key1];
       continue;
     }
     if (!tep_not_null($products_price)) {
       continue; // if price is empty this price break is unused
     } elseif (!tep_not_null($_POST['products_qty'][$pbb_cg_id][$key1])) {
       continue; // if qty is not entered we will not update or insert this in the table
     } else {
       $sql_price_break_data_array = array(
          'products_id' => (int)$products_id,
          'products_price' => (float)$products_price,
          'products_qty' => (int)$_POST['products_qty'][$pbb_cg_id][$key1],
          'customers_group_id' => $pbb_cg_id
          );

       if (isset($_POST['products_price_break_id'][$pbb_cg_id][$key1]) && (int)$_POST['products_price_break_id'][$pbb_cg_id][$key1] > 0) {
         $pb_action = 'update';
         $where_clause = " products_price_break_id = '" . (int)$_POST['products_price_break_id'][$pbb_cg_id][$key1] . "'";
       }
       tep_db_perform(TABLE_PRODUCTS_PRICE_BREAK, $sql_price_break_data_array, $pb_action, $where_clause);
     } // end if/else (!tep_not_null($products_price))
   } // end foreach ($price_break_array as $key1 => $products_price)
 } // end foreach ($_POST['products_price_break'] as $pbb_cg_id => $price_break_array)

// delete the unwanted price breaks using their products_price_break_id's
   if (isset($delete_from_ppb_array) && sizeof($delete_from_ppb_array > 0) && tep_not_null($delete_from_ppb_array[0])) {
     tep_db_query("delete from " . TABLE_PRODUCTS_PRICE_BREAK . " where products_price_break_id in (" . implode(',', $delete_from_ppb_array) . ")");
   }
// EOF entries in products_price_break
// EOF QPBPP for SPPC
////////////////////////////////////////

 

 

thank you all.

 

genesis

Edited by rednme
Link to comment
Share on other sites

Warning: Invalid argument supplied for foreach() in /home/catalog/admin/categories.php on line 484

Are you sure you edited the part around line 1050 to this:

// BOF Separate Pricing per Customer adapted for QPBPP for SPPC
	if (is_array($value)) {
	  while (list($k, $v) = each($value)) {
		if (is_array($v)) {
		  foreach ($v as $subkey => $subvalue) {
			echo tep_draw_hidden_field($key . '[' . $k . '][' . $subkey . ']', htmlspecialchars(stripslashes($subvalue)));
		  }
		} else {
		  echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));
		}
	  }
	} else {
// EOF Separate Pricing per Customer

Link to comment
Share on other sites

Hello all,

this code is causing my attributes to be added twice into the database, what can I do to prevent this. If I remove this code, it will not save anything I put into the separate price box. This code is in categories.php.

 

Any help is appreciated

 

        //        if (!is_array($HTTP_POST_VARS[$key])) {
// BOF Separate Pricing per Customer
if (is_array($value)) {
 while (list($k, $v) = each($value)) {
 echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));
 }
} else {
// EOF Separate Pricing per Customer

Link to comment
Share on other sites

this code is causing my attributes to be added twice into the database, what can I do to prevent this. If I remove this code, it will not save anything I put into the separate price box. This code is in categories.php.

There is no code for attributes on admin/categories.php

Link to comment
Share on other sites

got, it.

actually, there was Webmakers contribution for attributes, which commented out the portion that I edited. I didn't realize that portion was commented out from above about 3 line and about 20 lines down.

I uncommented and it works fine. Great Contributions.

 

thanks, and deep appreciation to you, and you all.

 

genesis.

 

 

Are you sure you edited the part around line 1050 to this:

// BOF Separate Pricing per Customer adapted for QPBPP for SPPC
	if (is_array($value)) {
	  while (list($k, $v) = each($value)) {
		if (is_array($v)) {
		  foreach ($v as $subkey => $subvalue) {
			echo tep_draw_hidden_field($key . '[' . $k . '][' . $subkey . ']', htmlspecialchars(stripslashes($subvalue)));
		  }
		} else {
		  echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));
		}
	  }
	} else {
// EOF Separate Pricing per Customer

Link to comment
Share on other sites

I'd like to be able to show the discounted amount in the shopping cart down by the subtotal so the user knows how much they have saved. I tried to search this thread, but didn't find any info on it - the thread is rather extensive so it is possible I missed it.

 

Has anyone done this?

Link to comment
Share on other sites

  • 2 weeks later...

Really hope someone has an answer. I installed the latest ver of SPPC on a clean Rc2a because not able to get SPPC and Soldout to work together. After installing SPPC, then I uplaoded SoldOut. i've tried with all three of them. I do not get any error messages, it just do what it should.

 

Looking for tips to what I can use from any member out there who has both mod running. I been racking my brain over this for some time now.

 

thanks in advance for your help.

 

blr044

Link to comment
Share on other sites

I thought I had seen this question before but I can not find it after several searches.

 

How do I make it so when a customer creates an account they are automaticly set up in a different customer group.

 

Thanks

Link to comment
Share on other sites

Hello everybody, I have one question:

 

How are attributes prices for price break levels 1, 2 ..., calculated when Price Breaks for SPPC is installed?

 

I have sometimes up to 20 sizes for a same product, plus 3 price break levels:

 

Example: sizes 10 15 20 and quantities/price break levels 1+ 10+ 50+

 

 

¦--------¦---quantity--¦

¦-size-¦1+¦10+¦50+¦

¦S¦ 10¦.52¦ .41¦ .38¦

¦S¦ 15¦.59¦ .47¦ .43¦

¦S¦ 20¦.69¦ .55¦ .50¦

 

 

As I understand it, an attributes price is calculated + or - against a unique actual base price,

first size (here S10, price .52) in a standard oscommerce install.

I have the problem that SPPC and QPB work fine for me on S10 but neither on S15 or S20.

 

Would it be correct to say that on size 15 Price break levels 1(10+ price 0.47) and level 2 (50+ price .43) etc.

should be calculated against the attributes price (.59) depending on the size which itself is derived

from the products' actual base price .52 ?

 

Does somebody have a time saving hint on how this topic is solved, if it is resolved, and if QPB/SPPC are doing it?

Im pretty sure I am missing something obvious.

 

Thanks a lot,

David

david

Link to comment
Share on other sites

I thought I had seen this question before but I can not find it after several searches.

 

How do I make it so when a customer creates an account they are automaticly set up in a different customer group.

This has come up a couple of times indeed. Too lazy to search for it now.

 

You would have to add your logic somewhere in this part (line 176-197 in create_account.php) adding it to $sql_data_array ($sql_data_array['customers_group_id'] => (int)$whatever_your_variable_is;

	if ($error == false) {
  $sql_data_array = array('customers_firstname' => $firstname,
						  'customers_lastname' => $lastname,
						  'customers_email_address' => $email_address,
						  'customers_telephone' => $telephone,
						  'customers_fax' => $fax,
						  'customers_newsletter' => $newsletter,
						  'customers_password' => tep_encrypt_password($password));

  if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
  if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);
// BOF Separate Pricing Per Customer
  // if you would like to have an alert in the admin section when either a company name has been entered in
  // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
  // setting: only alert when a tax_id number has been given
  //	if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) {
  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)  ) {
  $sql_data_array['customers_group_ra'] = '1';
// entry_company_tax_id moved from table address_book to table customers in version 4.2.0
  $sql_data_array['entry_company_tax_id'] = $company_tax_id; 
}
// EOF Separate Pricing Per Customer

Link to comment
Share on other sites

How are attributes prices for price break levels 1, 2 ..., calculated when Price Breaks for SPPC is installed?

Nobody ever wrote a price break for attributes contribution, let alone for SPPC (which would be even more elaborate).

 

I don't think it is impossible basically following the attributes prices for groups logic/QPBPP for SPPC logic but it might be pretty time consuming to write it...

 

So basically the attribute price comes on top of the base or price break price, no "multiples logic" is applied to it.

Link to comment
Share on other sites

Nobody ever wrote a price break for attributes contribution, let alone for SPPC (which would be even more elaborate).

 

I don't think it is impossible basically following the attributes prices for groups logic/QPBPP for SPPC logic but it might be pretty time consuming to write it...

 

So basically the attribute price comes on top of the base or price break price, no "multiples logic" is applied to it.

 

Hello Jan Zonjee,

 

Thanks for your quick answer and foremost for all your contributions.

I was a complet novice in PHP at first and your from all points of view

very interesting contribs helped a lot to learn some PHP and mysql.

 

Ok anyway, I made a site where prices are only estimates. It is online for professionals

only who will get their quotations when they apply for estimates. No problems, would just

have been nice to be able to show them straight away the correct prices.

 

David

david

Link to comment
Share on other sites

Version 2 of the Quantity Price Breaks Per Product for Separate Pricing Per Customer contribution has been uploaded now. It's an enhanced implementation of QPBPP 1.3.5 for SPPC 4.2.2.

A minimum order quantity (different for groups of course) has been implemented (using parts of other contributions).

Improvements on the admin side were made and the display of the price breaks on product_info.php can now be changed to a dropdrown (triggered by a setting in the admin [Configuration->Price breaks] using the number of price breaks for a product.)

You need to have at least MySQL 4.1 to be able to use this addon because of the use of subselects.

 

 

Hi Jan

 

You've posted that QPBPP v2 is for SPPC 4.2.2 which is for RC2a of osCommerce

 

Does QPBPP v2 install/work identically with SPPC 4.2.0 for osCommerce RC1 ?

 

I ask because my site is far too heavily modded from RC1 to easily upgrade to RC2a (it would also break several essential contribs if I upgraded).

 

Thanks

Gaz

Wearing a seatbelt prevents head injuries when the computer crashes - - - Yeah Right!!! - not in this office.

Link to comment
Share on other sites

You've posted that QPBPP v2 is for SPPC 4.2.2 which is for RC2a of osCommerce

 

Does QPBPP v2 install/work identically with SPPC 4.2.0 for osCommerce RC1 ?

I can't tell for sure it would be identically but it can't be far off really. I don't expect major problems and there might be not any problems at all. RC2a had a small change in admin/categories.php so you might find that back. Perhaps it would be easier to use the file from the package and add your other contribution to that?

Link to comment
Share on other sites

Hi Jan,

 

I'm wondering if you can tell me if there's an easy way to change the discount savings per price break to being calculated based on the original price rather than the price of the first break??? I searched through the forum but can't find any mention of how this can be done.

 

Thanks in advance for your help and the great work on SPPC and it's sub-addons!

 

tamaatim

Link to comment
Share on other sites

Really hope someone has an answer. I installed the latest ver of SPPC on a clean Rc2a because not able to get SPPC and Soldout to work together. After installing SPPC, then I uplaoded SoldOut. i've tried with all three of them. I do not get any error messages, it just do what it should.

 

Looking for tips to what I can use from any member out there who has both mod running. I been racking my brain over this for some time now.

 

thanks in advance for your help.

 

blr044

 

I was really someone out there would be using these two contributions together. Like another post out there said, he really wanted his customer to see what he was he/she carrying even though product is sold out. While, I want the same. I've tried and tried, but cannot get the two to work together.

 

i am not a progrramer, and do hope someone can can come up with a solution.

Link to comment
Share on other sites

I'm wondering if you can tell me if there's an easy way to change the discount savings per price break to being calculated based on the original price rather than the price of the first break??? I searched through the forum but can't find any mention of how this can be done.

I don't get it. The discount saving is supposed to be calculated based on the base price for the customer group. It only uses the price break for the minimum order quantity when you have set that. Because: A. you might not have entered that price and B. it doesn't make sense to calculate the discount saving based on an amount you can't order.

Does that explain what you notice?

Link to comment
Share on other sites

Hi Jan,

 

Thanks for the reply and sorry for not explaining it better.

 

I have two customer groups: retail and wholesale/resellers. Basically I want the savings percentage displayed for the wholesale customers to be the savings compared to the retail price so they can see how much they are saving compared to our suggested retail price and can easily calculate how much profit they would make. Right now the savings are displaying their discount compared to the first price break in their customer group.

 

Hope that makes sense now. Please let me know if there is an easy way to do this.

 

Thanks!

Link to comment
Share on other sites

Basically I want the savings percentage displayed for the wholesale customers to be the savings compared to the retail price so they can see how much they are saving compared to our suggested retail price and can easily calculate how much profit they would make.

I don't know how easy this is for you to figure it out but I would add a new variable to the top of PriceFormatter.php like $this->retailPrice = -1;. Then in the function loadProduct I would add:

  // re-set qty blocks and min order qty to 1: do not use values for retail customers
  $product_info['qtyBlocks'] = 1;
  $product_info['products_min_order_qty'] = 1;
  $product_info['retailPrice'] = $product_info['products_price'];

Then add retailPrice also to $price_formatter_data further on and in the part after //Assign members

Similar code should be added to PriceFormatterStore because when a product is already in the shopping cart the function loadProduct gets its data from there.

Then in the function getPriceString($style='productPriceInBox') there is a part that says:

	  // Begin saving calculation
  $base_price = $this->thePrice;

Instead of $this->thePrice; you would use $this->retailPrice;

That should work I think.

Right now the savings are displaying their discount compared to the first price break in their customer group.

That part still doesn't make sense to me unless you added a minimum amount quantity.

Link to comment
Share on other sites

I've installed SPPC v2.2 and it seems to work quite fine (manual installation as several other items also changed). All now seems to work fine, except for one feature: if you try to change the sort order of the product listing (by default the list is sorted on product name & this works fine), I get an SQL error message:

 

<<

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 'order by final_price , pd.products_name limit 0, 50' at line 1

 

select p.products_image, pd.products_name, m.manufacturers_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials_retail_prices s on p.products_id = s.products_id, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '24' order by order by final_price , pd.products_name limit 0, 50

>>

 

I am no SQL wizard, but indeed it seems the last part of the statement is something my version of MySQL cannot translate.

 

Anyone out there that could help me out here?

 

Regards, Philippe

Link to comment
Share on other sites

I've installed SPPC v2.2 and it seems to work quite fine (manual installation as several other items also changed). All now seems to work fine, except for one feature: if you try to change the sort order of the product listing (by default the list is sorted on product name & this works fine), I get an SQL error message:

 

<<

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 'order by final_price , pd.products_name limit 0, 50' at line 1

 

select p.products_image, pd.products_name, m.manufacturers_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials_retail_prices s on p.products_id = s.products_id, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '24' order by order by final_price , pd.products_name limit 0, 50

>>

 

I am no SQL wizard, but indeed it seems the last part of the statement is something my version of MySQL cannot translate.

You say you added this manually. It looks like you overlooked a subtle change in the later osC versions. In the sort_order part of index.php it used to say (only show the first part of it)

	  $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
  $sort_order = substr($HTTP_GET_VARS['sort'], 1);
  $listing_sql .= ' order by ';
  switch ($column_list[$sort_col-1]) {
	case 'PRODUCT_LIST_MODEL':
	  $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
	  break;

In later versions of osC the "order by" was moved to each "case":

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

I assume you still have the line $listing_sql .= ' order by '; in there. Comment it out and see if that helps.

Link to comment
Share on other sites

This has come up a couple of times indeed. Too lazy to search for it now.

 

You would have to add your logic somewhere in this part (line 176-197 in create_account.php) adding it to $sql_data_array ($sql_data_array['customers_group_id'] => (int)$whatever_your_variable_is;

   if ($error == false) {
     $sql_data_array = array('customers_firstname' => $firstname,
                             'customers_lastname' => $lastname,
                             'customers_email_address' => $email_address,
                             'customers_telephone' => $telephone,
                             'customers_fax' => $fax,
                             'customers_newsletter' => $newsletter,
                             'customers_password' => tep_encrypt_password($password),	
						  'customers_advertiser' => $advertiser,
                             'customers_referer_url' => $referer_url);


     if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
     if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);	


// BOF Separate Pricing Per Customer
  // if you would like to have an alert in the admin section when either a company name has been entered in
  // the appropriate field or a tax id number, or both then uncomment the next line and comment the default
  // setting: only alert when a tax_id number has been given
      if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) {
//  if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id)  ) {
     $sql_data_array['customers_group_ra'] = '1';
// entry_company_tax_id moved from table address_book to table customers in version 4.2.0
     $sql_data_array['entry_company_tax_id'] = $company_tax_id;  
  }	  

 

can you show me where to put it so I dont get a blank page on create_account.php

Thanks for your help

Link to comment
Share on other sites

I must not be doing something right. When I add the line:

$sql_data_array['customers_group_id'] => (int)$whatever_your_variable_is;

and change the variable, all I get is a blank page. When I check the error log I see:

PHP Parse error: syntax error, unexpected T_DOUBLE_ARROW in /usr/home/xxxxx/www/htdocs/create_account.php on line 223

Either use $sql_data_array['customers_group_id'] = (int)$whatever_your_variable_is; as "stand alone"

 

or if you have established your variable before this part:

   if ($error == false) {
  $sql_data_array = array('customers_firstname' => $firstname,
						  'customers_lastname' => $lastname,
						  'customers_email_address' => $email_address,
						  'customers_telephone' => $telephone,
						  'customers_fax' => $fax,
						  'customers_newsletter' => $newsletter,
						  'customers_password' => tep_encrypt_password($password),	
						  'customers_advertiser' => $advertiser,
						  'customers_group_id' => (int)$whatever_your_variable_is,
						  'customers_referer_url' => $referer_url);

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.
Note: Your post will require moderator approval before it will be visible.

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