Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to trim one zero from price
 
bulik1983
Jr. Member
 
Total Posts:  9
Joined:  2012-12-06
 

Hi I am trynig to change this code:

public static function trimZeroRight($price$precision)
    
{
        
if (!Mage::getStoreConfig('price_decimal/general/trim_zero_right'))
            return 
$precision;
        
$xPrice sprintf("%." $precision "F"$price);
        
$decimal strrchr($xPrice'.');
        
$c1 strlen($decimal);
        
$decimal rtrim($decimal'0');
        
$c2 strlen($decimal);
        
$xPrecision $precision - ($c1 $c2);
        return 
$xPrecision;
    
}

to trim only one zero from right not 2 or more because this code trim all zero from right
So for exmple if something cost £1.200 (one pound twenty) it trim to £1.20 not to £1.2 like in this code

please help

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top