Jump to content
jpweber

Quantity Price Breaks

Recommended Posts

If I click the "update cart" button, the prices then are incorrect, without discount quantities being applied.

Not a clue why that happens but it seems you fixed it on your site now :)

Share this post


Link to post
Share on other sites

Umm, hope someone can help -- racking my brain on this one, really want it to work, cuz it's such a cool feature.

 

Downloaded the latest QPBPP 1.3.5(?) and installed it -- I only have one other contrib, which is optional_realated_products.

 

all seems well, except that I am getting this error when adding a product to the cart which DOES NOT have a price break assigned to it (just a straight up regular price on that product).

 

Notice: Undefined index: price_breaks in /public/shop/includes/classes/PriceFormatter.php on line 109

 

... this line of course is...

 

$this->price_breaks = $price_formatter_data['price_breaks'];

 

here are my particulars:

 

Server Host:	  xxxxxxxxxxx 		 Database Host:	  xxxxxxxxxxxxxx
Server OS: 	Linux 2.6.16.6 		 Database: 	MySQL 4.0.27-standard
Server Date: 	03/02/2009 14:11:36 		 Datebase Date: 	03/02/2009 14:11:36
Server Up Time: 	
HTTP Server: 	Apache
PHP Version: 	5.2.4 (Zend: 2.2.0)

osCommerce 2.2-MS2

 

much appreciation, in advance.

Edited by diZzyCoDeR

Share this post


Link to post
Share on other sites
all seems well, except that I am getting this error when adding a product to the cart which DOES NOT have a price break assigned to it (just a straight up regular price on that product).

 

Notice: Undefined index: price_breaks in /public/shop/includes/classes/PriceFormatter.php on line 109

 

... this line of course is...

 

$this->price_breaks = $price_formatter_data['price_breaks'];

Pretty puzzling. If you add a product to the cart that is not in the cart yet a call is made to includes/shopping_cart.php, function add_cart:

	function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
  global $new_products_id_in_cart, $customer_id;

// BOF qpbpp
  $pf = new PriceFormatter;
  $pf->loadProduct($products_id);
  $qty = $pf->adjustQty($qty);
  $discount_category = $pf->get_discount_category();
// EOF qpbpp

$pf->loadProduct is used with a single argument which in the PriceFormatter.php should trigger two queries:

	} elseif ($listing == NULL) {
  //Collect required data
   $sql = "select pd.products_name, p.products_model, p.products_image, p.products_id," .
  " p.manufacturers_id, p.products_price, p.products_weight, p.products_quantity," .
  " p.products_qty_blocks, p.products_tax_class_id," .
  " IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price," .
  " ptdc.discount_categories_id from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on " .
  " p.products_id = s.products_id left join " . TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES . " ptdc on " .
  " p.products_id = ptdc.products_id, " .
  " " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1'" .
  " and pd.products_id = p.products_id " .
  " and p.products_id = '" . (int)$product_id . "'" .
  " and pd.language_id = '". (int)$language_id ."'";


  $product_info_query = tep_db_query($sql);
  $product_info = tep_db_fetch_array($product_info_query);
  //Price-breaks

	$price_breaks_array = array();
	$price_breaks_query = tep_db_query("select products_price, products_qty from " . TABLE_PRODUCTS_PRICE_BREAK . " where products_id = '" . (int)$product_id . "' order by products_qty");
	while ($price_break = tep_db_fetch_array($price_breaks_query)) {
	  $price_breaks_array[] = $price_break;
	}

Perhaps you should install Output Queries Debug and see if those two queries get executed when you add something to the cart.

Share this post


Link to post
Share on other sites
Pretty puzzling. If you add a product to the cart that is not in the cart yet a call is made to includes/shopping_cart.php, function add_cart:

.

.

Perhaps you should install Output Queries Debug and see if those two queries get executed when you add something to the cart.

 

Thanks for the reply.

 

I'll double-check that code, here is output of the pf / pfs arrays from footer.php (is this appropriate info, or do u like me to install that OQD?) when I add an item w/o any price-break data:

 

PriceFormatterStore Object
(
[priceFormatterData] => Array
	(
		[3] => Array
			(
				[products_name] => Test
				[products_model] => 123456789-10
				[products_image] => screenshot.png
				[products_id] => 3
				[manufacturers_id] => 0
				[products_price] => 15.7500
				[products_weight] => 14.00
				[products_quantity] => 400
				[products_qty_blocks] => 1
				[products_tax_class_id] => 1
				[specials_new_products_price] => 
				[discount_categories_id] => 
			)

	)

)

PriceFormatter Object
(
[thePrice] => -1
[taxClass] => -1
[qtyBlocks] => 1
[price_breaks] => Array
	(
	)

[hasQuantityPrice] => 
[hiPrice] => -1
[lowPrice] => -1
[hasSpecialPrice] => 
[specialPrice] => 
)

Share this post


Link to post
Share on other sites
I'll double-check that code, here is output of the pf / pfs arrays from footer.php (is this appropriate info, or do u like me to install that OQD?) when I add an item w/o any price-break data:

I got the same, sans error...

 

Perhaps the error goes away when you force price_breaks to be in PriceFormatterStore by adding it to the query:(?)

				// now do one query for all products in the shopping basket
  $sql = "select pd.products_name, p.products_model, p.products_image, p.products_id," .
  " p.manufacturers_id, p.products_price, p.products_weight, p.products_quantity," .
  " p.products_qty_blocks, p.products_min_order_qty, p.products_tax_class_id," .
  " IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price," .
  " null as price_breaks, " .
  " ptdc.discount_categories_id from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on " .

Share this post


Link to post
Share on other sites
1054 - Unknown column 'p.products_min_order_qty' in 'field list'

 

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_quantity, p.products_qty_blocks, p.products_min_order_qty, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, null as price_breaks, ptdc.discount_categories_id from products p left join specials s on p.products_id = s.products_id left join products_to_discount_categories ptdc on p.products_id = ptdc.products_id, products_description pd where p.products_status = '1' and pd.products_id = p.products_id and p.products_id in (3) and pd.language_id = '1'

 

odd..?

Share this post


Link to post
Share on other sites
odd..?

Oops. That was in a copy of PriceFormatterStore that I was working on. That feature is already in QPBPP for SPPC but not in the regular QPBPP. Sorry for that. Just wanted to show the addition of the " null as price_breaks, " . line.

Share this post


Link to post
Share on other sites

GONE! NO MORE ERROR! great responses & troubleshooting... tyvm

 

now, is this a kludge or perm. fix? bug? why me? (just curious, maybe this will help someone else... (should it happen to anyone else))

 

love this contrib, btw

Edited by diZzyCoDeR

Share this post


Link to post
Share on other sites
GONE! NO MORE ERROR!

Always good to hear that.

now, is this a kludge or perm. fix? bug? why me? (just curious, maybe this will help someone else... (should it happen to anyone else))

I assume this should be made permanent. Perhaps your PHP error level is different than in a standard osC shop. In that case the warning is hidden in a standard osC installation but that doesn't mean we should ignore it.

Share this post


Link to post
Share on other sites
I assume this should be made permanent. Perhaps your PHP error level is different than in a standard osC shop. In that case the warning is hidden in a standard osC installation but that doesn't mean we should ignore it.

 

Roger.

 

This is with a hosted server... they have a one-click install of OSC and are pretty tight about their security and often slightly behind in their apps. This is not the first time something standard has given me grief.

 

Again, thanks for your help.

Share this post


Link to post
Share on other sites

I have QPBPP running flawlessly on three shops. On the most recent install, I just found out that my customer needs to change his prices frequently so I need to figure out an easy way for him to do so without having to log on to each item individually in the Admin site. I have looked in the past and just finished an exhaustive search but I did find any solutions. Does anyone have a suggestion for a user friendly means of updating multiple quantity discount prices/items at once?

Share this post


Link to post
Share on other sites
Does anyone have a suggestion for a user friendly means of updating multiple quantity discount prices/items at once?

Never seen it either. The Quick price updates contribution do not cater to the QPBPP contribution.

Share this post


Link to post
Share on other sites
Never seen it either. The Quick price updates contribution do not cater to the QPBPP contribution.

 

Thanks for the quick reply.

Share this post


Link to post
Share on other sites

hi,

 

Yesterday I downloaded the qpbpp (version 1.3.5 / osC 2.2 RC2a), after checking the admin page, it is working, however, when I back to the client page for checking, there is nothing on the 'Let's See What We Have Here'. After I checked all of the download files and modification, there is no any wrong. Anyone have any idea on it?

 

And actually, I looked over the new addon after uploaded, the first step is: If some items has price break, I should add the items on discount category, shouldn't I?? if there is no any price break on some items. then I no need add the it to the discount category. right? Am I misunderstanding on the schedule?

 

Sorry about that I am a new user and stupid on it. :blush:

 

Best regards

Carmet

Share this post


Link to post
Share on other sites
Sorry about that I am a new user and stupid on it.

Why don't you download the latest SPPC version of QPBPP. In that you will find a folder documentation. That particular version can do more than the regular QPBPP but hopefully it will explain you better what the discount category etc. is meant for.

Share this post


Link to post
Share on other sites

Thank you so much.

 

It means I need to delete the old one first before I download thıs new enhance version..... right??

 

ok. let me start now....

 

Anyway, thanks for your advice. :)

 

Carmet

Share this post


Link to post
Share on other sites

Hi Jan,

 

Sorry!!

 

I just deleted all my old qpbpp_v1_3_5, and download the SPPC_price_break_v2_0. When I wanted add and alter the table in mySql, I have discovered that I didnt have the table of 'product_groups'. How do I alter this table in Database?? Could you have any orginial of 'product_groups' for my updated?? or Should I go anywhere to download this table?? Please kindly advice.

 

Thanks for your great help.

 

Carmet :o

Share this post


Link to post
Share on other sites
It means I need to delete the old one first before I download thıs new enhance version..... right??

No, I didn't mean that. I only meant to download that contribution for the documentation. That particular version of QPBPP is for use with customer groups (Separate Pricing Per Customer). If you haven't installed that (and it is a very big contribution to install) than you can't use that version.

Share this post


Link to post
Share on other sites

aiyo!!

 

........then how can I do now? :blink: have any advice?? because I am now uploading yours one,but I can't find the 'product_groups'.

 

regards

 

Carmet :(

Share this post


Link to post
Share on other sites

Hi Jan,

 

I really want to have your advice. Sorry about that I dont know too much technique on database. After I saw the SPPC, it was very greatful for the price break of the products. If I deleted all the old one and want to add the SPPC, but I really can't find the 'product_groups' in database. How should I do? or I need to combine the QPBPP 1.3.5 and SPPC 4.2.2??? Could you please give me advice? :blush:

 

Best regards

Carmet

Share this post


Link to post
Share on other sites
After I saw the SPPC, it was very greatful for the price break of the products. If I deleted all the old one and want to add the SPPC, but I really can't find the 'product_groups' in database. How should I do? or I need to combine the QPBPP 1.3.5 and SPPC 4.2.2??? Could you please give me advice?

QPBPP is about the price breaks too. In principle it is the same functionality for a shop. However, the QPBPP for SPPC is specifically adapted for use with customer groups (a bit more complicated to code). You can't add that version to a shop that doesn't have SPPC (the contribution Separate Pricing Per Customer, #716) installed.

 

QPBPP for SPPC does have some features that the regular QPBPP does not have (yet) but someone versed in the PHP art wouldn't have that much problems adding that to the regular QPBPP contribution. I haven't taken/found the time for that.

Share this post


Link to post
Share on other sites
QPBPP is about the price breaks too. In principle it is the same functionality for a shop. However, the QPBPP for SPPC is specifically adapted for use with customer groups (a bit more complicated to code). You can't add that version to a shop that doesn't have SPPC (the contribution Separate Pricing Per Customer, #716) installed.

 

QPBPP for SPPC does have some features that the regular QPBPP does not have (yet) but someone versed in the PHP art wouldn't have that much problems adding that to the regular QPBPP contribution. I haven't taken/found the time for that.

 

Hi Jan,

 

Finally, I found out the 'separate_price_v421', and there has some product_groups and customer_groups that I should add into my database. I want to ask one question that, should I need add all the things of v421 first? and then I modify it to upgrade v422. Am I correct?

 

Hope to get your advice on it.

 

Thank you so much of your contribution.

 

Carmet

Share this post


Link to post
Share on other sites
Finally, I found out the 'separate_price_v421', and there has some product_groups and customer_groups that I should add into my database. I want to ask one question that, should I need add all the things of v421 first? and then I modify it to upgrade v422. Am I correct?

Why do you want to install SPPC just to add the QPBPP version for it (it is a lot of work)?

 

And if you really want to do that you should install the 4.2.2 version. Not 4.2.1 and then upgrade (more work for the same result).

Share this post


Link to post
Share on other sites
Why do you want to install SPPC just to add the QPBPP version for it (it is a lot of work)?

 

And if you really want to do that you should install the 4.2.2 version. Not 4.2.1 and then upgrade (more work for the same result).

 

Hi Jan.

 

Thanks for your advice. It is because there isn't any table of 'products_groups' in my database. So, I think that maybe I need install the 4.2.1 first. Finally, thanks for your advice.

 

From the instruction, there is one instruction which show:

'UPDATE `configuration_group`

SET sort_order = last_insert_id() WHERE `configuration_group_id` = last_insert_id();'.

 

After I insert it to database, it shows 'error message' as below:

________________________________________________________

Error

SQL query:

 

SET sort_order = last_insert_id( ) WHERE `configuration_group_id` = last_insert_id( )

MySQL said:

 

#1193 - Unknown system variable 'sort_order'

_________________________________________________________

Sorry about that I am the new user of oscommerce and didn't know any database knownledge, actually, how to 'UPDATE `configuration_group` into the database?? Can you give me advice on it?

 

Thanks for your attention.

 

Carmet

Share this post


Link to post
Share on other sites

Hi

 

I´m using Quantity Price Breaks Per Product. I´m sitting now since days and try to modify this great contribution without any success.

 

I need the possibility, that the Price Table shows the Standard Price plus the price of an possible and chosen attribute. I´m searching and searching, reading manuals and files. I have no glue anymore.

 

Would you be so kind and give me some hints or a solution.

 

Thank you so much!

 

Phil

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

×