O'Reilly logo

PrestaShop Module Development by Fabien Serny

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required