cancel
Showing results for 
Search instead for 
Did you mean: 

4 Decimal places?

4 Decimal places?

Hello,

 

Is it possible to calculate product custom option prices to 4 decimal places?

 

Example: My store will sell 10,000 business cards for 0.0089 per card. 

 

I am new to Magento, and so far I'm impressed, but I can't believe Magento does not have this functionality!

 

 

 

  • I have tried many suggestions online but none work for me.

 

If would really appreciate if anybody has any advice on this Smiley Happy

9 REPLIES 9

Re: 4 Decimal places?

@Brianw

 

For this you need to change the default magento decimal place count. This will help you with it. http://magento.stackexchange.com/questions/36600/remove-precision-from-price-of-a-product

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: 4 Decimal places?

Thank you for your suggestion. It works on the base price, but not for custom options, any ideas?

Re: 4 Decimal places?

Check in the .js file of the Custom Options.

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: 4 Decimal places?

Do you know tha file-path for that file? Sorry I'm only starting my Magento journey it would be a needle in a haystack for me!

Re: 4 Decimal places?

You can find the file on the below path:
Magento-Root/js/varien/product.js

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now

Re: 4 Decimal places?

Thanks, I'm still at a loss here I've no experience with js, I've tried some suggestions on other forums but I'm afraid I'll cause problems messing with the file. Do you know how I should edit this file to get the desired results?

 

Sorry for bothering you with all of these questions.

Re: 4 Decimal places?

Ok, I've tried changing: 

 

formatPrice: function(price) {

        return formatCurrency(price, this.priceFormat);

    }

 

TO:

 

formatPrice: function(price) {

        this.priceFormat.requiredPrecision = 4;

        return formatCurrency(price, this.priceFormat);

    }

 

This sollution only changes the decimals on the fontend, but I need it on the backend so that I can calculate prices like: 0.0089 etc. Any ideas?

Re: 4 Decimal places?

UPDATE:

 

The problem is that the decimals do not show for Tier prices. 

 

The guys who developed the Extension Currency Manager extension say:

 

"Why isn't your extension working in admin panel for tier prices?

The output for these prices is working in a different way - it doesn't use formatting functions. Template app\design\adminhtml\default\default\template\catalog\product\edit\price\tier.phtml contains hardcoded formatting with 2 decimals (sprintf('%.2f', $_item['price'])). But we don't want to replace the whole big template just to fix this one small thing. More importantly, this template may differ from one Magento version to another or in non-standard themes for admin panel.

So it is easier to just let you edit this template yourself, if you want."

 

I have changed (sprintf('%.2f', $_item['price']))  TO  (sprintf('%.4f', $_item['price'])) but this does not have any effect.

 

Maybe somebody has a solution?

Re: 4 Decimal places?

Hi 

 

This is possible to do. If you aren't across Magento then I suggest you outsource this to a developer. I know a few developers who do this. Let me know if you want their details. 

 

Cheers

Carolyn