Warning and deprecated messages for CSS Flyout menu
I'm using v157c with Bootstrap template. The CSS Flyout Menu (found here https://www.zen-cart.com/downloads.php?do=file&id=1) installed well on my site, and seems to function well on the user end. But my logs are getting filled with warnings every time a page is called.
Quote:
--> PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; zen_categories_ul_generator has a deprecated constructor
I know it's a pretty old plugin, but I'd like to use it. Is there an update or a relatively easy way to fix that? Thank you.
Re: Warning and deprecated messages for CSS Flyout menu
Quote:
Originally Posted by
Joseph M
I'm using v157c with Bootstrap template. The CSS Flyout Menu (found here
https://www.zen-cart.com/downloads.php?do=file&id=1) installed well on my site, and seems to function well on the user end. But my logs are getting filled with warnings every time a page is called.
I know it's a pretty old plugin, but I'd like to use it. Is there an update or a relatively easy way to fix that? Thank you.
try changing line 44 of:
includes/classes/categories_ul_generator.php
PHP Code:
//from:
function zen_categories_ul_generator($load_from_database = true) {
to:
function __construct($load_from_database = true) {
best.
Re: Warning and deprecated messages for CSS Flyout menu
Quote:
Originally Posted by
carlwhat
try changing line 44 of:
includes/classes/categories_ul_generator.php
PHP Code:
//from:
function zen_categories_ul_generator($load_from_database = true) {
to:
function __construct($load_from_database = true) {
best.
Worked perfectly. That eliminated the deprecated log warning. Thank you. I am still getting
Quote:
A non-numeric value encountered in
log warning for lines 68 and 100 that I'm trying to make sense of. There were a couple of solutions suggested at https://www.zen-cart.com/showthread....PHP-7-warnings but neither has solved the problem.
Re: Warning and deprecated messages for CSS Flyout menu
Quote:
Originally Posted by
Joseph M
Worked perfectly. That eliminated the deprecated log warning. Thank you. I am still getting log warning for lines 68 and 100 that I'm trying to make sense of. There were a couple of solutions suggested at
https://www.zen-cart.com/showthread....PHP-7-warnings but neither has solved the problem.
the problem deals with php7 and more strict typing of vars. i think if you to the following change on lines 67 and 68, you should be good.
PHP Code:
//from:
function buildBranch($parent_id, $level = 0, $submenu=false, $parent_link='') {
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );
//to:
function buildBranch($parent_id, $level = 0, $submenu=false, $parent_link='') {
$level = (int)$level;
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );
best.
Re: Warning and deprecated messages for CSS Flyout menu
Quote:
Originally Posted by
carlwhat
the problem deals with php7 and more strict typing of vars. i think if you to the following change on lines 67 and 68, you should be good.
PHP Code:
//from:
function buildBranch($parent_id, $level = 0, $submenu=false, $parent_link='') {
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );
//to:
function buildBranch($parent_id, $level = 0, $submenu=false, $parent_link='') {
$level = (int)$level;
$result = sprintf($this->parent_group_start_string, ($submenu==true) ? ' class="level'. ($level+1) . '"' : '' );
best.
Right on target again, carlwhat. The site is running the plugin with no warning logs. I'd venture to say that with the two fixes you offered above, you've updated it for v157c.
Is there a (hopefully simple) way to tell it to exclude categories with a specific category_id? I have it set up to exclude empty categories, but there are some that I don't want the menu to show at all.
Re: Warning and deprecated messages for CSS Flyout menu
Quote:
Originally Posted by
Joseph M
Right on target again, carlwhat. The site is running the plugin with no warning logs. I'd venture to say that with the two fixes you offered above, you've updated it for v157c.
Is there a (hopefully simple) way to tell it to exclude categories with a specific category_id? I have it set up to exclude empty categories, but there are some that I don't want the menu to show at all.
with regards to your question, as i tell all my clients, given enough time and money, anything is possible... :smile:
you bring up a couple of interesting points here. i'm not that familiar with the flyout menu plugin, but it makes use of the categories_ul_generator class, which it has packaged in the plugin. but that class is part of the base ZC package which has the changes that i have provided to you. but how that class in the plugin is different from the class packaged with ZC... well you got me.... a diff certainly shows differences, but whether the base class will work with the plugin, i do not know...
but an interesting issue (at least to me) is the stamping of the class as seen here:
https://github.com/zencart/zencart/b..._generator.php
the timestamp from @DrByte says almost 17 years ago; and yet there have been changes made as little as 3 years ago with no corresponding change in the time stamp in the header comments.
i know the methodology for changing those stamps has changed over the years; and at 1 point i got into a conversation with the team about it. now, i try now to worry about it; but it does seem like this time stamp is blatantly askew as the class packaged with the plugin has a similar date, but yet has not addressed some very basic changes in php that have evolved over the years.
best.