How do I display weight and SKU on the product page in OpenCart?
in the file
/catalog/controller/product/product.php
add the lines
$this->data['weight'] = round($product_info['weight']);
$this->data['art'] = $product_info['sku'];
foreach ($tags as $tag) {
$this->data['tags'][] = array(
'tag' => trim($tag),
'href' => $this->url->link('product/search', 'filter_tag=' . trim($tag))
);
}
$this->data['weight'] = round($product_info['weight']);
$this->data['art'] = $product_info['sku'];
and in the file /catalog/view/theme/default/template/product/product.tpl
output this in the right place
and to display not just grams but any unit of measurement
you need in Opencart
to do the following in these same files
$this->data['weight'] =
$this->weight->format($product_info['weight'], $product_info['weight_class_id']);
instead of
$this->data['weight'] = round($product_info['weight']);
Comments