X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   "Safe" remove decimals from prices (https://forum.x-cart.com/showthread.php?t=68716)

joeid 02-24-2014 02:56 AM

"Safe" remove decimals from prices
 
Hi

I tried some solutions, but none "perfect".

1., I tried this SQL patch, it doesn't do anything.
Code:

UPDATE xcart_config SET variants="2.,:1,999.53\n2.:1999.53\n2, :1 999,53\n2,.:1.999,53\n0  :1 999" WHERE name="number_format";

2., I tried change the price field in xcart_pricing SQL table "decimal (12,2)" to "decimal (12,0)", it doesn't do anything.

3., I tried change in modifier.formatprice.php "precision= Null" to "precision= 0".
It's working only on admin page, but not working on storefront.

4., I tried add this code for fuction.currency.php:
Code:

$_tmp = strtr($_tmp, array(".00"=>""));

and combined with 1-3 step.

Great , it's working, but it's remove the decimals from weight...grrr.

I'm now very nervous...I only want remove/hide .00 in price.
Eg. 1980.00 to 1980

Why this is so complicated ?

Anybody can help me ?

THX![-o<

joeid 02-26-2014 12:45 AM

Re: "Safe" remove decimals from prices
 
Nobody ?

cherie 02-27-2014 06:10 PM

Re: "Safe" remove decimals from prices
 
One option is to add another format to number_format in the config table of the database. Then select it in the Appearance settings.

Or if you just want to change that currency function then I would adjust the following line similar to the change you were wanting to make:

$result .= str_replace('$', $config['General']['currency_symbol'] , str_replace('x', $cf_value, $config['General']['currency_format']));

joeid 02-28-2014 03:02 AM

Re: "Safe" remove decimals from prices
 
Quote:

Originally Posted by cherie
One option is to add another format to number_format in the config table of the database. Then select it in the Appearance settings.

Or if you just want to change that currency function then I would adjust the following line similar to the change you were wanting to make:

$result .= str_replace('$', $config['General']['currency_symbol'] , str_replace('x', $cf_value, $config['General']['currency_format']));


1., I tried add new value for xcart_config tablet numeric_format, but it's do nothing (not show new number fromating on admin).

2., I think this soluton not good for me, becuase if i want export prices, the decimals will show...or not ?

cherie 02-28-2014 08:17 AM

Re: "Safe" remove decimals from prices
 
1. That might be cached, or double-check it is entered correctly
2. Have you tried it?

joeid 03-03-2014 02:10 AM

Re: "Safe" remove decimals from prices
 
Quote:

Originally Posted by cherie
1. That might be cached, or double-check it is entered correctly
2. Have you tried it?


1., Yes, i checked repeatedly and clean caches etc, but does not work

2., No, but i found this code in function.currency.php. Need to add other files ?

THX!

joeid 03-17-2014 06:24 AM

Re: "Safe" remove decimals from prices
 
No solution ? :(

xtech 09-20-2014 01:20 AM

Re: "Safe" remove decimals from prices
 
Quote:

Originally Posted by cherie
One option is to add another format to number_format in the config table of the database. Then select it in the Appearance settings.

Or if you just want to change that currency function then I would adjust the following line similar to the change you were wanting to make:

$result .= str_replace('$', $config['General']['currency_symbol'] , str_replace('x', $cf_value, $config['General']['currency_format']));



Can you please let me know how to do this on 4.6.1 Platinum?

To display prices without decimal part you will need to modify this "function smarty_function_currency" in the following script:

<xcart_dir>/include/templater/plugins/function.currency.php

is it so?


All times are GMT -8. The time now is 09:52 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.