/** * Load product collection Id(s) */ public function load() { $attrFilterArray = array(); $attrFilterArray['name'] = 'like'; $attrFilterArray['sku'] = 'startsWith'; $attrFilterArray['type'] = 'eq'; $attrFilterArray['attribute_set'] = 'eq'; $attrFilterArray['visibility'] = 'eq'; $attrFilterArray['status'] = 'eq'; $attrFilterArray['price'] = 'fromTo'; $attrFilterArray['qty'] = 'fromTo'; $attrFilterArray['store_id'] = 'eq'; $attrToDb = array('type' => 'type_id', 'attribute_set' => 'attribute_set_id'); $filters = $this->_parseVars(); if ($qty = $this->getFieldValue($filters, 'qty')) { $qtyFrom = isset($qty['from']) ? (double) $qty['from'] : 0; $qtyTo = isset($qty['to']) ? (double) $qty['to'] : 0; $qtyAttr = array(); $qtyAttr['alias'] = 'qty'; $qtyAttr['attribute'] = 'cataloginventory/stock_item'; $qtyAttr['field'] = 'qty'; $qtyAttr['bind'] = 'product_id=entity_id'; $qtyAttr['cond'] = "{{table}}.qty between '{$qtyFrom}' AND '{$qtyTo}'"; $qtyAttr['joinType'] = 'inner'; $this->setJoinField($qtyAttr); } parent::setFilter($attrFilterArray, $attrToDb); if ($price = $this->getFieldValue($filters, 'price')) { $this->_filter[] = array('attribute' => 'price', 'from' => $price['from'], 'to' => $price['to']); $this->setJoinAttr(array('alias' => 'price', 'attribute' => 'catalog_product/price', 'bind' => 'entity_id', 'joinType' => 'LEFT')); } /**Start Code For Vendor**/ $isVendor = Mage::helper('cartmart')->isVendor(); //current user is vendor or not if ($isVendor) { /**Fetch Current User Id**/ $user = Mage::getSingleton('admin/session'); $userId = $user->getUser()->getUserId(); $this->_filter[] = array('attribute' => 'vendor', 'eq' => $userId); } /**End Code For Vendor**/ return parent::load(); }