VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: mabf on October 02, 2019, 21:35:17 PM

Title: HOW TO DELETE THE AMOUNT OF DECIMALS ON SIZES OF DISPLAY PRODUCT
Post by: mabf on October 02, 2019, 21:35:17 PM
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
Title: Re: HOW TO DELETE THE AMOUNT OF DECIMALS ON SIZES OF DISPLAY PRODUCT
Post by: GJC Web Design on October 02, 2019, 22:47:41 PM


echo '<div>'.JText::_('COM_VIRTUEMART_PRODUCT_LENGTH').': ' .number_format($this->product->product_length,2).$this->product->product_lwh_uom.'</div>';