Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to change from DOT (.) to COMMA (,) when you put in prices in Admin?


hydrolift

Recommended Posts

How to use comma instead of dot in the shop I know howto. Just change in table "currencies".

 

But how do I change so I can use comma when I put in price for a product in admin?

I wan't it to be a safe way so any modules stop to work or the orderprocess freaks out, and the cardpayment stop to work. :blink: ;)

 

1500,00 instead of 1500.00

 

And as a bonus I wonder how to change from comma to only a space for every thousand? I've tried to use " " but it put out a & instead of a space:

 

1&500 instead of 1 500

Link to comment
Share on other sites

I try again! :rolleyes:

 

I've found that in VirtueMart they also had a function "updateGross" where it is a function to change a comma "," to a dot ".".

How to implent that in osCommerce "updateGross"?

 

Here is the code for VirtueMart:

function updateGross() {

if( document.adminForm.product_price.value != '' ) {

var taxRate = getTaxRate();

 

var r = new RegExp("\,", "i");

document.adminForm.product_price.value = document.adminForm.product_price.value.replace( r, "." );

 

var grossValue = document.adminForm.product_price.value;

 

if (taxRate > 0) {

grossValue = grossValue * (taxRate + 1);

}

 

document.adminForm.product_price_incl_tax.value = doRound(grossValue, 5);

}

}

Here is the code for osCommerce where "var r" should be implented:

[qoute]

function updateGross() {

var taxRate = getTaxRate();

var grossValue = document.forms["new_product"].products_price.value;

 

if (taxRate > 0) {

grossValue = grossValue * ((taxRate / 100) + 1);

}

 

document.forms["new_product"].products_price_gross.value = doRound(grossValue, 4);

}

 

Here is the form in osCommerce:

<td class="smallText"><?php echo tep_draw_separator('pixel_trans.gif', '24', '1') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>

 

 

And then bonus, how to get rid of the "&" when using " "... ;)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...