Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Cart Rounding Prices to One Digit if Ends in Zero
Author « Topic »  

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 01/24/2018 :  12:48:30  
I have spent time trying to fix this and now come looking to you "gurus" for help.

My clients cart is rounding product prices that end in zero to only have one decimal place (like $5.20 is showing as $5.2) I tried editing the price in the cart admin area and it still drops off the trailing zero. The admin>states area and the includes file are both set to 2 decimal places.

Please help.

Thanks in advance.

Ray Cramblit

Sinbad
ECT Moderator

USA
65937 Posts

Posted - 01/24/2018 :  13:15:51  
Hi Ray, can you let us know what country is set in the admin main setting more recent versions no longer use the includes for currency setting as that based on the admin main country setting. It can be over-ridden in the includes if needed.

Winners never quit, quitters never win
CSS and Responsive Designs
User Manual for Ecommerce Templates

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 01/24/2018 :  14:48:03  
Country is United States.

Just updated to version 6.84.

BOTH admin area and includes.php are set to 2 decimal places.

Ray Cramblit

Sinbad
ECT Moderator

USA
65937 Posts

Posted - 01/24/2018 :  14:55:10  
Hi Ray, can you comment out the parameters in the includes as they are no longer needed and see if that makes a difference.

Winners never quit, quitters never win
CSS and Responsive Designs
User Manual for Ecommerce Templates

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 01/24/2018 :  17:46:49  
Commented it out and it made no difference.

Ray Cramblit

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 01/24/2018 :  21:03:38  
I looked inside the cart database in phpMyAdmin.

The pPrice field in the products table of the database has a "type" of DOUBLE. I'm a MySQL novice. I never heard of DOUBLE. It seems like it ought to be DECIMAL or something.

Could that be an issue?

Ray Cramblit

Andy
ECT Moderator

95440 Posts

Posted - 01/25/2018 :  00:06:47  
Hi Ray

Can you have a look in the admin countries page and make sure the Decimal Places is set to 2?

Andy

Please feel free to review / rate our software

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 01/25/2018 :  06:32:16  
Just checked again and it is set to 2.

Ray Cramblit

Andy
ECT Moderator

95440 Posts

Posted - 01/25/2018 :  09:35:48  
If you have access to PHPmyadmin, can you check if the price is being stored as 5.20 or 5.2?

Andy

Please feel free to review / rate our software

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 01/25/2018 :  09:43:36  
Product price in database is 5.2 and the field type is set to DOUBLE

Ray Cramblit

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 01/25/2018 :  09:47:07  
This issue only seems to occur when the last number is a zero. 5.20 is saved as 5.2, 6.50 is saved as 6.5 etc

Ray Cramblit

Phil
ECT Moderator

United Kingdom
7715 Posts

Posted - 01/26/2018 :  08:23:38  
Hi Ray,
The field type 'double' is correct.

Can you try going into your countries admin, set the decimal place to zero from the drop down and submit, then reset it back to two places and see if that sorts it out?



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 01/26/2018 :  09:26:06  
I reset to zero then back to 2 with no change.

In the database it shows 2 decimal places. Would it work to change the price field type from DOUBLE to decimal or something?

Ray Cramblit

Andy
ECT Moderator

95440 Posts

Posted - 01/26/2018 :  09:37:41  
I don't think you should change the field type. Do you know what version of PHP / mySQL is running on the server - this shouldn't be a problem unless perhaps it was very old.

Andy

Please feel free to review / rate our software

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 01/26/2018 :  09:50:33  
I just realized that the issue is in my coding.

I have products on the clients index page that features the product image and the price. My PHP script is calling the price directly from the cart database. In the cart database the trailing zero is not visible (like $5.20 is in the database as $5.2). My script just echos the $5.2 from the database. But I see that the price on the product detail page is showing $5.20 so the cart is working correctly showing the $5.20 price.

Sorry for bothering you folks with what is a code issue on my part. I have edited my code and all is well.

Thanks for all who tried to help.

Ray Cramblit
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000