VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Chinas on February 11, 2012, 12:05:30 PM

Title: Displaying of Product dimensions (weight, size, unit measure)
Post by: Chinas on February 11, 2012, 12:05:30 PM
There is a section "Product dimensions and weight", but inputed data don't displays  on the page "Product Details".
Please help with the code for displaying all fields of the section (if they entered) "productdetails\tmpl\default.php"
Title: Re: Displaying of Product dimensions (weight, size, unit measure)
Post by: Chinas on February 11, 2012, 12:46:38 PM
I found answer by myself. Sorry for disturbing:
<?php //Product Weight
if (!(($this->product->product_weight)==0)) { ?>

<span class="product-fields-title" >
<?php echo JText::_('COM_VIRTUEMART_PRODUCT_WEIGHT'?>
</span>
<?php echo $this->product->product_weight ?>
</br>
<?php ?>

<?php //Product Length
if (!(($this->product->product_length)==0)) { ?>

<span class="product-fields-title" >
<?php echo JText::_('COM_VIRTUEMART_PRODUCT_LENGTH'?>
</span>
<?php echo $this->product->product_length ?>
</br>
<?php ?>

<?php //Product Width
if (!(($this->product->product_width)==0)) { ?>

<span class="product-fields-title" >
<?php echo JText::_('COM_VIRTUEMART_PRODUCT_WIDTH'?>
</span>
<?php echo $this->product->product_width ?>
</br>
<?php ?>

<?php //Product Height
if (!(($this->product->product_height)==0)) { ?>

<span class="product-fields-title" >
<?php echo JText::_('COM_VIRTUEMART_PRODUCT_HEIGHT'?>
</span>
<?php echo $this->product->product_height ?>
</br>
<?php ?>
Title: Re: Displaying of Product dimensions (weight, size, unit measure)
Post by: anotart on May 30, 2012, 22:06:21 PM
Thank you for posting your answer -- it's just what I was looking for.  It took me a bit to find the file to revise:

com_virtuemart/productdetails/tmpl/default.php.  I moved a copy to my template override folder.  Worked great.

Title: Re: Displaying of Product dimensions (weight, size, unit measure)
Post by: PRO on May 31, 2012, 00:14:24 AM
http://forum.virtuemart.net/index.php?topic=92756.0
Title: Re: Displaying of Product dimensions (weight, size, unit measure)
Post by: lumieres on June 08, 2012, 05:27:52 AM
I have been able to do this via the template override as put forward by BanquetTables.pro... BUT ..

How do I limit the amount of decimal places?  Current it displays 4 and I have been trolling to find a way to format the output but to no avail.

ANY suggest greatly appreciated!
Title: Re: Displaying of Product dimensions (weight, size, unit measure)
Post by: SamF on June 08, 2012, 07:44:05 AM
Hello,

Quote from: lumieres on June 08, 2012, 05:27:52 AM
How do I limit the amount of decimal places?

try this:


<?php
// $this->product->product_length=1234.5678;
// english notation without thousands separator

echo number_format($this->product->product_length2'.''');

// 1234.57

?>

Title: Re: Displaying of Product dimensions (weight, size, unit measure)
Post by: lumieres on June 08, 2012, 08:00:55 AM
Legend!  Absolutely brilliant SamF,

Been trying similar things for about 3 hours... and couldn't get it.

Greatly Appreciated.
Title: Re: Displaying of Product dimensions (weight, size, unit measure)
Post by: kelecz on October 02, 2014, 13:28:41 PM
Quote from: SamF on June 08, 2012, 07:44:05 AM
Hello,

Quote from: lumieres on June 08, 2012, 05:27:52 AM
How do I limit the amount of decimal places?

try this:


<?php
// $this->product->product_length=1234.5678;
// english notation without thousands separator

echo number_format($this->product->product_length2'.''');

// 1234.57

?>



Sorry,

which file is this?

Thanks in advance

Joomla 2.5.25
VM 2.6.10
Title: Re: Displaying of Product dimensions (weight, size, unit measure)
Post by: GJC Web Design on October 02, 2014, 14:23:25 PM
It's no where - i.e. where ever your displaying your weights etc

<?php echo number_format($this->product->product_weight2'.'''); ?>