Jump to content

Recommended Posts

Rainer I have downloaded the latest version and have added this to the latest 1.0.7.9. I have added one featured product and have the following warning notices on the index pages which are

Quote

Notice: Trying to access array offset on value of type null in /home/railway1/public_html/phoenix/includes/modules/content/index/cm_i_featured_products.php on line 45

and one on the index nested page which is

Quote

Notice: Trying to access array offset on value of type null in /home/railway1/public_html/phoenix/includes/modules/content/index_nested/cm_in_featured_products.php on line 44

In both instances the line is

      $featured_products_content = NULL;

Any ideas.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites
13 minutes ago, raiwa said:

Try:


     $featured_products_content = [];

 

Both warnings are still there.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

OK.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Note that in the short term, store owners can get rid of the notices by changing the configure.php files to add

& ~E_NOTICE

to the error_reporting line.  While I think it is better to run at E_ALL because occasionally notices warn of actual problems, if they are getting in your way, that option is always open to you.  That's why error_reporting is now set in the configure.php file and not in the code.  So you can choose the level that works with the Apps that you have installed.  In fact, the update instructions from 1.0.7.6 to 1.0.7.7 included setting these to the old values for compatibility reasons. 


Always back up before making changes.

Share this post


Link to post
Share on other sites

@14steve14, which PHP version?. I don't see this error.

EDIT: you can just delete these lines, they are left over from previous versions and not in use any more.

Therefore I have no idea why you get this error, there is no apparent reason for it.

Edited by raiwa

Share this post


Link to post
Share on other sites

PHP version is 7.4.4. Reverting back to anything lower and the error is not present. Only problem being is that the hosts are supposed to be advising everyone to upgrade to 7.4.4 as they are stopping supporting earlier versions although they will still be available. I am trying to miss out an upgrade if I can.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites
Quote

EDIT: you can just delete these lines, they are left over from previous versions and not in use any more.

All my addons are only for PHP 7.3 tested. Anyway. as already pointed out, they are only notice errors.

Edited by raiwa

Share this post


Link to post
Share on other sites

In PHP 7.4, the actual problematic line is

      $cat_name = $category['categories_name'];

which makes more sense with the error (dereferencing of null).  It's saying that there is no global variable named $category.  Perhaps this code predated the category_tree change.  I think it should be

      $cat_name = $GLOBALS['OSCOM_category']->getData($GLOBALS['current_category_id'], 'name');

in the cm_in_featured_products.php file.  And in cm_i_featured_products.php, I think that line and all references to $cat_name in the template file should be removed.  Because the root category doesn't have a name. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
3 hours ago, ecartz said:

Note that in the short term, store owners can get rid of the notices by changing the configure.php files to add


& ~E_NOTICE

to the error_reporting line.  While I think it is better to run at E_ALL because occasionally notices warn of actual problems, if they are getting in your way, that option is always open to you.  That's why error_reporting is now set in the configure.php file and not in the code.  So you can choose the level that works with the Apps that you have installed.  In fact, the update instructions from 1.0.7.6 to 1.0.7.7 included setting these to the old values for compatibility reasons. 

Cheers ecartz I realise that they are notices and that they can be turned off or reduced, but with the setting high it does show where problems are and as this is currently a development store I don't mind them showing, I just think its good to bring them to a developers attention so they can be removed if possible.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites
19 hours ago, ecartz said:

In PHP 7.4, the actual problematic line is


      $cat_name = $category['categories_name'];

which makes more sense with the error (dereferencing of null).  It's saying that there is no global variable named $category.  Perhaps this code predated the category_tree change.  I think it should be


      $cat_name = $GLOBALS['OSCOM_category']->getData($GLOBALS['current_category_id'], 'name');

in the cm_in_featured_products.php file.  And in cm_i_featured_products.php, I think that line and all references to $cat_name in the template file should be removed.  Because the root category doesn't have a name. 

Just tried under PHP 7.4 and all good with these changes.

 

I'll await the Phoenix 1.0.7.10 release and upload the update with these fixes.

21 hours ago, 14steve14 said:

In both instances the line is


      $featured_products_content = NULL;

Any ideas.

I understand now the confusion. You posted the wrong line.

Edited by raiwa

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×