0

I'm trying to limit order for admin users by category, I can find the collection of product id by category and collect sales/order but how can I use this with an event observer?

$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));
4

1 回答 1

1

您可以为此使用 SetPageSize 和 SetCurPage

$col = Mage::getModel('你的模型') ->getCollection() ->setPageSize(17) ->setCurPage(1);

高温高压

于 2014-03-27T12:51:29.137 回答