-1

There is error in product search and special offers page. When I run product search and get results (or check special offers page). Put mouse on product image and get:

"Notice: Undefined index: image_add in /home/database/public_html/catalog/view/theme/marcus/template/product/search.tpl on line 105Notice: Undefined index: image_add in /home/database/public_html/catalog/view/theme/marcus/template/product/search.tpl on line 115"... (also I add pic of problem)

Code of that part where undefined index is:

<?php
                    if($product['image_add'] != ''){
                        $file_headers = @get_headers($product['image_add']);
                        if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
                            $exists = false;
                        }
                        else {
                            $exists = true;
                        }
                    }

                    if($product['image_add'] != '' && $exists){
?> 

Wierd part bout this problem is that same parts of code used in other pages, but only in those two pages (special offers and search result page) that problem exist.

My OC version is 1.5.6.4 And theme link:

I'm not really a programmer, but know little bit bout coding (apperantly not enough to fix these kinda issues). So if its possible (and if you know how to fix this) writte answer as simple as possible.

P.s.

I contact theme creatore for supp but till today I get no answer from him.

Regards,

Tristan
  • 3,530
  • 3
  • 30
  • 39
w3bgh0st
  • 3
  • 3
  • SO site is not a place for asking for technical support or professional assistance, in other words we don't have the concept of *write answer as simple as possible* – Abdo Adel Jun 18 '15 at 21:55
  • I don't ask pro assistance or tech support. I ask how to solve this problem. – w3bgh0st Jun 18 '15 at 22:27

1 Answers1

1

Since the index in question (apparently) does not exist, php is going to throw an error when you check it's value. To avoid this error you can simply add some logic to make sure it exists:

<?php
    if(isset($product['image_add']) && $product['image_add'] != ''){
        $file_headers = @get_headers($product['image_add']);
        if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
            $exists = false;
        } else {
            $exists = true;
        }
    }
    if(isset($product['image_add']) && $product['image_add'] != '' && $exists){
?>