(v.1.1.8 )
I would develop this part in my version, but in case you think is good idea I can post the changes...
All products have the "weight" value, however it is not displayed to the public. In some cases it may be desired, so I will add that option in the settings.
this also may apply for v.1.x.x (included 1.2.x):
Required changes to display "weight" in product details:
Modifications to: catalog/controller/product/product.php
(if you don't know where to add them, search similar lines):
Add in:
(for 1.2.x) catalog/view/theme/YOURTHEME/template/product/product.tpl
(for 1.1.x) catalog/view/template/product/product.tpl
Create this file: catalog/model/localization/weight_class.php:
I added the "@" to prevent any misconfiguration to display errors... in case of an error no unit will be displayed.
That's all...
Required changes to display "weight" in product details:
Modifications to: catalog/controller/product/product.php
(if you don't know where to add them, search similar lines):
Code: Select all
$this->data['text_weight'] = $this->language->get('text_weight');
$this->load->model('localisation/weight_class');
$weight_unit = $this->model_localisation_weight_class->getWeightUnit($product_info['weight_class_id']);
$this->data['weight'] = $product_info['weight'] . ' ' . $weight_unit;
(for 1.2.x) catalog/view/theme/YOURTHEME/template/product/product.tpl
(for 1.1.x) catalog/view/template/product/product.tpl
Code: Select all
<tr>
<td><b><?php echo $text_weight; ?></b></td>
<td><?php echo $weight; ?></td>
</tr>
Code: Select all
<?php
class ModelLocalisationWeightClass extends Model {
public function getWeightUnit($weight_class) {
$query = $this->db->query("SELECT unit FROM weight_class WHERE weight_class_id = $weight_class AND language_id = '" . (int)$this->language->getId() . "'");
return @$query->rows[0]["unit"];
}
}
?>
That's all...
I forgot also to include the language label in the last post:
Add in: catalog/language/english/product/product.php:
Add in: catalog/language/english/product/product.php:
Code: Select all
$_['text_weight'] = 'Weight:';
Who is online
Users browsing this forum: No registered users and 27 guests