Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 02-22-2018 15:09:20

davezx
Member
Registered: 02-03-2006
Posts: 40

Discount Percentage doesn't seem to be working correctly

On some of our customer's products, the discount is not calculating correctly. In this example, regprice is $321.60 and the saleprice is $289.44. Instead of showing 10% discount, it's showing 11% discount. Is there a way to fix this. Please see:

http://www.arnoldstobacco.com/index.php … mp;ref=779

Thanks

David

Offline

 

#2 02-23-2018 10:33:08

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19512
Website

Re: Discount Percentage doesn't seem to be working correctly

In the file {private}/apps/ecom/ECOM/includes/pricedisp.php, you'll see a ciel() function called three times.  On the first two which are run to get discount percentages (the last one is for loyalty points), change ceil() to floor().  This will have the effect of rounding down all percentages to the nearest integer, instead of rounding up.


Nick Hendler

Offline

 

#3 02-23-2018 10:41:02

davezx
Member
Registered: 02-03-2006
Posts: 40

Re: Discount Percentage doesn't seem to be working correctly

Thanks, that worked

Regards,

David

Offline

 

#4 02-27-2018 13:57:59

davezx
Member
Registered: 02-03-2006
Posts: 40

Re: Discount Percentage doesn't seem to be working correctly

Actually, it worked on one product, but not on some others. Please see:

http://www.arnoldstobacco.com/index.php … mp;ref=770

It should be 10% but showing up as 9%

Regards,

David

Offline

 

#5 02-27-2018 13:59:45

davezx
Member
Registered: 02-03-2006
Posts: 40

Re: Discount Percentage doesn't seem to be working correctly

I just removed the @floor function, and it's now working on the other product. Will this affect anything else?

Offline

 

#6 02-27-2018 17:41:12

davezx
Member
Registered: 02-03-2006
Posts: 40

Re: Discount Percentage doesn't seem to be working correctly

It still didn't completely work, so I searched for a "." and truncated the string.

Offline

 

#7 02-28-2018 09:08:43

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19512
Website

Re: Discount Percentage doesn't seem to be working correctly

This doesn't affect anything but the displays you're working with.  You may want to use round() instead of floor() or ceil().


Nick Hendler

Offline

 

Board footer