Jump to content

Is the prestashop dev team using a framework ?


mark2
 Share

Recommended Posts

Hi,

Given the consistent structure of the DB, classes, hooks etc I'm assuming the Prestashop team is using some internal tools or a framework for creating new classes etc. Does anyone know if this exists and is available ?

Regards,
Mark

Share this post


Link to post
Share on other sites

I thought I'd share the approach I'm taking to extending the core functionality of Prestashop. You might have a better approach or might be trying to do the same thing.

I can see two approaches to this. One is to do a "tight" integration and modify all the necessary classes to follow the same design pattern as Prestashop. In this case it would probably be best to create a new "version" of prestashop and use the upgrade feature in the install directory to modify the database for the new features. There is a risk that later upgrades cause a naming conflict but that could be minimized with a naming convention.

Another approach is a "tac-on" integration where all the changes are made in new files so existing tables, classes etc are not modified. For example today a Customer object has a function for returning the groups associated with the customer. If groups were being added to Prestashop (they already exist) this would require changes to the Customer class etc. Another approach would be to have a function in the Group class that returns the groups for a customer, the Customer class is not modified, a new table in the database would be created to associate customers to groups. In this case the modifications to the DB could be made in the admin panel by "enabling" the functionality - this would create and populate the necessary tables, so no no install/upgrade required.

This second approach is the best one at the moment I think.

Comments welcome.

Share this post


Link to post
Share on other sites

First problem I hit with this is providing features in the admin tabs. The management of information related to a customer is hardcoded in the AdminCustomers.php

Rather than building the DB during an upgrade process I've added a call during the construction of the Admin tab for the functionality I need to create the tables if they don't already exist.

I'm now changing the core classes to add the functionality. This makes the changes more distributed unfortunately.

Share this post


Link to post
Share on other sites

  • 4 months later...

Greetings, and my hat off for your efforts.

I am fairly fresh to web development and have no education related to it, and am therefor in no position to claim I know the full extent of the actual core functionality of PrestaShop nor would I know where to even begin what you are attempting. I was pretty sure PrestaShop was perfect for me, in what balance of functionaly, community contribution, extendability, easy customization and what have you I was seeking. But from the point I "jumped aboard a year or so ago" up to this date, things seem to have stagnated a bit. The limitations of customizing and extending, without hacking away at the core till later upgrades become an utter nightmare... it's all very frustrating.

What you're attempting, and others I've talked to and read about, tells me there is a growing frustration mongst people seeking greater flexibility and smarter ways of handling things in the front and back office.

How is your efforts comming along? What's the status of your project, do you have any thoughts on a roadmap for where you wanna go with this... and what are you trying to accomplish more specificly?

Best regards and all the best wishes!

Feel free to send me a PM to keep in touch. I might not be a professional or even skilled programmer, but I do run several successful stores for well established clients, and am launching an own well financed store soon. I am willing to put quite a bit of effort into the successful improvement of PrestaShop. So to you and anyone reading this, feel free to pm me if this is something that concern you as well.

Share this post


Link to post
Share on other sites

Prestashop using smarty for templating which is basically the page layout and content hooks (www.smarty.net), and realies a lot of different built-in php functions embed in there own (such as validation using preg_match with custom parameters for each data entry type).

Look into making your own mods most definitely for most things, as code can quickly become unreliable and outdated when modifying core files of any php project.

Share this post


Link to post
Share on other sites

  • 5 months later...

Sorry, needed to bump this!

I would like to make Prestashop the base for my business.

How did you get on with your project?

Your experience would probably help a lot because I seem to be where you were then.

It would be great if you replied!

Share this post


Link to post
Share on other sites

Hi, we did make a lot of changes to Prestashop - the shop is online (mondizen.com) and I would appreciate your feedback.

At the 1.2.5 version is was difficult to make fundamental changes without touching the core. For example the eCard feature, club, gift vouchers, ordering of products on the shelves, being able to exclude products for specific countries, manipulating images when they are uploaded (centering, trimming etc), noting the customer's preferred language... all seemed to require hacking the core.

I have not looked at the latest release but I remember seeing a mention that changing core functionality has been made a lot easier. So if you are starting now it might be a lot easier to avoid going down the same path.

Our approach is to treat the first version of the store as a testing ground. This can provide an executable specification for aspects of a major upgrade. We don't imagine the current code base having a long lifetime.

Regards,
Mark

Share this post


Link to post
Share on other sites

Mrk,

Yes, you'll find that in 1.4 you can likely follow your original plan without any modification to the core. To date you still can't easily modify existing admin screens without affecting at least some core files - but as in your approach you can create your new tables and classes and link them to existing objects by storing the db id in your new table/object. It all depends if your new admin screens make sense stand-alone, or if functionality absolutely has to be integrated into the screens for the area it's affecting.

Paul

Share this post


Link to post
Share on other sites

Hi Paul,

We did make a few hacks to the admin tabs and it is a shame this still can't be done without touching the PHP. The front office makes good use of templates but the back office...

Still it seems Prestashop is heading in the right direction.

In 1.2.5 there was also a lot of SQL distributed throughout the PHP code. Sometimes the same SQL is duplicated in different PHP files - a real maintenance nightmare. I would like to see a real layer between the SQL and PHP - maybe 1.4 has gone in this direction ?

Adding the tables/classes etc to make clean mods is a real pain - and laziness got the better of me. This prompted my original question about a "framework".

There is no doubt an opportunity for Prestashop or a new code base to think in terms of a meta programming kit (what I meant by framework). Basically I would like a point and click interface that allows me to build the skeleton for extending the core functionality, adding a module (front or back office). It probably needs to be planned from day one. eGroupware went quite a long way in this direction (although it is not well documented).

Regards,
Mark

Share this post


Link to post
Share on other sites

Yes that's a possibility for the future. They do use a "framework" of sorts. In that it's loosely an MVC architecture and much closer now to this than before. Pages are now "Controllers" rather than flat php files with the core included in them, "Views" being handled via smarty and the template files and the "Models" are the core objects themselves.

Definitely getting better and I feel that the admin side is more a question of timing than anything else. You can actually do quite a lot in Admin terms just by inheriting the AdminTab class and pointing it at your object, but at the moment customising via class overrides isn't available.

Paul

Share this post


Link to post
Share on other sites

Hi Paul,

I imagine we would agree that MVC is a design pattern.

I'm sure they would develop a lot faster if they also built tools for abstracting the MVC pattern. In particular those tools could be a huge help for refactoring.

To make the core extensible it might be worth trying Aspect Orientation. I imagine this must exist for PHP. Of course the underlying architecture needs to be very clean to avoid an AOP bolonaise.

But maybe that will need to wait for the next generation of e-commerce apps. I imagine there are some people in the Magento and Prestashop teams that are learning a lot about what needs to be built in from the start...

Regards,
Mark

Share this post


Link to post
Share on other sites

Yes that's a possibility for the future. They do use a "framework" of sorts. In that it's loosely an MVC architecture and much closer now to this than before. Pages are now "Controllers" rather than flat php files with the core included in them, "Views" being handled via smarty and the template files and the "Models" are the core objects themselves.

Definitely getting better and I feel that the admin side is more a question of timing than anything else. You can actually do quite a lot in Admin terms just by inheriting the AdminTab class and pointing it at your object, but at the moment customising via class overrides isn't available.

Paul

Paul, just because you call something a duck doesn't mean it's a duck. Their "version" of MVC is atrocious. It is nothing like a real MVC or MMVC framework like CodeIgniter, Yii or Kohana.

We would all be better served if they would trash this core and rebuild it from scratch with a fully MVC framework.
I am a very seasoned developer and still have trouble finding out how they have done some things.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More