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

Updating the module code

Updating the MySQL table is good, but, for the moment, our module does not use this new field.

Updating the ObjectModel class

Since we use an ObjectModel class to insert comments and retrieve it, we will add the id_shop field in this class.

In your classes/MyModComment.php file, add the shop ID just below the comment ID:

public $id_shop;

Then, add it in the fields list of the $definitions array:

'id_shop' => array('type' => self::TYPE_INT, 'validate' =>
'isUnsignedId', 'required' => true),

Note

If you don't remember how an ObjectModel class works, please refer to Chapter 5, Front Controllers, Object Models, and Overrides.

Now, open the controllers/hook/displayProductTabContent.php controller and search for the processProductTabContent ...

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