Krystian Podemski Posted July 29, 2016 Share Posted July 29, 2016 Hello guys, recently i've wrote an article about 10+ common mistakes related to creating a PrestaShop module, you can read this article on PrestaShop Build blog here: http://build.prestashop.com/howtos/module/Common-mistakes-while-coding-module/ PrestaShop has been around for many years, during which thousands of modules were made by thousands of developers, yet we still see the same simple mistakes being made, even though they could easily be avoided. I'm open for a suggestions and discussion! 4 Link to comment Share on other sites More sharing options...
Codify Solutions Posted October 28, 2016 Share Posted October 28, 2016 Hi, I really happy to see your article. It will help me a lot in future as well. I am also creating module and got the same problem you mentioned. Right now I am facing some Data validation related issues with my module. I don't know if this place is correct with this discussion. Let me explain my problem : I submitted my module and they said all ajax/cron must be validated with tokan. My problem is I have a link in admin config layout. when I click that link I run ajax and redirect it to ajax.php in root of my module. My question is how do I pass security_key as you mentioned in your aritcle or tokan to ajax file. What I did for now is say : url: '../modules/mymodule/ajax.php?token=xxxx', in ajax url section and I checked in ajax.php file like : if (Tools::getValue('token') != 'xxxx' || !Module::isInstalled('mymodule')) { die('Bad token');} I don't know if it is correct and Prestashop technical team reject this. Please let me know your thoughts. Thanks! Link to comment Share on other sites More sharing options...
vanhims Posted May 30, 2017 Share Posted May 30, 2017 (edited) Hi, Thanks for the tips! Some of them are really really helpful ! Can you also share, how you find the explanation of all these little things like: $this->controllers = array(''); //loads the front controller These properties are not explained in any tutorial nor the code comments. It only says : Load controllers. So, I wonder : how can a novice developer get his way around the massive amounts of code? Thanks for the tip! Edited May 30, 2017 by vanhims (see edit history) Link to comment Share on other sites More sharing options...
Lukenzo Posted October 6, 2017 Share Posted October 6, 2017 Hello. Is there any way to access controller functions without making them static? For example I have a function in indexController and I want to access it in that template. PS 1.7 Link to comment Share on other sites More sharing options...
sunnydesigner Posted March 30, 2018 Share Posted March 30, 2018 On 2017/5/30 at 9:29 PM, vanhims said: Hi, Thanks for the tips! Some of them are really really helpful ! Can you also share, how you find the explanation of all these little things like: $this->controllers = array(''); //loads the front controller These properties are not explained in any tutorial nor the code comments. It only says : Load controllers. So, I wonder : how can a novice developer get his way around the massive amounts of code? Thanks for the tip! If you configure a controller in your module in the array, when you install the module, Prestashop will install the controller for you automatically, please view the function installControllers in /class/module/Module.php file Link to comment Share on other sites More sharing options...
sunnydesigner Posted March 30, 2018 Share Posted March 30, 2018 On 2017/10/6 at 6:50 PM, Lukenzo said: Hello. Is there any way to access controller functions without making them static? For example I have a function in indexController and I want to access it in that template. PS 1.7 You can use $this->context->controller to invoke the function in the controller file in modules. Link to comment Share on other sites More sharing options...
dandumit Posted January 6, 2019 Share Posted January 6, 2019 Sorry for this offtopic question : is there any guide for upgrading modules written in 1.6 to be compatible with 1.7 ? I have 2 modules written by me and I intend to uprade to 1.7. Thank you, Daniel Link to comment Share on other sites More sharing options...
Krystian Podemski Posted January 26, 2019 Author Share Posted January 26, 2019 On 1/6/2019 at 9:21 AM, dandumit said: Sorry for this offtopic question : is there any guide for upgrading modules written in 1.6 to be compatible with 1.7 ? I have 2 modules written by me and I intend to uprade to 1.7. Thank you, Daniel Hey what exactly you would like to know? mostly it's front office who is affected by changes in PrestaShop 1.7, for example FO templates for controllers should extend page.tpl etc. you can't use {convertPrice} anymore, you don't have global variables like $link etc. Link to comment Share on other sites More sharing options...
dandumit Posted February 4, 2019 Share Posted February 4, 2019 On 1/26/2019 at 3:27 AM, Krystian Podemski said: Hey what exactly you would like to know? From local meetings I have understood that back-office has been migrated totally on symphony and therefore I have assumed that have changed all the objects and functions ... from your statement there is almost no change in backoffice... Link to comment Share on other sites More sharing options...
Krystian Podemski Posted February 5, 2019 Author Share Posted February 5, 2019 Oh, yes, indeed, PrestaShop back-office is now with some pages migrated to Symfony, you can read a lot about this migration here:https://github.com/PrestaShop/prestafony-project example module: https://github.com/PrestaShop/ps_linklist/tree/devhttps://devdocs.prestashop.com/1.7/development/architecture/migration-guide/https://github.com/PrestaShop/PrestaShop/projects/3 Link to comment Share on other sites More sharing options...
pixelwebmx Posted January 16, 2020 Share Posted January 16, 2020 Great article! 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