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

One of my testers for the new website has just pointed out to me that when selecting a main category the featured product module shows with the heading 'Featured Products In' but the products are not in that category. Should it only show products from the main category or from every category.


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

Maybe try the above fix (previous post just before yours)

 

I'll await 1.0.8.0 release before further updates.

Edited by raiwa

Share this post


Link to post
Share on other sites

Hotfix for Phoenix 1.0.7.11 admin error:

Warning: require(includes/classes/currencies.php): failed to open stream: No such file or directory in...........

In admin/featured.php delete line 35:

  require('includes/classes/currencies.php');

 

Share this post


Link to post
Share on other sites

The your report was quite unprecise:

when click on catalog/featured products

should have been:

when selecting in admin: "Catalog/Featured Products"

http error 500 is displayed

this was not this kind of error. You got a blank page if error reporting was switched off or you got the error message I posted above.

 

Please try to be more precise and give accurate information when you report a problem.

 

Edited by raiwa

Share this post


Link to post
Share on other sites

@raiwaI installed this module on Phoenix 1.07.12, Php 7.4 on a test website by following install instruction and adding above recommended patches but I am getting some errors on https://mysite.com/admin/featured.php as below

image.thumb.png.cd9ea764c7d98ad11ef06b458e1042ed.png

 

Also when this module is active main site index page does not show any content but only header. 

Do you think is there something wrong happened during installation or please advise any hotfix which can work. Thanks

Share this post


Link to post
Share on other sites

For the warning message  add the constant to the featured languge file:

const IMAGE_SEARCH = 'Search';

I don't get the other errors on my Phoenix 1.0.7.12 teststore. Must be something in your store. Try to setup some featured products.

For the shop side blank page, switch error reporting on and check which exact error it throws.

Share this post


Link to post
Share on other sites

Hi,

@raiwa thanks for above, admin side errors are now resolved, regarding shop side blank page, I disables error reporting and page is showing below errors:

Fatal error
: Uncaught Error: Call to a member function getData() on null in /homepages/31/d********/htdocs/H********/includes/modules/content/index/cm_i_featured_products.php:45 Stack trace: #0 
/homepages/31/d********/htdocs/H********/includes/system/versioned/1.0.7.9/osc_template.php(106): cm_i_featured_products->execute() #1
/homepages/31/d********/htdocs/H********/templates/default/includes/pages/index.php(44): oscTemplate->getContent('index') #2 
/homepages/31/d********/htdocs/********/index.php(35): require('/homepages/31/d...') #3 {main} thrown in
/homepages/31/d********/htdocs/H********/includes/modules/content/index/cm_i_featured_products.php on line 45

Seems to be referring to these lines:

image.png.633023d44191ffa2d9febbdbdfea8941.png

Thanks

Share this post


Link to post
Share on other sites
On 10/10/2020 at 3:47 PM, 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 remove that line in the cm_i_featured_products.php module. It's unused there and I have this fix prepared for the next update.

Share this post


Link to post
Share on other sites

Thanks, all working fine now, only one notice which disappears if I have "notices off in "includes/configure.php" i.e:

Notice: Undefined variable: cat_name in /homepages/31/d*******/htdocs/H******/includes/modules/content/index/templates/tpl_cm_i_featured_products.php on
line 3

Referring to this line below:

<h4><?php echo ($cat_name != '' ? sprintf(MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_CATEGORY_TITLE, $cat_name) : MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_TITLE . 
((MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_SHOW_BUTTON == 'True')? '&nbsp;&nbsp;' . 
tep_draw_button(MODULE_CONTENT_INDEX_FEATURED_PRODUCTS_IMAGE_BUTTON_SEE_MORE, 'fas fa-caret-right', tep_href_link('featured_products.php'), 'primary',
null):'')); ?></h4>

 

Edited by zeeshop

Share this post


Link to post
Share on other sites

You can delete the part with $cat_name in that line in the template file also:

On 10/10/2020 at 3:47 PM, ecartz said:

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. 

 

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

×