Magento:如何限制特定类别的集合(销售/订单)?

时间:2014-03-27 12:43:48

标签: magento events sales

我试图按类别限制管理员用户的订单,我按类别找到产品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));

1 个答案:

答案 0 :(得分:1)

您可以使用SetPageSize和SetCurPage

  

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

HTH