Jump to content

Categories not working


mykolas

Recommended Posts

Hello,

PrestaShop 1.7.6.7

A couple of days ago I was just creating new categories for my shop and suddenly I could not access any categories through my website and it returns HTTP Error 500, the home page is still working and the products pages that are listed in the home page are also working. Also if I try to check a product page through the editing platform it returns "failed to update the settings"

Link to comment
Share on other sites

Things you can immediately look at:

- Try clearing the cache (manually by deleting var/cache/prod and/or var/cache/dev)
- You can check the php error logs to see if this gives any clues.
- Debug mode likely won't help you so likely not even worth trying.
- Check Advanced Parameters -> Logs in the Back Office (but unlikely to show anything).
- If possible in the Back Office try and create a new category. If there is just an issue with the category tree db structure then this can *sometimes* fix it.
- Using phpMyAdmin check that the tables ec_category, ec_category_lang and ec_category_shop all have the same number of records.
- Using phpMyAdmin check that the table ec_category_lang contains the names of the categories you expect.
- Using phpMyAdmin check that the table ec_category_product has a number of records proportional to your shop (e.g. if 1,000 products this should contain > 1,000 records)
 

  • Like 1
Link to comment
Share on other sites

Thank you for the replies.

At first I enabled the debug mode and after going into the categories through the website once again this was returned: (1/1) FatalErrorException

Parse Error: syntax error, unexpected ':', expecting ';' or '{'

in Attribute.php line 77

Is that an useful clue?

Clearing cache did not help, I also did not find anything in the logs. I'll try the steps with phpMyAdmin as soon as I figure out how to use it.

Link to comment
Share on other sites

There are likely a few "Attribute.php" files (including in the override directory)! First step for me would be to locate the appropriate file and check what's at line 77... (for example, according to GitHub classes/Attribute.php Line 77 is in a function's DocBlock for 1.7.6.7). You can compare the files in your install with the ones in GitHub for your version:
 

https://github.com/PrestaShop/PrestaShop/tree/1.7.6.7

As I said - that's not the only file with that name (ps_factedsearch has one in its src directory, for example) and you need to also check if there's anything of that name in the override directory. If there is, then you can rename it temporarily, clear the cache again (changes in that directory are only picked up at a cache clear) and test again. Rename back -> cache clear to restore it.

I'm surprised you got a result from debug mode but everything is worth trying when it comes to PrestaShop.... 😀

Good Luck! 

Link to comment
Share on other sites

 

9 minutes ago, Paul C said:

What php version are you running?

Nothing wrong with that syntax, assuming you're not running an outdated version of PHP. I think the recommendation is php 7.1

5.6

Link to comment
Share on other sites

8 hours ago, mykolas said:

I see that there are options of 7.4 ; 8.1 ; 8.2 ; 8.3 

OK, you need v7.0+ if you're going to use that faceted search module and PHP 7.2 is what PrestaShop recommends for your version of PrestaShop (although 7.4 will *probably* work fine, maybe).

The system requirements, including php versions can be found on this page and while it says that PHP 5.6 is compatible, that's only the core and doesn't include modules.

The original error you got was because the faceted search module uses a new feature "return type declarations" (the : void at the end of line 77). Support for this was added in PHP 7 which is why you get that error - PHP 5.6 doesn't support it. These new language features are documented here.

You can either remove modules which require PHP 7.0+ (such as the faceted search module, but there may be others), downgrade modules to older versions that work with PHP 5.6 or upgrade your PHP to version 7.2 (or maybe 7.4 if 7.2 isn't available on your server).

PHP 8 isn't supported for your version of PrestaShop. I use PHP 8.1 for PrestaShop 8.1.x though, so upgrading may also be something you may want to consider.

 

Edited by Paul C
minor typo (see edit history)
  • Thanks 1
Link to comment
Share on other sites

Yesterday I changed the php version to 7.4 and I got these messages in the debug mode so I thought it won't work and I turned it off, but then I turned it on the second time today and I

noticed that the categories have fixed themselves, and in normal mode everything seems to be functioning normally, I'll wait and see if there is any other issues that appear from this, but for now thank you very much.

(one thing I was also curious about, did I somehow trigger the code to update and not be able to work with 5.6 php? or is it more likely it just updated automatically?)

 

image.thumb.png.86f0bc380122bcd1a21189f8526fd1a1.png

Edited by mykolas (see edit history)
  • Like 1
Link to comment
Share on other sites

Those aren't errors just notices and they're fine. Fingers crossed it will work for you :)

There's no link sadly between module version and shop version, so a module won't ever check what version of PHP you're running before an install or update. Ideally a module developer should update the details of which versions it works with (factoring in PHP compatibility), but sadly that just doesn't seem to happen.....

PHP 5.6 is seriously old and hasn't been actively maintained for some time now. If you want to see how far behind PrestaShop 1.7 is with PHP then compare the system requirements link in my post above with the official PHP supported version list! There was no PHP 6 but even so, PHP 5 dropped off the list years ago.....

EDIT: 5.6 was unsupported as of 5 years 8 months ago......

Edited by Paul C
clarification of php 5.6 drop in support (see edit history)
  • Thanks 1
Link to comment
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
×
×
  • Create New...