Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying PrestaShop Module Development
  • Table Of Contents Toc
  • Feedback & Rating feedback
PrestaShop Module Development

PrestaShop Module Development

By : Serny
4.5 (15)
close
close
PrestaShop Module Development

PrestaShop Module Development

4.5 (15)
By: Serny

Overview of this book

If you are a developer who is new to PrestaShop and wants to get a good foundation in development on the PrestaShop framework, this book is for you. It's assumed that you will have some experience with PHP5, jQuery, and HTML/CSS (no need to be an expert on it).
Table of Contents (13 chapters)
close
close
12
Index

Using object models to create cleaner code


At this point, we have a DB request (sometimes almost the same request) in different files of the module: controllers/front/comments, override/classes/Search.php, and mymodcomments.php. So it might be a good time to create the MyModComment object model. Create a directory named classes in your module's directory and place a file named MyModComment.php in it.

Note

The naming convention of PrestaShop is as follows:

  • Set the same name for the file and class

  • Use CamelCase for the name

  • Set the name in singular

  • The name should match the name of the table in the database

Creating the ObjectModel class

First, create your object class (name it as described previously) and extend it from ObjectModel. You will then have to create one public variable for each field and set the definitions array.

The definitions array is pretty easy to read; you have to perform the following steps (see the upcoming code example):

  1. Set the database table related to the object; in our case...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
PrestaShop Module Development
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon