Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

"Safe" remove decimals from prices

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-24-2014, 02:56 AM
 
joeid joeid is offline
 

Member
  
Join Date: Mar 2009
Location: Hungary
Posts: 11
 

Unhappy "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!
__________________
X-Cart 4.6.2
Reply With Quote
  #2  
Old 02-26-2014, 12:45 AM
 
joeid joeid is offline
 

Member
  
Join Date: Mar 2009
Location: Hungary
Posts: 11
 

Default Re: "Safe" remove decimals from prices

Nobody ?
__________________
X-Cart 4.6.2
Reply With Quote
  #3  
Old 02-27-2014, 06:10 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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']));
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #4  
Old 02-28-2014, 03:02 AM
 
joeid joeid is offline
 

Member
  
Join Date: Mar 2009
Location: Hungary
Posts: 11
 

Default 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 ?
__________________
X-Cart 4.6.2
Reply With Quote
  #5  
Old 02-28-2014, 08:17 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: "Safe" remove decimals from prices

1. That might be cached, or double-check it is entered correctly
2. Have you tried it?
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #6  
Old 03-03-2014, 02:10 AM
 
joeid joeid is offline
 

Member
  
Join Date: Mar 2009
Location: Hungary
Posts: 11
 

Default 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!
__________________
X-Cart 4.6.2
Reply With Quote
  #7  
Old 03-17-2014, 06:24 AM
 
joeid joeid is offline
 

Member
  
Join Date: Mar 2009
Location: Hungary
Posts: 11
 

Default Re: "Safe" remove decimals from prices

No solution ?
__________________
X-Cart 4.6.2
Reply With Quote
  #8  
Old 09-20-2014, 01:20 AM
 
xtech xtech is offline
 

X-Adept
  
Join Date: Jun 2010
Posts: 605
 

Default 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?
__________________
X-cart Platinum
4.6.1
Reboot template
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:31 AM.

   

 
X-Cart forums © 2001-2020