php - Show unit of weight in product page for Opencart 2 -


hi!

how display unit of weight (kg., gr., oz., ml.,) in product page in opencart 2.0.2.0

now displays number without units.

i'm using default template

in file template\product\product.tpl looks this:

...<li><?php echo $text_model; ?> <?php echo $model; ?></li>  <?php if ($weight) { ?>  <li><?php echo $text_weight; ?> <?php echo round($weight, 2)?></li>  <?php } ?> ... 

in

catalog\controller\product\product.php

i have added line

$data['text_weight'] = $this->language->get('text_weight');  $data['weight'] = $product_info['weight']; 

what else need add or perhaps change ?

try in default opencart code.

step 1

open file catalog/controller/product/product.php

find (around line 242):

$data['text_tags'] = $this->language->get('text_tags'); 

add after :

$data['text_weight'] = $this->language->get('text_weight'); 


step 2

in same file catalog/controller/product/product.php

find (around line 270):

$data['points'] = $product_info['points']; 

add after :

$data['weight'] = $product_info['weight']; $tablewunit = $this->db->query("select wcd.unit " . db_prefix . "weight_class_description wcd (wcd.weight_class_id = " . $product_info['weight_class_id'] . ") , wcd.language_id = '" . (int)$this->config->get('config_language_id') . "'"); $data['weightunit'] = $tablewunit->row['unit']; 


step 3

open file catalog/language/english/product/product.php

find (around line 6):

$_['text_model']               = 'product code:'; 

add after :

$_['text_weight']       = 'weight:'; 


step 4

open file catalog/view/theme/default(your theme)/template/product/product.tpl

find (around line 141):

<li><?php echo $text_model; ?> <?php echo $model; ?></li> 

add after :

<li><?php echo $text_weight; ?> <?php echo $weight . ' ' . $weightunit; ?></li> 

and check it.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -