Finding this error in the OpenCart Error Log and not knowing what is causing it.
PHP Notice: Undefined index: description in .../vqmod/vqcache/vq2-catalog_view_theme_margaretha_template_product_product.tpl on line 484
The code:
<?php foreach ($products as $product) { ?>
<!-- line 484 -->
<div class="box-desc"><?php echo $product['description']; ?></div>
<?php } ?>
We see the products and descriptions in the database table but can't see why the error is coming up.
there is no 'description' on $products array(), this is the related part of controller ('products/products'):
$this->data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'price' => $price,
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $result['product_id'])
);
its a problem with you template. BUT, you can simple add the description index and set his value to $result['description']
because $result
array have all columns of product returned from the model.
'description' => $result['description'],
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.