xlynx Posted July 6, 2014 Share Posted July 6, 2014 (edited) Hello, I want to override a part of code of the AdminProductsController.php to change some tabs : This is the original part : $this->available_tabs = array('Quantities' => 6, 'Warehouses' => 14); if ($this->context->shop->getContext() != Shop::CONTEXT_GROUP) $this->available_tabs = array_merge($this->available_tabs, array( 'Informations' => 0, 'Pack' => 7, 'VirtualProduct' => 8, 'Prices' => 1, 'Seo' => 2, 'Associations' => 3, 'Images' => 9, 'Shipping' => 4, 'Combinations' => 5, 'Features' => 10, 'Customization' => 11, 'Attachments' => 12, 'Suppliers' => 13, )); I created a file called AdminProductsController.php and saved in /override/controllers/admin and made this code : <?php class AdminProductsController extends AdminProductsControllerCore { public function __construct() { parent::__construct(); $this->available_tabs = array('Quantities' => 6, 'Warehouses' => 14); if ($this->context->shop->getContext() != Shop::CONTEXT_GROUP && $this->context->shop->getContext() != Shop::CONTEXT_SHOP ) $this->available_tabs = array_merge($this->available_tabs, array( 'Informations' => 0, 'Pack' => 7, 'VirtualProduct' => 8, 'Prices' => 1, 'Seo' => 2, 'Associations' => 3, 'Images' => 9, 'Shipping' => 4, 'Combinations' => 5, 'Features' => 10, 'Customization' => 11, 'Attachments' => 12, 'Suppliers' => 13, )); } } If i put this code in the original file, it works but i want an override to get a clean install. i don't know where i am wrong. Thanks for any help Best ! Edited July 6, 2014 by xlynx (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted July 7, 2014 Share Posted July 7, 2014 delete the file cache/class_index.php and try again. This file contains references to your classes, controllers and overrides and needs to be refreshed when overrides are created Link to comment Share on other sites More sharing options...
xlynx Posted July 7, 2014 Author Share Posted July 7, 2014 (edited) Hey Bellini, I already deleted the cache/class_index.php file and nothing, dunno where is the error in my code ... Thank you. Edited July 7, 2014 by xlynx (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted July 7, 2014 Share Posted July 7, 2014 put an echo statement in your override __construct function to confirm that the override function is actually being called. then navigate to the admin customers page and confirm you see the echo statement appear Link to comment Share on other sites More sharing options...
xlynx Posted July 7, 2014 Author Share Posted July 7, 2014 It works, it shown the echo message, and now the code is working, i think my problem was from the browser cache ... Thank you so much Bellini ! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now