Ejemplo n.º 1
0
 public function load()
 {
     $attrFilterArray = array();
     $attrFilterArray['name'] = 'like';
     $attrFilterArray['sku'] = 'like';
     $attrFilterArray['type'] = 'eq';
     $attrFilterArray['attribute_set'] = 'eq';
     $attrFilterArray['visibility'] = 'eq';
     $attrFilterArray['status'] = 'eq';
     $attrFilterArray['price'] = 'fromTo';
     $attrFilterArray['qty'] = 'fromTo';
     $attrToDb = array('type' => 'type_id', 'attribute_set' => 'attribute_set_id');
     parent::setFilter($attrFilterArray, $attrToDb);
     parent::load();
 }
Ejemplo n.º 2
0
 public function load()
 {
     $addressType = $this->getVar('filter/addressType');
     if ($addressType == 'both') {
         $addressType = array('default_billing', 'default_shipping');
     }
     $attrFilterArray = array();
     $attrFilterArray['firstname'] = 'like';
     $attrFilterArray['lastname'] = 'like';
     $attrFilterArray['email'] = 'like';
     $attrFilterArray['group'] = 'eq';
     $attrFilterArray['customer_address/telephone'] = array('type' => 'like', 'bind' => $addressType);
     $attrFilterArray['customer_address/postcode'] = array('type' => 'like', 'bind' => $addressType);
     $attrFilterArray['customer_address/country'] = array('type' => 'eq', 'bind' => $addressType);
     $attrFilterArray['customer_address/region'] = array('type' => 'like', 'bind' => $addressType);
     $attrFilterArray['created_at'] = 'dateFromTo';
     $attrToDb = array('group' => 'group_id', 'customer_address/country' => 'customer_address/country_id');
     parent::setFilter($attrFilterArray, $attrToDb);
     parent::load();
 }
Ejemplo n.º 3
0
 /**
  * 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'));
     }
     return parent::load();
 }
Ejemplo n.º 4
0
 public function load()
 {
     $addressType = $this->getVar('filter/adressType');
     //error in key filter addressType
     if ($addressType == 'both') {
         $addressType = array('default_billing', 'default_shipping');
     }
     $attrFilterArray = array();
     $attrFilterArray['firstname'] = 'like';
     $attrFilterArray['lastname'] = 'like';
     $attrFilterArray['email'] = 'like';
     $attrFilterArray['group'] = 'eq';
     $attrFilterArray['customer_address/telephone'] = array('type' => 'like', 'bind' => $addressType);
     $attrFilterArray['customer_address/postcode'] = array('type' => 'like', 'bind' => $addressType);
     $attrFilterArray['customer_address/country'] = array('type' => 'eq', 'bind' => $addressType);
     $attrFilterArray['customer_address/region'] = array('type' => 'like', 'bind' => $addressType);
     $attrFilterArray['created_at'] = 'datetimeFromTo';
     /*
      * Fixing date filter from and to
      */
     if ($var = $this->getVar('filter/created_at/from')) {
         $this->setVar('filter/created_at/from', $var . ' 00:00:00');
     }
     if ($var = $this->getVar('filter/created_at/to')) {
         $this->setVar('filter/created_at/to', $var . ' 23:59:59');
     }
     $attrToDb = array('group' => 'group_id', 'customer_address/country' => 'customer_address/country_id');
     // Added store filter
     if ($storeId = $this->getStoreId()) {
         $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
         if ($websiteId) {
             $this->_filter[] = array('attribute' => 'website_id', 'eq' => $websiteId);
         }
     }
     parent::setFilter($attrFilterArray, $attrToDb);
     return parent::load();
 }