Kevin Breban
Kevin Breban

Reputation: 3

Add a product into a custom page - Prestashop 1.6

All is in the question, is it possible to add a product into a page that i created ?

Do i have to build some controllers etc. ?

Upvotes: 0

Views: 586

Answers (1)

Knowband Plugins
Knowband Plugins

Reputation: 1317

Yes, it is possible to show PrestaShop products on a custom page. You first have to create a front controller through a module as follows.

You need to create a separate controller for that in your module at the following path:

/modules/supercheckout/controllers/front/fcont.php (where supercheckout is your module name)

and write the following code in the file:

class SupercheckoutFcontModuleFrontController extends ModuleFrontController
{

public function initContent()
{
        parent::initContent();
        $this->setTemplate('template_file.tpl');
}
}

And then include the product-list.tpl file of the theme in the template file of your module to list products in on your controller page.

{include file="$tpl_dir./product-list.tpl" products=$filtered_products id='block_list_id'}

Note: The $filtered_products variable contains the products that are to be loaded on the custom controller page.

Upvotes: 0

Related Questions