sicine Posted August 20, 2014 Share Posted August 20, 2014 hello everyone Can i know what design pattern prestashop team uses to develop this platform ? i'd like to know more about it and study it since it's the best way to be a good prestashop developer.. So if its possible to give me it name ... and thank you Link to comment Share on other sites More sharing options...
Bill Dalton Posted August 20, 2014 Share Posted August 20, 2014 Good idea, please see, http://www.smarty.net/crash_course 1 Link to comment Share on other sites More sharing options...
sicine Posted August 20, 2014 Author Share Posted August 20, 2014 OOoo thank you so much Bill this is so much helpful.. So to sum up what i know, prestashop uses smarty as a template engine in the display level and the MVC design pattern in the organisation level(i just call it like that to help myself understanding thinks) ... Does it uses an other design pattern in any other level that i may not know ?? i'm a software engineer student and i'm in my learning way ... if its possible i'd like to have more clarifications on this or just some good links that will help me on that... and thank you Link to comment Share on other sites More sharing options...
Bill Dalton Posted August 20, 2014 Share Posted August 20, 2014 That's about it. Basically in addition to the display functionality provide by Smarty in the TPL files. Positioning of elements and content are provided by CSS/Div and Hook positioning. Prestashop defines most hooks you'll ever need but you can create new hooks and use them to assign content to a given area. For example look to the Back office menu and in the Module section you'll see Positions. That is a quick way of moving things up and down. Look for your right or left column and you may move any of the items that live there. Or move something from the left column to the right. Changing text is best done VIA the Translation tool located in the Localization section. You can change Almost all text for forms and modules for all installed languages. One of Prestashop' s strongest features. 1 Link to comment Share on other sites More sharing options...
sicine Posted August 20, 2014 Author Share Posted August 20, 2014 thank you so much Bill, all is clear to me now I'll go deeper in those thinks to assimilate them very well. just one think, can you please tell me if I can use ORM libraries to develop any of my modules ? Link to comment Share on other sites More sharing options...
Bill Dalton Posted August 20, 2014 Share Posted August 20, 2014 That's way beyond me, but I'm sure you must have seen this, http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#PHP 1 Link to comment Share on other sites More sharing options...
sicine Posted August 20, 2014 Author Share Posted August 20, 2014 Oh yes i sow this list .. anyway thks again Link to comment Share on other sites More sharing options...
bellini13 Posted August 21, 2014 Share Posted August 21, 2014 Smarty is the V in MVC (Model View Controller). The Classes are the M The Controllers are, well the Controllers. However there is much more to the design of Prestashop (overrides, modules, hooks etc...) that really are not part of the MVC pattern, they are just additional design approaches for creating a dynamic and extendable application. As for ORM, Prestashop does employ its own ORM system in the ObjectModel, which is what 99% of the classes extend from. You should stick to using Prestashops object model when developing modules, and you can create your own that extend ObjectModel 2 Link to comment Share on other sites More sharing options...
sicine Posted August 21, 2014 Author Share Posted August 21, 2014 First Of all i'm really thankful for your answers its helping me a lot. thank you Bellini so if i do understand very well if i want to create a module properly i need to stick to the ObjectModel ; if for example there is anything that does not suite me on it, all i have to do is overriding that class or creating others that extends from it) then just working on my module. developing properly is so impotent to me, so am I in the right way ? ps: excuse my English if there are any mistakes it's my 2nd language Link to comment Share on other sites More sharing options...
bellini13 Posted August 21, 2014 Share Posted August 21, 2014 I would avoid extending existing classes (aka override) if you can, sometimes it is unavoidable, but if you can find another way to do it using hooks, that is the preference. Two examples come to mind where you would override a Class 1) You want to add a new field to the ps_orders table. For this, you would override the Orders class 2) The Orders class has a function, and you need to execute some logic during this function. If this function does not execute any hooks, then you might need to override the function Now if you are creating new functionality that requires new data to be stored in a new table, then you can create a new Class object that extends the ObjectModel. Sometimes that is overkill since you can just write insert/select SQL statements directly. Just use your judgement, and find what will be the easiest for you to maintain. 1 Link to comment Share on other sites More sharing options...
sicine Posted August 21, 2014 Author Share Posted August 21, 2014 I would avoid extending existing classes (aka override) if you can, sometimes it is unavoidable, but if you can find another way to do it using hooks, that is the preference. Two examples come to mind where you would override a Class 1) You want to add a new field to the ps_orders table. For this, you would override the Orders class 2) The Orders class has a function, and you need to execute some logic during this function. If this function does not execute any hooks, then you might need to override the function Now if you are creating new functionality that requires new data to be stored in a new table, then you can create a new Class object that extends the ObjectModel. Sometimes that is overkill since you can just write insert/select SQL statements directly. Just use your judgement, and find what will be the easiest for you to maintain Okey, got it , now i have a clear idea about how doing it, thank you so much again it's been so much helpful Link to comment Share on other sites More sharing options...
phpist Posted February 2, 2018 Share Posted February 2, 2018 Hello @sicine, I think that the only design pattern that was mentioned here is the MVC, but I can see that the Singleton design pattern is used as well in e.g.: DB class and Cache class, I think there's also the Adapter design pattern as I could see it in the latest versions of Ps 1.6.x in Adapter folder. I hope this helps you Cheers 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