WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: ronald32 on March 25, 2012, 12:38:10 PM

Title: Pay nothing for your order >>> problem: item in Dutch Media
Post by: ronald32 on March 25, 2012, 12:38:10 PM
today in the Dutch media:
http://www.melf.nl/algemeen/9393/cda-blameert-zich-met-webshop-andere-partijen-ook-vatbaar/

The problem:
order some products en change the number of items in a negative number.
order some other products of the same amount. And you wil pay nothing (except from the handling costs)
The "positive" number - the "negative" number = 0
This problem seems also to occur in Bakery...

It would be nice if this can be solved

Tested in version: 1.59

greetings
Ronald

Title: Re: Pay nothing for your order >>> problem: item in Dutch Media
Post by: Ruud on March 25, 2012, 11:51:34 PM
I can confirm that putting a negative amount in the overview (and refresh the cart) can lower the amount to pay, or even set it negative.
A check on view.php after line 315 on negative values should be good to prevent this.

A quickfix would be to put on line 316
Code: (untested) [Select]
if ($quantity < 0) $quantity = 0;
Ruud
Title: Re: Pay nothing for your order >>> problem: item in Dutch Media
Post by: ronald32 on March 26, 2012, 09:03:44 AM
Great, it works!
Thanks

Ronald
Title: Re: Pay nothing for your order >>> problem: item in Dutch Media
Post by: dbs on March 26, 2012, 07:58:12 PM
thanks ruud!

but it is/was not really a problem for the shop-owner.
only more emails to write. *g*
Title: Re: Pay nothing for your order >>> problem: item in Dutch Media
Post by: freeSbee on March 26, 2012, 08:25:31 PM
Hi Ronald

Thank you for giving this hint.

Another fix than suggested by Ruud - thanks Ruud for the quick fix! - would be to use the php function abs(). This way the quantity is retained and the item in cart will not be deleted, in other words it will remain in cart.

Search line 315 in view.php
Code: [Select]
$quantity =strip_tags($quantity);and replace it by
Code: [Select]
$quantity = abs(strip_tags($quantity));
Regards Christoph
Title: Re: Pay nothing for your order >>> problem: item in Dutch Media
Post by: dbs on March 27, 2012, 08:06:48 AM
yepp, a better solution.
Title: Re: Pay nothing for your order >>> problem: item in Dutch Media
Post by: ronald32 on March 27, 2012, 02:15:14 PM
And the line: if ($quantity < 0) $quantity = 0; (suggestion from Ruud)
Should must that be erased?

Ronald
Title: Re: Pay nothing for your order >>> problem: item in Dutch Media
Post by: freeSbee on March 28, 2012, 09:04:39 AM
Hi Ronald

And the line: if ($quantity < 0) $quantity = 0; (suggestion from Ruud)
Should must that be erased?

Yes, either
Code: [Select]
if ($quantity < 0) $quantity = 0;or
Code: [Select]
$quantity = abs(strip_tags($quantity));
Regards Christoph