简体   繁体   中英

how to pagination in Prestashop 1.7?

I would like to create a pagination in Prestashop 1.7

I have a function with an array, which I assign to a.tpl template

$brands = $this->getBrands();
$this->context->smarty->assign($brands);
parent::initContent();
$this->setTemplate('brandschr.tpl');

I have not found much information how to use pagination.tpl or an example how to do it.

Please send me your idea if you have done it before or any example for me.

I would advice you to assign smarty variably only to the pages where it is needed. So let's say you want to add brands to your custom pagination you only assign this on the pages that actually contain a brand.

$brands = $this->getBrands();
$this->context->smarty->assign($customPagination);

And then create an override in the theme at /templates/_partials/pagination.tpl. In this file just check if your "customPagination" isset and then display your custom-pagination.tpl (brandschr.tpl)

This will keep the original PS pagination intact.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM