我试图按类别限制管理员用户的订单,我按类别找到产品ID的集合并收集销售/订单,但我如何使用事件观察者这请帮助我
$category_id = 44;
$category = Mage::getModel("catalog/category")->load($category_id);
$products = Mage::getModel("catalog/product")->getCollection()
->addCategoryFilter($category);
Next I collect just the product ids so I can use them
$product_ids = array();
foreach ($products as $product)
$product_ids[] = $product->getId();
$items = Mage::getModel("sales/order_item")->getCollection()
->addFieldToFilter("product_id", array("in" => $product_ids));
答案 0 :(得分:1)
您可以使用SetPageSize和SetCurPage
$ col = Mage :: getModel('你的模特') - > getCollection() - > setPageSize(17) - > setCurPage(1);
HTH