仅显示特价产品
是否可以仅显示特殊价格的产品?
我将{%如果product.special%}放在我的product_card.twig中,那效果很好,但是我的分页无法正常工作。它仍然显示属于该类别的产品总数。
我在某些类别中有5种产品,但分页说“显示9(1页)中的1到9个”。
还有其他方法可以实现这一目标吗?
Is it possible to show only products with special prices?
I put {% if product.special %} in my product_card.twig, and that works fine but then my pagination doesn't work correctly. It still shows the total number of products that belongs to that category.
I have 5 products in some category but pagination says "Showing 1 to 9 of 9 (1 pages)".
Is there any other way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该创建新的模型函数,从DB获取查询
,并通过控制器获得结果,然后控制器将其发送到您的树枝文件。
You should create new model function that get query from DB some thing like
and get result by controller then controller send it to your Twig file.