The last step will be to display comments filled in by customers on the front office, and we will also use the configuration values we created in the previous chapter. Let's begin by creating a method named
assignProductTabContent, where we will retrieve the concerned
id_product parameter (which is in the
$id_product = Tools::getValue('id_product');
Then make the SQL request to retrieve all comments concerning the products of the page you are on:
$comments = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'mymod_comment WHERE id_product = '.(int)$id_product);
You should have noticed that I used the
_DB_PREFIX_ constant, which corresponds to the prefix you chose when you installed your shop. In most cases, ...