How to show weight on product page .view.phtml

Last modified by LekeFly on Thu, June 24, 2010 16:56
Source|Old Revisions  

<?php

                                  $_weight = $this->htmlEscape($_product->getWeight());
                                      if ($_weight < 1)
                                      $_weightstr = number_format($_weight*1000,2) . " gr";
                                      else
                                      $_weightstr = number_format($_weight,2) . " kg";
                                      echo $_weightstr;

?>

1.3600 will display as: 1.36 kg




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs