Jump to content

Hide decimals from order form


Juanzo

Recommended Posts

At our cloud slider order form, decimals make the price look bigger so we want to hide them.

 

For example, the code used at the Cloud Slider order for is:

 

jQuery("#priceTop").html(displayPrice);
jQuery("#priceBottom").html(displayPrice);

 

At this thread, gpw posted the following code to remove decimals:

 

{$CODE|round|number_format}

 

Any idea on how to apply this, or any other code, so that decimals are not shown at the order form?

Link to comment
Share on other sites

Any idea on how to apply this, or any other code, so that decimals are not shown at the order form?

if you're talking about the products.tpl page, the problem you're going to have is that the price isn't a number - it's a string (e.g $100.00 USD) - so you can't perform any maths functions on it.

 

but if you treat it as a string, you can do many other things to adjust it... e.g looking at your website, the prices all seem to end in .00 - therefore, you can just remove that from your prices by changing ~line243 products.tpl...

 

                "displayPrice": "{$product.pricing.minprice.price}",

to...

                "displayPrice": "{$product.pricing.minprice.price|replace:'.00':''}",

 

QLuPJTW.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated