imnik Posted March 2, 2015 Share Posted March 2, 2015 Hello, Please help me out with a proper way to override AdminProductsController. What I tried is this, I made little changes to AdminProductsController.php i.e as public function __construct(){ .... // my editing echo "hello"; echo "<script>alert('wait here')</script>"; ... } Now i kept this in C:\xampp\htdocs\prestashop\modules\mymodule\override\controllers\admin\AdminProductsController.php Inside this file have extended like this: class AdminProductsController extends AdminProductsControllerCore { ... } Attached herewith the sample file for better understanding,please try and response back. The same works in prestashop 1.6.0.9 Thanks in Advance. AdminProductsController.php 2 Link to comment Share on other sites More sharing options...
bellini13 Posted March 2, 2015 Share Posted March 2, 2015 and what is the error? Link to comment Share on other sites More sharing options...
coeos.pro Posted March 2, 2015 Share Posted March 2, 2015 did you try to delete the file cache/class_index.php ? Link to comment Share on other sites More sharing options...
imnik Posted March 3, 2015 Author Share Posted March 3, 2015 For Bellini, First of all it is hard to find on modules menu itself. And once when i got it was giving overriding error and before installling i have deleted it from override folder too.. For coeos.pro Yes i delete the cache folder itself and tried too Link to comment Share on other sites More sharing options...
bellini13 Posted March 3, 2015 Share Posted March 3, 2015 instead of being vague with your information, I would suggest that you be more specific and provide the exact errors and the exact code that produced the error. Link to comment Share on other sites More sharing options...
imnik Posted March 4, 2015 Author Share Posted March 4, 2015 (edited) Hey Bellini, Once when it got installed threw Bad Sql Error and this time it was overrided. However, later it is not getting install and throwing installation error. Attached screenshots for ur reference. Edited March 4, 2015 by imnik (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted March 4, 2015 Share Posted March 4, 2015 well, in the first error it is telling you that your SQL statement is invalid. Since you did not provide the code as I asked previously, I cannot help you. in the second error, it is saying the override of the AdminProductionsController from the marketplace module is failing. this is a known issue and is caused by comments in the override file (comments using //). remove the comments from the override and try again. Link to comment Share on other sites More sharing options...
imnik Posted March 5, 2015 Author Share Posted March 5, 2015 Hey Bellini, I will upload once again, Just have a look , where my piece of code is only this echo "marketplace"; This prints marketplace, however the BAD SQL error appears when AdminProductsController is called. Prestashop itself has commented like this and validator says the same i guess.. Below are some their commented lines // @since 1.5 : translations for tabs // convert price with the currency from context // @todo : move in processEditProductImage and more. I have added AdminProductsController which goes to override/controllers/admin/ folder after installation of module. Suggestions are Welcomed. Thanks in Advance. AdminProductsController.php Link to comment Share on other sites More sharing options...
bellini13 Posted March 5, 2015 Share Posted March 5, 2015 (edited) So are you saying that this override is from a module you purchased/downloaded from the addons store? Provide a link to the module on the addons store Edited March 5, 2015 by bellini13 (see edit history) Link to comment Share on other sites More sharing options...
imnik Posted March 9, 2015 Author Share Posted March 9, 2015 Sorry if you got me wrong however i am creating a custom module and in which i am overriding some files. Suggestion please or have you tried doing the above? Link to comment Share on other sites More sharing options...
bellini13 Posted March 9, 2015 Share Posted March 9, 2015 i really have no clue what you are trying to accomplish, and therefore cannot provide you with any suggestions. Link to comment Share on other sites More sharing options...
Foovince Posted March 10, 2015 Share Posted March 10, 2015 (edited) Hello Why do you override all methods from AdminProductController ? Usually, we override only one or two functions.. What is your idea ? Edited March 10, 2015 by Foovince (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted March 10, 2015 Share Posted March 10, 2015 moving to development, ,to original poster make sure to post in section that best resembles your question, i.e. this is development... Link to comment Share on other sites More sharing options...
imnik Posted March 11, 2015 Author Share Posted March 11, 2015 @Foovince I need to filter products according to seller, so i am using many functions.. Now the problem is that it throws Bad Sql Error when AdminProductsController is called on backend and that part i havn't made any changes so what i need to do. @EL Patron Sorry newbie so don't have much idea. Next Time will keep this in record Link to comment Share on other sites More sharing options...
Foovince Posted March 11, 2015 Share Posted March 11, 2015 Did you clean your override ? Can we check your code from your module ? Link to comment Share on other sites More sharing options...
imnik Posted March 12, 2015 Author Share Posted March 12, 2015 Thank You, I tried using AdminController:: instead of parent:: so it was silly mistake as i am newbie. However i am getting stuck in AdminOrdersController now. I have overrided this file too. For better understanding i have uploaded the AdminOrdersController.php and Order.php in which i made changes please give suggestion for this as it gets blank Link to comment Share on other sites More sharing options...
Foovince Posted March 12, 2015 Share Posted March 12, 2015 Sorry imnik, but I not able to help you without code (more code...) Link to comment Share on other sites More sharing options...
imnik Posted March 13, 2015 Author Share Posted March 13, 2015 Thank You, I found the errors using debug mode . 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