public function testGetSetCustomerGroupId()
 {
     $this->assertEquals($this->groupManagement->getNotLoggedInGroup()->getId(), $this->_model->getCustomerGroupId());
     $customerGroupId = 123;
     $this->_model->setCustomerGroupId($customerGroupId);
     $this->assertEquals($customerGroupId, $this->_model->getCustomerGroupId());
 }
Beispiel #2
0
 public function testGetSetCustomerGroupId()
 {
     $this->assertEquals(\Magento\Customer\Service\V1\CustomerGroupServiceInterface::NOT_LOGGED_IN_ID, $this->_model->getCustomerGroupId());
     $customerGroupId = 123;
     $this->_model->setCustomerGroupId($customerGroupId);
     $this->assertEquals($customerGroupId, $this->_model->getCustomerGroupId());
 }
Beispiel #3
0
 /**
  * Retrieve clean select with joined price index table
  *
  * @param \Magento\Catalog\Model\Layer\Filter\Price $filter
  * @return \Magento\Framework\DB\Select
  */
 protected function _getSelect($filter)
 {
     $collection = $filter->getLayer()->getProductCollection();
     $collection->addPriceData($filter->getCustomerGroupId(), $filter->getWebsiteId());
     if (!is_null($collection->getCatalogPreparedSelect())) {
         $select = clone $collection->getCatalogPreparedSelect();
     } else {
         $select = clone $collection->getSelect();
     }
     // reset columns, order and limitation conditions
     $select->reset(\Zend_Db_Select::COLUMNS);
     $select->reset(\Zend_Db_Select::ORDER);
     $select->reset(\Zend_Db_Select::LIMIT_COUNT);
     $select->reset(\Zend_Db_Select::LIMIT_OFFSET);
     // remove join with main table
     $fromPart = $select->getPart(\Zend_Db_Select::FROM);
     if (!isset($fromPart[\Magento\Catalog\Model\Resource\Product\Collection::INDEX_TABLE_ALIAS]) || !isset($fromPart[\Magento\Catalog\Model\Resource\Product\Collection::MAIN_TABLE_ALIAS])) {
         return $select;
     }
     // processing FROM part
     $priceIndexJoinPart = $fromPart[\Magento\Catalog\Model\Resource\Product\Collection::INDEX_TABLE_ALIAS];
     $priceIndexJoinConditions = explode('AND', $priceIndexJoinPart['joinCondition']);
     $priceIndexJoinPart['joinType'] = \Zend_Db_Select::FROM;
     $priceIndexJoinPart['joinCondition'] = null;
     $fromPart[\Magento\Catalog\Model\Resource\Product\Collection::MAIN_TABLE_ALIAS] = $priceIndexJoinPart;
     unset($fromPart[\Magento\Catalog\Model\Resource\Product\Collection::INDEX_TABLE_ALIAS]);
     $select->setPart(\Zend_Db_Select::FROM, $fromPart);
     foreach ($fromPart as $key => $fromJoinItem) {
         $fromPart[$key]['joinCondition'] = $this->_replaceTableAlias($fromJoinItem['joinCondition']);
     }
     $select->setPart(\Zend_Db_Select::FROM, $fromPart);
     // processing WHERE part
     $wherePart = $select->getPart(\Zend_Db_Select::WHERE);
     foreach ($wherePart as $key => $wherePartItem) {
         $wherePart[$key] = $this->_replaceTableAlias($wherePartItem);
     }
     $select->setPart(\Zend_Db_Select::WHERE, $wherePart);
     $excludeJoinPart = \Magento\Catalog\Model\Resource\Product\Collection::MAIN_TABLE_ALIAS . '.entity_id';
     foreach ($priceIndexJoinConditions as $condition) {
         if (strpos($condition, $excludeJoinPart) !== false) {
             continue;
         }
         $select->where($this->_replaceTableAlias($condition));
     }
     $select->where($this->_getPriceExpression($filter, $select) . ' IS NOT NULL');
     return $select;
 }