opencart ver 1.4.91.- how to add weight and weigh unit for products and in the cart
have looked in the forum but the code is for version 1.2.9 which doesnt work for the newer er 1.4.9.1
can some guide please
have looked in the forum but the code is for version 1.2.9 which doesnt work for the newer er 1.4.9.1
can some guide please
Last edited by i2Paq on Thu Nov 25, 2010 4:28 am, edited 1 time in total.
Reason: Title adjusted
Reason: Title adjusted
Hello mohit11,
I do not know for the cart, but I do for the product page.
Open /template/product/product.tpl
Find
And add just after or before) :
Hope it helps!
I do not know for the cart, but I do for the product page.
Open /template/product/product.tpl
Find
Code: Select all
<tr>
<td><b><?php echo $text_model; ?></b></td>
<td><?php echo $model; ?></td>
</tr>
Code: Select all
<tr>
<td><b><?php echo $text_weight; ?></b></td> // declare it in both language and controller folders to display "Weight" on the page
<td><?php echo $product_info['weight'] ;?></td>
</tr>
well, it should ^^
see on my store (with $product_info['length'], $product_info['width'], $product_info['height'] called exactly as $product_info['weight'] : http://candesco.be/oc/index.php?route=p ... duct_id=33
did you get an error message ?
see on my store (with $product_info['length'], $product_info['width'], $product_info['height'] called exactly as $product_info['weight'] : http://candesco.be/oc/index.php?route=p ... duct_id=33
did you get an error message ?
Hi,
This is my cat-view-theme-temp-prod-prod.tpl
<tr>
<td><b><?php echo $text_model; ?></b></td>
<td><?php echo $model; ?></td>
<tr>
<td><b><?php echo $text_weight; ?></b></td> // declare it in both language and controller folders to display "Weight" on the page
<td><?php echo $product_info['weight'] ;?></td>
</tr>
<?php if ($manufacturer) { ?>
<tr>
and this is the error i get on my website- weight unit shows properly
http://patashiexports.com/index.php?rou ... duct_id=49
This is my cat-view-theme-temp-prod-prod.tpl
<tr>
<td><b><?php echo $text_model; ?></b></td>
<td><?php echo $model; ?></td>
<tr>
<td><b><?php echo $text_weight; ?></b></td> // declare it in both language and controller folders to display "Weight" on the page
<td><?php echo $product_info['weight'] ;?></td>
</tr>
<?php if ($manufacturer) { ?>
<tr>
and this is the error i get on my website- weight unit shows properly
http://patashiexports.com/index.php?rou ... duct_id=49
you get this error because you forgot to declare $text_weight 
To do so, open /catalog/language/english/product/product.php
Find
Add just after :
If you have other languages on your website, you have to do the same for each of them (e.g. if you have Dutch; then edit the /catalog/language/dutch/product/product.php)
Then, open /catalog/controller/product/product.php
Find
Add just after :
The error should now disappear 
ps: you can delete the

To do so, open /catalog/language/english/product/product.php
Find
Code: Select all
$_['text_model'] = 'Model :';
Code: Select all
$_['text_weight'] = 'Weight :';
Then, open /catalog/controller/product/product.php
Find
Code: Select all
$this->data['text_model'] = $this->language->get('text_model');
Code: Select all
$this->data['text_weight'] = $this->language->get('text_weight');

ps: you can delete the
Code: Select all
// declare it in both language and controller folders to display "Weight" on the page
Of course
open ....../template/product/product.tpl
Change this
by this

Change this
Code: Select all
<tr>
<td><b><?php echo $text_weight; ?></b></td>
<td><?php echo $product_info['weight'] ;?></td>
</tr>
Code: Select all
<tr>
<td><b><?php echo $text_weight; ?></b></td>
<td><?php echo $product_info['weight'] . 'kgs' ;?></td>
</tr>
Just a quick note: this won't actually use the weight_unit for the product, it'll just use "kg" for everything. The only way to get the weight_unit is doing something like I suggested in this post.
Just add
before kgs.
Your code will then look like :
Code: Select all
Your code will then look like :
One equals one space. You can add more if you want.<tr>
<td><b><?php echo $text_weight; ?></b></td>
<td><?php echo $product_info['weight'] . ' kgs' ;?></td>
</tr>
Who is online
Users browsing this forum: No registered users and 140 guests