Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Remove decimal from weight ?


Recommended Posts

The code is in /catalog/includes/modules/product_listing.php :



            $lc_align = 'right';

            $lc_text = ' ' . $listing['products_weight'] . ' ';


Replace with following to round off:



            $lc_align = 'right';

            $lc_text = ' ' . ceil($listing['products_weight']) . ' ';


Always make a backup of your file before modifications.

Link to comment
Share on other sites

Hey thanks for that works great.


Another bit of PHP i've learned .


Returns the next highest integer value by rounding up value if necessary. The return value of ceil() is still of type float as the value range of float is usually bigger than that of integer.


Example 1. ceil() example


echo ceil(4.3); // 5

echo ceil(9.999); // 10


Link to comment
Share on other sites


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

  • Create New...