undercoverfab Posted November 6, 2019 Share Posted November 6, 2019 (edited) Can someone point me int he correct direction in resolving a problem I am having with a recurring series of entries in my error log? I assume its related to the fact that I have 'pagenotfound' repeating in my visitors online page. Here is what it looks like: [06-Nov-2019 11:54:02 US/Central] PHP Notice: Undefined index: subcategories in /home/c45ze72g6r1g/public_html/var/cache/prod/smarty/compile/layouts_layout_full_width_tpl/38/0a/dd/380addc9637f69afcd6c6a8513dff4af7c11dac9_2.file.not-found.tpl.php on line 28 [06-Nov-2019 11:54:02 US/Central] PHP Notice: Trying to get property 'value' of non-object in /home/c45ze72g6r1g/public_html/var/cache/prod/smarty/compile/layouts_layout_full_width_tpl/38/0a/dd/380addc9637f69afcd6c6a8513dff4af7c11dac9_2.file.not-found.tpl.php on line 28 [06-Nov-2019 11:54:02 US/Central] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/c45ze72g6r1g/public_html/var/cache/prod/smarty/compile/layouts_layout_full_width_tpl/38/0a/dd/380addc9637f69afcd6c6a8513dff4af7c11dac9_2.file.not-found.tpl.php on line 28 Here is line 28 in that listed file: <?php if (count($_smarty_tpl->tpl_vars['subcategories']->value)) {?> Thanks, Edited November 6, 2019 by undercoverfab Spelling (see edit history) Link to comment Share on other sites More sharing options...
lototo Posted November 7, 2019 Share Posted November 7, 2019 (edited) Check is smarty variable exist before using it in code {if (isset($variable)} {/if} In PHP you have to check is it object https://www.php.net/manual/en/function.is-object.php is($_smarty_tpl->tpl_vars) && count($_smarty_tpl->tpl_vars['subcategories']) Edited November 7, 2019 by lototo (see edit history) Link to comment Share on other sites More sharing options...
undercoverfab Posted November 7, 2019 Author Share Posted November 7, 2019 lototo, Can you tell me what files to check for these lines of code? Thanks, 23 hours ago, undercoverfab said: <?php if (count($_smarty_tpl->tpl_vars['subcategories']->value)) {?> Link to comment Share on other sites More sharing options...
El Patron Posted November 8, 2019 Share Posted November 8, 2019 Hi, these are not errors but notices and the php script continues. It's very possible that further code will check the value of a variable before processing, if you see an error post notice then of course this would be something to address. Unless there is a broken process directly related to a notice then 99.9% of the time you can ignore them. We often set php error to not report notices so we can see if true errors. Happy PrestaShopping Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now