Krystian Podemski 289 Posted July 29, 2016 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! 3 Share this post Link to post Share on other sites
Codify Solutions 1 Posted October 28, 2016 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! Share this post Link to post Share on other sites
vanhims 0 Posted May 30, 2017 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) Share this post Link to post Share on other sites
Lukenzo 1 Posted October 6, 2017 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 Share this post Link to post Share on other sites
sunnydesigner 6 Posted March 30, 2018 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 Share this post Link to post Share on other sites
sunnydesigner 6 Posted March 30, 2018 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. Share this post Link to post Share on other sites
dandumit 5 Posted January 6, 2019 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 Share this post Link to post Share on other sites
Krystian Podemski 289 Posted January 26, 2019 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. Share this post Link to post Share on other sites
dandumit 5 Posted February 4, 2019 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... Share this post Link to post Share on other sites
Krystian Podemski 289 Posted February 5, 2019 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 Share this post Link to post Share on other sites
pixelwebmx 16 Posted January 16, 2020 Posted January 16, 2020 Great article! Share this post Link to post Share on other sites
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