Opencart 搜索和特殊页面图像错误
Opencart search and special pages image bug
产品搜索和特别优惠页面有错误。当我 运行 产品搜索并获得结果时(或查看特价页面)。将鼠标放在产品图片上得到:
"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)
未定义索引所在部分的代码:
<?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){
?>
这个问题的奇怪之处在于,在其他页面中使用了相同的代码部分,但仅在这两个页面(特价商品和搜索结果页面)中存在问题。
我的OC版本是1.5.6.4
和主题 link:
我不是真正的程序员,但对编码知之甚少(显然不足以解决这些问题)。所以如果可能的话(如果你知道如何解决这个问题)尽可能简单地写下答案。
P.s.
我联系 theme creatore 寻求支持,但直到今天我都没有得到他的答复。
此致,
由于相关索引(显然)不存在,php 将在您检查它的值时抛出错误。为避免此错误,您可以简单地添加一些逻辑以确保它存在:
<?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){
?>
产品搜索和特别优惠页面有错误。当我 运行 产品搜索并获得结果时(或查看特价页面)。将鼠标放在产品图片上得到:
"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)
未定义索引所在部分的代码:
<?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){
?>
这个问题的奇怪之处在于,在其他页面中使用了相同的代码部分,但仅在这两个页面(特价商品和搜索结果页面)中存在问题。
我的OC版本是1.5.6.4 和主题 link:
我不是真正的程序员,但对编码知之甚少(显然不足以解决这些问题)。所以如果可能的话(如果你知道如何解决这个问题)尽可能简单地写下答案。
P.s.
我联系 theme creatore 寻求支持,但直到今天我都没有得到他的答复。
此致,
由于相关索引(显然)不存在,php 将在您检查它的值时抛出错误。为避免此错误,您可以简单地添加一些逻辑以确保它存在:
<?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){
?>