Could someone help me find what is wrong with this code? I am trying to learn from Prestashop Module Development book but can not pass this step. Prestashop1.6.1.10 Controller:
<?php
class MyModCommentsCommentsModuleFrontController extends ModuleFrontController
{
protected function initList()
{
$this->setTemplate('list.tpl');
}
public function initContent()
{
parent::initContent();
$id_product = (int)Tools::getValue('id_product');
$module_action = Tools::getValue('module_action');
$actions_list = array('list' => 'initList');
if ($id_product > 0 && isset($actions_list[$module_action]))
$this->$actions_list[$module_action]();
}
}
Template:
<h1>
{l s='Comments on product' mod='mymodcomments'}
"{$product->name}"
</h1>
And in displayProductTabContent I have link:
<div class="rte">
{assign var=params value=[
'module_action' => 'list',
'id_product'=> $smarty.get.id_product
]}
<a href="{$link->getModuleLink('mymodcomments', 'comments', $params)}">
{l s='See all comments' mod='mymodcomments'}
</a>
</div>