php - 如何在 Prestashop 1.7 中进行分页?
问题描述
我想在 Prestashop 1.7 中创建一个分页
我有一个带有数组的函数,我将其分配给 .tpl 模板
$brands = $this->getBrands();
$this->context->smarty->assign($brands);
parent::initContent();
$this->setTemplate('brandschr.tpl');
我没有找到太多关于如何使用 pagination.tpl 的信息或如何使用它的示例。
如果您以前做过或为我提供任何示例,请将您的想法发送给我。
解决方案
我建议您仅将 smarty 可变地分配给需要它的页面。因此,假设您想将品牌添加到您的自定义分页中,您只需在实际包含品牌的页面上分配它。
$brands = $this->getBrands();
$this->context->smarty->assign($customPagination);
然后在 /templates/_partials/pagination.tpl 的主题中创建一个覆盖。在此文件中,只需检查您的“customPagination”是否设置,然后显示您的 custom-pagination.tpl (brandschr.tpl)
这将保持原始 PS 分页完好无损。
推荐阅读
- actions-on-google - Actions on Google 启动自定义操作(不是 main actions.intent.MAIN)
- javascript - 我的功能是验证表单中的复选框不适用于 jquery
- python - 读取和写入存储在 Django Models.py 中的 PDF
- firebase - 在 Play 计费示例应用中部署后端服务器步骤
- python - 如何对 .json 文件进行下采样
- c# - 如何在我的字节数组中包含这个字节?
- javascript - 在 ES6+ 中导出命名空间
- php - PHP JWT:: **解码** 过期令牌
- javascript - ReactJs Leaflet Marker Location 位置问题
- javascript - 如何在 Rails“User.select(...)”中传递 JavaScript 变量