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
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

Associating the chosen relay point with the cart


To store the customer choice for their relay point, we will first have to create a MySQL table to save the association between the chosen relay point and the customer's cart.

In your module's root directory, create a new directory named install. In this directory, create one file named install.sql; this file will contain the new table creation:

CREATE TABLE IF NOT EXISTS `PREFIX_mymod_carrier_cart` (
  `id_mymod_carrier_cart` int(11) NOT NULL AUTO_INCREMENT,
  `id_cart` int(11) NOT NULL,
  `relay_point` text NOT NULL,
  `date_add` datetime NOT NULL,
  PRIMARY KEY (`id_mymod_carrier_cart`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Note

In the source code of this chapter, I also created an uninstall.sql file as an example. However, it is better not to delete data on module uninstallation to avoid the loss of data on orders.

Then, in our module's main class, we will add the loadSQLFile method that we used in a previous chapter:

public...
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