Post by ioncart » Sat May 13, 2017 1:28 am

added the following code in featured.php

Code: Select all

$data['weight'] = $product_info['weight'];
$tablewunit = $this->db->query("SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE (wcd.weight_class_id = " . $product_info['weight_class_id'] . ") AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
$data['weightunit'] = $tablewunit->row['unit'];
and the following in featured.tpl
<?php echo ' / ' . $product['weightunit']; ?>

was expecting to display the weightunit. it worked the first time around although the second time it complained about an Notice: Undefined index: weightunit

where am i going wrong?

New member


Tue May 09, 2017 9:55 pm

Post by viethemes » Sat May 13, 2017 10:49 pm

Could you provide entire code so we can take a look at the problem closer? - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others

User avatar
Active Member


Thu Jan 08, 2015 12:17 pm

Post by ioncart » Sat May 13, 2017 11:54 pm

that was the entire block of code i listed above hoping to display weightunit.
I placed the code in two sections thinking it would select weightunit. First section was in between

Second section right before this block of code:
$data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'rating' => $rating,
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id'])

I also need to display weightunit in the products listed in category.tpl

New member


Tue May 09, 2017 9:55 pm
Who is online

Users browsing this forum: No registered users and 10 guests