Jump to content

Override not working


nesoor

Recommended Posts

Hello Prestashop members !
 
I have an override in "override/classes/order/Order.php"which is not working. 
I already tried to clear my cache, deleted the "class_index.php" file and I tried to manually add the code in the "class_index.php" file.

  'Order' => 
  array (
    'path' => 'override/classes/order/Order.php',
    'type' => 'class',
    'override' => false,
  ), 

When I manually add the code above to the "class_index.php" I get the following error: server error 500.

This error appears only on the "order page" and also on other pages on the front, except on the front page itself.

 

The override looks like this:

public static function generateReference()
    {
    $last_id = Db::getInstance()->getValue('
        SELECT MAX(id_order)
        FROM '._DB_PREFIX_.'orders');
    return str_pad((int)$last_id + 1, 8, '000000', STR_PAD_LEFT);
    }

Because the override didn't work I have edited the original file. That is working perfectly.

Any idea why it doesn't work as an override or what I might do wrong ?

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

we need to see your entire override class file, not just 7 lines of it. 

Hey bellini13,

Thanks for the suggestions. I will do that next time immediately.

I have found out what went wrong: the option "disable all overrides" was turned on.

 

I turned it off but then I get "http error 500" on the "front page" and on the backend "Orders page".

I tried to delete the cache, class_index.php, .htaccess, turned of / on SEO friendly urls.

 

Any idea what is going wrong ?

Link to comment
Share on other sites

we need to see your entire override class file, not just 7 lines of it. 

Hello Bellini13,

 

I wanted to let you know that I fixed it. Some files had to be replaced after updating.

Thanks for your replies !

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