Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

How to add space between currency symbol and price?

Community Beginner ,
Aug 23, 2012 Aug 23, 2012

Hello,

Can you please guide me how to add space between currency symbol and price?

Support told me to ask this in forums because it is done with JavaScript and it is not covered in official documentation.

Anyone have done this? I would like to transform RON13,20 in 13,20 RON or USD32,90 in 32,90 USD.

Thanks!

TOPICS
eCommerce
2.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Aug 28, 2012 Aug 28, 2012

Hello.

I test it and it is working.

If anybody need it this is how i did it.

I modified Modules Templates-> Online Shop Layouts -> Overall Layout.

I added at the end of the HTML code the following JS code:

<script type="text/javascript">

$(document).ready(function(){

$('.newprice').each(function(i, el){

var valoare = $(this).html().substr(10);

$(this).html('<div class="pret_ron">Pret: ' + valoare + ' RON</div>')

})

$('.oldprice').each(function(i, el){

var valoare = $(this).html().substr(3);

if($(this).html(

...
Translate
Mentor ,
Aug 24, 2012 Aug 24, 2012

Hi Bogdan,

I did some testing in in Chrome console quickly and I think you can use this approach:

var price = "RON12.40"

var altered = price.substr(3);

altered

"12.40"

var new_price = altered+" RON"

new_price

"12.40 RON"

That will convert the price format to Romanian format. All you need to do is add some jQuery that will grab the price of each product and apply this code to it.

This is the link that will take you through it http://api.jquery.com/each/

Cheers,

-mario

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2012 Aug 24, 2012

Hello,

Thank you for reply Mario.

I will test it and let you know how it worked.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2012 Aug 28, 2012

Hello.

I test it and it is working.

If anybody need it this is how i did it.

I modified Modules Templates-> Online Shop Layouts -> Overall Layout.

I added at the end of the HTML code the following JS code:

<script type="text/javascript">

$(document).ready(function(){

$('.newprice').each(function(i, el){

var valoare = $(this).html().substr(10);

$(this).html('<div class="pret_ron">Pret: ' + valoare + ' RON</div>')

})

$('.oldprice').each(function(i, el){

var valoare = $(this).html().substr(3);

if($(this).html() != ''){ $(this).html(valoare + " RON")  }

})

})

</script>

The result can be seen here: http://magazindepiese.worldsecuresystems.com/accesorii/chimice?Page=1&Items=12

Instead of PRICE: RON22,62 now it is PRET: 22,62 RON which is correct for Romania.

Thanks Mario!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 28, 2012 Aug 28, 2012

Thanks for sharing that solution with our community, Bogdan!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 31, 2012 Aug 31, 2012

With pleasure

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 28, 2013 Feb 28, 2013
LATEST

Thanks Bogdan and Mario,

I use this solution for my productlist on this page: http://hafenmannheim.businesscatalyst.com/shop

It works great. One question: How can I change the price in the module shoppingcartsummary?

Any suggestions?

cheers, wallibert

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines