magento限制产品收集调用中返回的项目数 [英] magento limiting number of returned items in product collection call

查看:166
本文介绍了magento限制产品收集调用中返回的项目数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在list.phtml模板的副本中手动限制返回的结果的数量,但它的结果比我预想的更困难。

Im trying to limit the number of returned results manually in a copy of the list.phtml template, but its turning out to be alot harder than I anticipated.

我尝试手动设置集合大小,但是再次无效。有人可以告诉我怎么做吗?

Ive tried manually setting the collection size, but ya once again nothing working. Can someone show me how to do this? Would be nmuch appreciated!

推荐答案

一个快速的方法是使用这个方法我最近发现了。您甚至可以直接在模板中使用它。

A quick way is with this method I recently discovered. You can even use it directly in the template.

$_productCollection = clone $this->getLoadedProductCollection();
$_productCollection->clear()
                   ->setPageSize(3)
                   ->load();

这篇关于magento限制产品收集调用中返回的项目数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆