繁体   English   中英

未定义的变量(opencart)

[英]Undefined variable (opencart)

在显然是错误的代码行上,如下所示:

<?php if ($filter_name) { ?>

我知道这可能是一个模糊的问题,但如果有人能提供帮助那就太棒了!

这是一个非常模糊的问题。 很可能你会在header.tpl中遇到这个错误,因为你使用的主题为1.5.4.x(或更早版本)和1.5.5.x

in your catalog/view/theme/your_theme/template/common/header.tpl

<?php if ($filter_name) { ?>
    <input type="text" name="filter_name" value="<?php echo $filter_name; ?>" />
    <?php } else { ?>
    <input type="text" name="filter_name" value="<?php echo $text_search; ?>" onclick="this.value = '';" onkeydown="this.style.color = '#000000';" />
    <?php } ?>

用。。。来代替

<input type="text" name="search" placeholder="<?php echo $text_search; ?>" value="<?php echo $search; ?>" />

如果您在询问之前进行过搜索,就会发现此http://forum.opencart.com/viewtopic.php?f=20&t=97790

go to path : catalog/view/theme/your_theme/template/common/header.tpl
open the file header.tpl
search <?php if($filter_name) { ?>
replace above by <?php if(isset($filter_name)) { ?>

是的,这是一个版本缺陷,当您将1.5.4主题用于1.5.5版本时,它很常见,但是您可以使用上述方法轻松解决(如果出现一个或两个错误)。 仅需更改此文件:catalog / view / theme / your-theme / template / common / header.tpl,并且为了安全起见,请不要破解核心文件。

https://github.com/justinmarsan/opencart-blank-theme/issues/7

这个链接对我有帮助,

只需更换

这个:

<?php if ($filter_name) { ?>

有了这个:

<?php if (isset($filter_name)) { ?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM