Page 1 of 1

PHP Notice: Undefined index: description in

Posted: Mon Apr 07, 2014 4:21 am
by r4nd0m
I did an upgrade from 1.5.5.1 to 1.5.6 but now I get errors in the log of, I know it seems theme related however I wound think the variable is actually correct? Can anyone spot what may be wrong here or even better how to resolve it?

014-04-06 13:13:37 - PHP Notice: Undefined index: description in /home/dom.co.uk/catalog/view/theme/otp790_orange/template/module/latest.tpl on line 12
2014-04-06 13:13:37 - PHP Notice: Undefined index: description in /home/dom.co.uk/catalog/view/theme/otp790_orange/template/module/latest.tpl on line 49
2014-04-06 13:13:37 - PHP Notice: Undefined index: description in /home/dom.co.uk/catalog/view/theme/otp790_orange/template/module/featured.tpl on line 12
2014-04-06 13:13:37 - PHP Notice: Undefined index: description in /home/dom.co.uk/catalog/view/theme/otp790_orange/template/module/featured.tpl on line 49

latest.tpl
line 12 <?php echo "<p>".mb_substr(strip_tags(html_entity_decode($product['description'])), 0, 90)."...</p>"; ?>
line 49 <?php echo "<p>".mb_substr(strip_tags(html_entity_decode($product['description'])), 0, 90)."...</p>"; ?>

features.tpl
line 12 <?php echo "<p>".mb_substr(strip_tags(html_entity_decode($product['description'])), 0, 90)."...</p>"; ?>
line 49 <?php echo "<p>".mb_substr(strip_tags(html_entity_decode($product['description'])), 0, 90)."...</p>"; ?>

cheers
r4nd0m

Re: PHP Notice: Undefined index: description in

Posted: Mon Apr 07, 2014 4:35 am
by straightlight
I have already reported this issue in the bug reports of the forum. The issue is the way the description with one or many database tables are not quoted during queries.

Re: PHP Notice: Undefined index: description in

Posted: Mon Apr 07, 2014 4:38 am
by r4nd0m
straightlight wrote:I have already reported this issue in the bug reports of the forum. The issue is the way the description with one or many database tables are not quoted during queries.
cheers for clarifying this - any eta for a fix - or could I fix it temporarily myself assuming this applies to all 1.5.6* versions?

Re: PHP Notice: Undefined index: description in

Posted: Mon Apr 07, 2014 6:22 am
by straightlight
A temporary fix will be posted shortly.

Re: PHP Notice: Undefined index: description in

Posted: Sat Apr 12, 2014 8:14 am
by r4nd0m
upgraded to 1.5.6.2 error no longer exists ... but description isn't shown as previously ...

the call for the description is:

<?php echo "<p>".mb_substr(strip_tags(html_entity_decode($product['description'])), 0, 90)."...</p>"; ?>

but only "..." is shown ... but it worked on a previous version just fine ...

Re: PHP Notice: Undefined index: description in

Posted: Sat Feb 28, 2015 4:39 pm
by xmediasoftware
I have the same problem, and I found the solution, is easy. find /catalog/controller/module/featured.php and add

description' => $product_info['description'],

in the data['products'][] array as I show you below

$this->data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'description' => $product_info['description'],
'price' => $price,
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id'])
);

in my case this works in the 50% because now I see that php tag_strips it is not working in featured.tpl

<?php echo utf8_substr( strip_tags(strip_tags($product['description'])),0,85);?>

the result is next:

<p>This sleeveless top will help you stay cool and classy on those hotter days ...

I'will fix this problem as fast as I can

Re: PHP Notice: Undefined index: description in

Posted: Sat Feb 28, 2015 4:53 pm
by xmediasoftware
I have the same problem, and I found the solution, is easy. find /catalog/controller/module/featured.php and add

description' => $product_info['description'],

in the data['products'][] array as I show you below

$this->data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'description' => $product_info['description'],
'price' => $price,
'special' => $special,
'rating' => $rating,
'reviews' => sprintf($this->language->get('text_reviews'), (int)$product_info['reviews']),
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id'])
);

in my case this works in the 50% because now I see that php tag_strips it is not working in featured.tpl

<?php echo utf8_substr( strip_tags(strip_tags($product['description'])),0,85);?>

the result is next:

<p>This sleeveless top will help you stay cool and classy on those hotter days ...

Finally I change featured.tpl in your theme in the description location

<p><?php echo mb_substr( strip_tags(html_entity_decode($product['description'])),0,85);?>...</p>