Jump to content

[SOLVED] Overrides not working anymore in 1.5.4?


NemoPS

Recommended Posts

Hi Everybody,

I don't know if this only happened to me, but on a 1.5.4 stable release, I just tried to use an override...and it didn't work. I tried another (productController) and didn't work. i even typed some garbage, and nothing showed up. It looks like overrides re not even being loaded. The path it's okay (override/controllers/front), and I get the same with classes. Anybody got the same bug?

Edited by Nemo1 (see edit history)
Link to comment
Share on other sites

I noticed this today.

 

You'll notice that all the "empty" override classes from the override directory are gone, which is good as they would overwrite the changes that weren't meant to be overwritten on upgrade.... I think the side-effect though is that changes aren't now being detected in order to recreate the class_index.php file. Just a hunch which I guess I'll have to go and try and work out from the source....

 

If you install your overrides via a module there shouldn't be a problem though.

 

EDIT: Yup Autoload::load($classname) is now broken and will use the Core class and ignore any subsequent overrides as it has cached the Core class as the non-core declaration.using the following:

 

// Since the classname does not exists (we only have a classCore class), we have to emulate the declaration of this class
$class_infos = new ReflectionClass($classname.'Core');
eval(($class_infos->isAbstract() ? 'abstract ' : '').'class '.$classname.' extends '.$classname.'Core {}');

 

Previously it would have stored the path to the "empty" class declaration in the override directory.... now it stores the path to the core class....

 

:(

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

Just an update for anyone searching for this in the future. Apparently it's INTENDED to work this way (although it hasn't up until 1.5.4 due to those stub files) :rolleyes:

 

To be fair it is documented in the new docs for 1.5 overrides.

 

Attached is a modified version of Autoload.php I'm now using in development that makes it behave as it always used to.... life is too short to have to remember to delete a cache file....

 

It will add a little overhead, so probably best to use the standard in production (but remember that if you patch the production system you'll need to remember to delete the cache file).

 

Paul

Edited by Paul C (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

i think that everything depends on hosting configuration, is hard to say where the problem exactly is, but the most important thing: we know how to deal with it ;)

 

btw. On my localhost your solution works :) (in latest ps 1.5.4.1)

Link to comment
Share on other sites

  • 4 weeks later...

Hi i have no idea what i'm doing wrong.

i want to override blocktopmenu.php.

i want to add some string to every li in menu.

i located place line 644 $this->_menu .= '<li '.$selected.' demo>'; in blocktopmenu.php

 

When i put file inside of default module its working great.

 

When i put to over override\controllers\front\blocktopmenu.php its not working

 

i deleted cache\class_index.php still not working and file is not showing again (maybe because i disable cache in preformace)

Still no results

Any body can help in that ??

Link to comment
Share on other sites

A step by step guide for this? it's a bit too long to be added in a forum post.

Basically:

 

clone the blocktopmenu folder

 

rename it to blocktopmenu2

 

in all files in that folder, replace ALL occurrences of 'blocktopmenu' in blocktopmenu2 (including filenames).

 

Rename all the database tables in blocktopmenu2.php

Link to comment
Share on other sites

ok thx i will try if any error occur i will come back to You for now Big Thx

 

1 Q module should be placed under modules of main installation not in template ?

2 Q override css will be inside template but name will be blocktopmenu2 folder php ect

Edited by felek (see edit history)
Link to comment
Share on other sites

but after module update (with prestashop update) you will have to edit it once again - of course only when the old version of the module will be incompatibile.

 

i think that after nearest update you will have to edit it once again, due to the template change (new version will have got responsive design)

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 4 weeks later...
  • 5 months later...

My problem is that my module's directory & files aren't being saved in my theme's directory

I've tried uninstalling this module & deleting the class_index.php file & then reinstall this module, but still no difference.

This problem is also preventing me from being able to translate this module...

 

please help!!!

Link to comment
Share on other sites

  • 2 years later...
  • 5 months later...

I am migrated prestashop 1.5.6 to 1.6.1 version. Migrated work successfully done.


 


I am going to check back-office and its working fine.


 


Then checking front-office its getting some error.


 


Error:


 


Fatal error: Undefined class constant 'ONLY_HAZMAT' in /var/www/html/cy_prestashop/override/classes/Cart.php on line 241


Fatal error: Undefined class constant 'ONLY_POISON' in /var/www/html/cy_prestashop/override/classes/Cart.php on line 241


Fatal error: Undefined class constant 'ONLY_Refrigerated' in /var/www/html/cy_prestashop/override/classes/Cart.php on line 241


 


How to resolve it.


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...