簡體   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