Jump to content

Edit History

Najam Sajid

Najam Sajid

I am in learning stage and try to develop a module (Module for comments on product page) by following some books and prestashop documentation using Prestashop 1.6.
can someone explain how this function works. Actually I am unable to understand this complex array for routing. This is routing for "Sell all comment" on next custom page that I have created.

Can someone make me understand this array directly here or through some video or anything?
Here is the code:

public function hookModuleRoutes()
        {
            return array(
                'module-mymodcomments-comments' => array(
                    'controller' => 'comments',
                    'rule' => 'product-comments{/:module_action}/{/:id_product}/page{/:page}',
                    'keywords' => array(
                        'id_product' => array(
                            'regexp' => '[\d]+',
                            'param' => 'id_product'
                        ),
                        'page' => array(
                            'regexp' => '[\d]+',
                            'param' => 'page'
                        ),
                        'module_action' => array(
                            'regexp' => '[\w]+',
                            'param' => 'module_action'
                        ),
                    ),
                    'params' => array(
                        'fc' => 'module',
                        'module' => 'mymodcomments',
                        'controller' => 'comments'
                    )
                )
            );
        }

 

Najam Sajid

Najam Sajid

I am in learning stage and try to develop a module (Module for comments on product page) by following some books and prestashop documentation using Prestashop 1.6.
can someone explain how this function works. Actually I am unable to understand this complex array for routing. This is routing for "Sell all comment" on next custom page that I have created.

Can someone make me understand this array directly here or through some video or anything?
Here is the code:

public function hookModuleRoutes()
        {
            return array(
                'module-mymodcomments-comments' => array(
                    'controller' => 'comments',
                    'rule' => 'product-comments{/:module_action}/{/:id_product}/page{/:page}',
                    'keywords' => array(
                        'id_product' => array(
                            'regexp' => '[\d]+',
                            'param' => 'id_product'
                        ),
                        'page' => array(
                            'regexp' => '[\d]+',
                            'param' => 'page'
                        ),
                        'module_action' => array(
                            'regexp' => '[\w]+',
                            'param' => 'module_action'
                        ),
                    ),
                    'params' => array(
                        'fc' => 'module',
                        'module' => 'mymodcomments',
                        'controller' => 'comments'
                    )
                )
            );
        }

public function hookModuleRoutes()

{

return array(

'module-mymodcomments-comments' => array(

'controller' => 'comments',

'rule' => 'product-comments{/:module_action}/{/:id_product}/page{/:page}',

'keywords' => array(

'id_product' => array(

'regexp' => '[\d]+',

'param' => 'id_product'

),

'page' => array(

'regexp' => '[\d]+',

'param' => 'page'

),

'module_action' => array(

'regexp' => '[\w]+',

'param' => 'module_action'

),

),

'params' => array(

'fc' => 'module',

'module' => 'mymodcomments',

'controller' => 'comments'

)

)

);

 

 

 

×
×
  • Create New...