简体   繁体   中英

Undefined variable (opencart)

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!

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

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

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 .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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