News:

Support the VirtueMart project and become a member

Main Menu

HOW TO DELETE THE AMOUNT OF DECIMALS ON SIZES OF DISPLAY PRODUCT

Started by mabf, October 02, 2019, 21:35:17 PM

Previous topic - Next topic

mabf

Hello guys i need help with this, how can i delete the amount of decimals on the products display i want to show 10cm and not 10.0000cm

i just found this code on this file template templates\t3_bs3_blank\html\com_virtuemart\productdetails\default.php

Quote<?php if (round($this->product->product_length > 1) || round($this->product->product_width > 1) || round($this->product->product_height > 1) || round($this->product->product_weight > 1) || ($this->product->product_packaging > 0)) { ?>
            <div class="Dimensions">

            
                <h4><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DIMENSIONS_AND_WEIGHT') ?></h4>
               
                <?php
                if ($this->product->product_length > 0) {
                echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_LENGTH').': ' .$this->product->product_length.$this->product->product_lwh_uom.'</div>';
                }
                if ($this->product->product_width > 0) {
                echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_WIDTH').': ' .$this->product->product_width.$this->product->product_lwh_uom.'</div>';
                }
                if ($this->product->product_height > 0) {
                echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_HEIGHT').': ' .$this->product->product_height.$this->product->product_lwh_uom.'</div>';
                }
                if ($this->product->product_weight > 0) {
                echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_WEIGHT').': ' .$this->product->product_weight.$this->product->product_weight_uom.'</div>';
                }
                if ($this->product->product_packaging > 0) {
                echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_PACKAGING').': ' .$this->product->product_packaging.$this->product->product_unit.'</div>';
                }
               
                if ($this->product->product_box) {
                ?>

im using the last version of virtuemart


what do i need to edit to delete the decimals or at least show just 1 or 2 decimals, thank you

GJC Web Design



echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_LENGTH').': ' .number_format($this->product->product_length,2).$this->product->product_lwh_uom.'</div>';
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation