Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Quantity Price Breaks


jpweber

Recommended Posts

Oops :blush:

 

Fixed it in version 1.3.2b as of now.

 

Thanks Greg :thumbsup:

 

Hi Jan:

Now I have update to 1.32b and install to one heavy module osc site.

If don't setup discount catalog from admin, the following two attributes calculate_price work normally.

if setup discount catalog from admin , the following two attributes calculate_price is wrong, from 1.31, 1.31a, 1.31b both have this issue. This issue is from 1.31 :)

Would you please help to check asap? Thanks you very much!

 

Available Options:

Cake Greeting:Writing on Image (WRI) (+$2.00)

Sheet Type:A3 sheet (+$12.00)

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

Cake Greeting:None

Sheet Type:A4 sheet (+$2.00)

 

Best Regards,

Edited by sunrise99
Link to comment
Share on other sites

I am not sure if I am still having the problem in my previous post, but I re-did the pages again, and am now having this error:

 

Call to undefined method shoppingCart::get_product_id_list() in /var/www/html/catalog/includes/classes/PriceFormatterStore.php on line 22

 

Line 22 being:

$product_id_list = $cart->product_id_list();

 

I searched this problem and Jan found that you once told someone to go back to RC2a for the currencies.php file, but that was when they were having this problem on the shopping_cart.php, I am not sure if I should go to the same with it being on PriceFormatterStore.php, but if it is, do you have a link to that one?

 

I am really trying to search as much as I can for these problems, because I am sure you have better things to deal with.

 

Any suggestions?

 

Thank you.

Link to comment
Share on other sites

I am not sure if I am still having the problem in my previous post, but I re-did the pages again, and am now having this error:

 

Call to undefined method shoppingCart::get_product_id_list() in /var/www/html/catalog/includes/classes/PriceFormatterStore.php on line 22

 

Line 22 being:

$product_id_list = $cart->product_id_list();

It could be that merging those two contributions wrongly (product option type is a bit of a disaster if you ask me, instead of adapting the code to the version of osC the contributions opted to keep the old code messing up all other contributions...) could mean that the last brace } if overlapping that function, making it not visible for the code.

 

$currencies->calculate_price is indeed a new function that was added in later versions of osC (I think starting with RC1). You would need to add that function from a download of RC2a.

Link to comment
Share on other sites

Hi Jan:

Now I have update to 1.32b and install to one heavy module osc site.

If don't setup discount catalog from admin, the following two attributes calculate_price work normally.

if setup discount catalog from admin , the following two attributes calculate_price is wrong, from 1.31, 1.31a, 1.31b both have this issue. This issue is from 1.31 :)

Would you please help to check asap? Thanks you very much!

 

Available Options:

Cake Greeting:Writing on Image (WRI) (+$2.00)

Sheet Type:A3 sheet (+$12.00)

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

Cake Greeting:None

Sheet Type:A4 sheet (+$2.00)

There are no versions 1.31a and 1.31b and what has QPBPP or the discount category to do with calculating attributes? You don't mention what is wrong with your attributes either.

Link to comment
Share on other sites

It could be that merging those two contributions wrongly (product option type is a bit of a disaster if you ask me, instead of adapting the code to the version of osC the contributions opted to keep the old code messing up all other contributions...) could mean that the last brace } if overlapping that function, making it not visible for the code.

 

$currencies->calculate_price is indeed a new function that was added in later versions of osC (I think starting with RC1). You would need to add that function from a download of RC2a.

 

I know it is probably a lot to ask for, but by any chance is there a manual upgrade from version 1.3.1 to the new 1.3.2b so that people who already have it installed can simply make the updates page by page, to try and avoid mistakes, to fix the problem that you created a new one for?

 

It is of course possible without it, it just seems like it might be easier with.

Link to comment
Share on other sites

I know it is probably a lot to ask for, but by any chance is there a manual upgrade from version 1.3.1 to the new 1.3.2b so that people who already have it installed can simply make the updates page by page, to try and avoid mistakes, to fix the problem that you created a new one for?

 

It is of course possible without it, it just seems like it might be easier with.

 

You can add the following code into includes/classes/currencies.php on Line 50 if you use old osc.

	function calculate_price($products_price, $products_tax, $quantity = 1) {
  global $currency;

  return tep_round(tep_add_tax($products_price, $products_tax), $this->currencies[$currency]['decimal_places']) * $quantity;
}

Edited by sunrise99
Link to comment
Share on other sites

Hi Jan:

have little bug when one product is setup discount and another product isn't setup discount from admin, when we add these two product into cart , display the following error:

 

Warning: Invalid argument supplied for foreach() in /home/sunri23/public_html/demo/oscdemo/includes/classes/PriceFormatter.php on line 146

 

This issue can be fixed on line 146 from:

	foreach($this->price_breaks as $price_break) {
  if ($qty >= $price_break['products_qty']) {
	$price = $price_break['products_price'];
  }
}

return $price;
 }

 

into

	 if(is_array($this->price_breaks)) {				  //add by sunrise
foreach($this->price_breaks as $price_break) {
  if ($qty >= $price_break['products_qty']) {
	$price = $price_break['products_price'];
  }
}

return $price;
  }
 } //add

 

Would you please help to verify asap?

 

Best Regards,

Edited by sunrise99
Link to comment
Share on other sites

Hi Jan:

have little bug when one product is setup discount and another product isn't setup discount from admin, when we add these two product into cart , display the following error:

 

Warning: Invalid argument supplied for foreach() in /home/sunri23/public_html/demo/oscdemo/includes/classes/PriceFormatter.php on line 146

 

This issue can be fixed on line 146 from:

	foreach($this->price_breaks as $price_break) {<BR>	  if ($qty >= $price_break['products_qty']) {<BR>		$price = $price_break['products_price'];<BR>	  }<BR>	}<BR><BR>	return $price;<BR>  }

 

into

	 if(is_array($this->price_breaks)) {				  //add by sunrise<BR>	foreach($this->price_breaks as $price_break) {<BR>	  if ($qty >= $price_break['products_qty']) {<BR>		$price = $price_break['products_price'];<BR>	  }<BR>	}<BR><BR>	return $price;<BR>   }<BR>  } //add

 

Would you please help to verify asap?

 

Best Regards,

 

need update to:

 

into

 <DIV class=codetop>	 if(is_array($this->price_breaks)) {				  //add by sunrise<BR>	foreach($this->price_breaks as $price_break) {<BR>	  if ($qty >= $price_break['products_qty']) {<BR>		$price = $price_break['products_price'];<BR>	  }<BR>	}<BR>	} //add<BR>	return $price;<BR>   }<BR><BR></DIV>

Link to comment
Share on other sites

Hi, just installed QPBPP v1.32b on a fresh osCommerce Online Merchant v2.2 RC2a on a server with PHP 5.2.5 and MySQL 4.1.22.

 

The admin section works great, except with adding a new product it shows error:

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /sites/XXXX/www/admin/categories.php on line 715

This error doesn't show up anymore after the product is added and you'll edit it.

 

If you go now to the public catalog, every product listing will end up in error:

1052 - Column 'products_id' in where clause is ambiguous

select p.products_id, p.products_quantity, p.products_weight, discount_categories_id from products p left join products_to_discount_categories using(products_id) where products_id in (28)

[TEP STOP]

 

If i click rightaway on the newest product then on the productpage all prices are 0, the discount shows correct. If i check it in the admin area, the prices are good in the QPBPP discount table.

 

Is there coming a fix for this?

 

PS:

 

Just tested to use version 1.3.0 and 1.3.1, this versions doesn't have problems with showing a productlist in the public catalog. But still it still doesn't show prices.

Edited by flippo
Link to comment
Share on other sites

Hi, just installed QPBPP v1.32b on a fresh osCommerce Online Merchant v2.2 RC2a on a server with PHP 5.2.5 and MySQL 4.1.22.

1052 - Column 'products_id' in where clause is ambiguous

select p.products_id, p.products_quantity, p.products_weight, discount_categories_id from products p left join products_to_discount_categories using(products_id) where products_id in (28)

[TEP STOP]

Interesting these variations between MySQL versions. I use 5 and it didn't have that problem. Just change the products_id in that query to p.products_id and you should be fine.

Just tested to use version 1.3.0 and 1.3.1, this versions doesn't have problems with showing a productlist in the public catalog. But still it still doesn't show prices.

Never mind the problems with 1.3.0 and 1.3.1 but it didn't have a problem with the product list :)

Link to comment
Share on other sites

I was really hopping that I would not have to bug you again, but then this error just popped up out of the blue, very weird because I did not change any code:

 

Warning: Missing argument 3 for PriceFormatter::loadProduct(), called in /var/www/html/catalog/product_info.php on line 121 and defined in /var/www/html/catalog/includes/classes/PriceFormatter.php on line 35

 

Warning: Missing argument 4 for PriceFormatter::loadProduct(), called in /var/www/html/catalog/product_info.php on line 121 and defined in /var/www/html/catalog/includes/classes/PriceFormatter.php on line 35

 

Line 121 on product_info.php starts with:

$pf->loadProduct((int)$_GET['products_id'], (int)$languages_id);
   $products_price=$pf->getPriceString();

 

Line 35 on PriceFormatter.php starts with:

function loadProduct($product_id, $products_price, $products_tax_class_id, $qtyBlocks, $price_breaks_array = NULL)
 {
   global $pfs;

 

Any clue what went wrong?

 

Thanks for your help - Brittany

Link to comment
Share on other sites

Line 35 on PriceFormatter.php starts with:

function loadProduct($product_id, $products_price, $products_tax_class_id, $qtyBlocks, $price_breaks_array = NULL)
 {
global $pfs;

No, it starts with (as of version 1.3.2):

  function loadProduct($product_id, $language_id = 1, $listing = NULL, $price_breaks_from_listing = NULL) {

Any clue what went wrong?

Yes, you are mixing the old contribution with the new one. I wrote in the changelog which files were changed...

Link to comment
Share on other sites

Hi Jan:

have little bug when one product is setup discount and another product isn't setup discount from admin, when we add these two product into cart , display the following error:

 

Warning: Invalid argument supplied for foreach() in /home/sunri23/public_html/demo/oscdemo/includes/classes/PriceFormatter.php on line 146

 

This issue can be fixed on line 146 from:

	foreach($this->price_breaks as $price_break) {
  if ($qty >= $price_break['products_qty']) {
	$price = $price_break['products_price'];
  }
}

return $price;
 }

 

into

	 if(is_array($this->price_breaks)) {				  //add by sunrise
foreach($this->price_breaks as $price_break) {
  if ($qty >= $price_break['products_qty']) {
	$price = $price_break['products_price'];
  }
}

return $price;
  }
 } //add

 

Would you please help to verify asap?

It should not need this because I made sure that $this->price_breaks is always an array even if empty.

 

But since not everybody is perfect in adding contributions it doesn't hurt another check although in that case you might as well check on the size of the array (no need to go through an empty array)

	 if(is_array($this->price_breaks) && count($this->price_breaks > 0)) {   //add by sunrise
foreach($this->price_breaks as $price_break) {
  if ($qty >= $price_break['products_qty']) {
	$price = $price_break['products_price'];
  }
}

return $price;
  }
 } //add

Link to comment
Share on other sites

Hi, just installed QPBPP v1.32b on a fresh osCommerce Online Merchant v2.2 RC2a on a server with PHP 5.2.5 and MySQL 4.1.22.

 

The admin section works great, except with adding a new product it shows error:

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /sites/XXXX/www/admin/categories.php on line 715

This error doesn't show up anymore after the product is added and you'll edit it.

This error was mentioned a few pages back and a solution given a few posts later. I ignored it because in the posts above, the poster referenced to code that was mangled in the install instructions. Looks like that had nothing to do with this particular error.

Link to comment
Share on other sites

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /sites/XXXX/www/admin/categories.php on line 715

 

IMO the best solution would be to change that line 715 to:

				if (is_array($price_breaks_array) && array_key_exists($count, $price_breaks_array)) {

Seems to work fine now.

Link to comment
Share on other sites

Hi,

 

I must bother you with a question. I am creating a dealer shop system and I installed the contribution "Quantity Price Breaks Per Product (QPBPP)".

I want to show the recommended retail price and 3 different graduated prices.

I use the original price field as recommended retail price and the other 3 prices are shown as graduated prices.

Everything is working very well, but my problem is that the graduated prices should be shown without tax and the

"original price" should be shown with tax.

 

So I need help! The function "Show prices with tax" in admin panel must set on true, so that the original prices rest correct

and then I must change the code, that the other prices will be shown without tax.

 

I hope somebody already realised a solution otr somebody else likes to help me.

 

THANK YOU!!!!

Dris

Link to comment
Share on other sites

Perhaps you didn't change the class PriceFormatterStore.php?

 

Thanks, I managed to solve the problem, it was due to the fact that I used QPBPP_v1_3_2, when I changed it to QPBPP_v1_3_2b my problem was fixed

 

Now I have another problem, when sending values greater than 999.9$ I'm getting a parameter error, I'm passing these values to 2checkout. I guess the problem with values larger than $999 a comma "," gets inserted any suggestion how can I fix this.

Link to comment
Share on other sites

Thanks, I managed to solve the problem

Good to hear

Now I have another problem, when sending values greater than 999.9$ I'm getting a parameter error, I'm passing these values to 2checkout. I guess the problem with values larger than $999 a comma "," gets inserted any suggestion how can I fix this.

Try the payment modules forum. There is one for 2checkout specifically I think. Surely you are not the first to experience that problem.

Link to comment
Share on other sites

I just installed QPBPP_v1_3_2b. Everything seems to work except when I click on the category buttons in the store. I get the following error message.

1052 - Column 'products_id' in where clause is ambiguous

select p.products_id, p.products_quantity, p.products_weight, discount_categories_id from products p left join products_to_discount_categories using(products_id) where products_id in (28,32,45,30,31,44,33)

[TEP STOP]

 

Someone mentioned this error message earlier in the thread but I did not understand the solution posted by Jan. My understanding of PHP is pretty limited. Any instruction on how to fix the error would be appreciated.

 

Thanks

Link to comment
Share on other sites

Any instruction on how to fix the error would be appreciated.

File: includes/modules/product_listing.php

Change (line 92):

	$discount_category_query = tep_db_query("select p.products_id, p.products_quantity, p.products_weight, discount_categories_id from " . TABLE_PRODUCTS ." p left join " . TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES . " using(products_id) where products_id in (" . implode(',', $list_of_prdct_ids) . ")");

To:

	$discount_category_query = tep_db_query("select p.products_id, p.products_quantity, p.products_weight, discount_categories_id from " . TABLE_PRODUCTS ." p left join " . TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES . " using(products_id) where p.products_id in (" . implode(',', $list_of_prdct_ids) . ")");

So where products_id in becomes where p.products_id in

Link to comment
Share on other sites

Hello!

 

I`m Nikko - a new user of the contribution - and my english ist not very good. But I think, that you understand my question:

 

Can I disable the table (1+, 2+, 3+........) on the product-page, or is the table a "MUST HAVE" (required) for the correct function of the script?

I mean this table:

Visit My Website

And if I can disable the table, in which *.php I must do this? - I have tested the product_info.php in root, but I think, it is not the right.

 

If I have disable the table, I like show the "FROM PRICE" like here:

Visit My Website 2

 

What must I do?? Pls send me a PM or post it here.

 

Thanks!!!

 

Nikko

Link to comment
Share on other sites

Can I disable the table (1+, 2+, 3+........) on the product-page, or is the table a "MUST HAVE" (required) for the correct function of the script?

No, you can even go back to your backup and not use the QPBPP code on that page at all. Won't make any difference.

If you want to show the From: 10.00EUR as in product listing you should try using $products_price = $pf->getPriceStringShort(); instead of $products_price = $pf->getPriceString();

Link to comment
Share on other sites

I have installed latest OSC and QPBPP (downloaded 12 may 2008) - All seems to work OK

 

I have just one problem, the quanity block seems to work, but only when adding a product to the cart, the first time adding a product it suggests the block quantity, but then it is possibel to change the quantity to a number below the quantity block, then checkout etc. proceeds without any correction of the quantity. (or warning)

 

I expected that it would be impossible to order a quantity which did mot match the "quantity block" rule

 

Is this normal behaviour or do I have a problem with my installation. ?

 

What I really want to do is to just have a minimum quantity for a product - I tried the patch in install.html FAQ's and it works - but again it is posibble to change the quanity to something below the minimum and then check out / order that quantity

 

Can you suggest a fix if the rule is not enforced in the standard contribution ?

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