Undefined variable (opencart)

大城市里の小女人 提交于 2019-12-08 01:36:42

问题


on the line where the error apparently is the code looks like this:

<?php if ($filter_name) { ?>

I know this is probably a vague questions but if anyone can help that would be great!


回答1:


This is very Vague question. most probably you would be getting this error in header.tpl because you are using theme made for 1.5.4.x ( or earlier) with 1.5.5.x

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

Find

<?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 } ?>

replace with

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

If you would have searched before asking you would have found this http://forum.opencart.com/viewtopic.php?f=20&t=97790




回答2:


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)) { ?>



回答3:


yes , it is a version defect , its common when u use a 1.5.4 theme for 1.5.5 version , but u can solve it easily (if one or two errors) using the above stated method. only this file needs to be changed : catalog/view/theme/your-theme/template/common/header.tpl , and dont crack up the core files for safety .




回答4:


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

This link really helped me,

Just replace

This:

<?php if ($filter_name) { ?>

With This:

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


来源:https://stackoverflow.com/questions/15886093/undefined-variable-opencart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!