Example #1
0
 /**
  * Helper function that adds a FilterGroup to the collection.
  *
  * @param FilterGroup $filterGroup
  * @param Collection $collection
  * @return void
  * @throws \Magento\Framework\Exception\InputException
  */
 protected function addFilterGroupToCollection(FilterGroup $filterGroup, Collection $collection)
 {
     $fields = [];
     $conditions = [];
     foreach ($filterGroup->getFilters() as $filter) {
         $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq';
         $fields[] = $this->translateField($filter->getField());
         $conditions[] = [$condition => $filter->getValue()];
     }
     if ($fields) {
         $collection->addFieldToFilter($fields, $conditions);
     }
 }
Example #2
0
 /**
  * Resource initialization
  * @return $this
  */
 protected function _initSelect()
 {
     parent::_initSelect();
     $this->addTaxClass();
     return $this;
 }