|
25 | 25 | use Magento\Store\Model\Indexer\WebsiteDimensionProvider;
|
26 | 26 | use Magento\Store\Model\Store;
|
27 | 27 | use Magento\Catalog\Model\ResourceModel\Category;
|
| 28 | +use Zend_Db_Expr; |
28 | 29 |
|
29 | 30 | /**
|
30 | 31 | * Product collection
|
@@ -613,7 +614,7 @@ protected function _initSelect()
|
613 | 614 | [self::MAIN_TABLE_ALIAS => $this->getEntity()->getFlatTableName()],
|
614 | 615 | null
|
615 | 616 | )->columns(
|
616 |
| - ['status' => new \Zend_Db_Expr(ProductStatus::STATUS_ENABLED)] |
| 617 | + ['status' => new Zend_Db_Expr(ProductStatus::STATUS_ENABLED)] |
617 | 618 | );
|
618 | 619 | $this->addAttributeToSelect($this->getResource()->getDefaultAttributes());
|
619 | 620 | if ($this->_catalogProductFlatState->getFlatIndexerHelper()->isAddChildData()) {
|
@@ -998,7 +999,7 @@ public function getMaxAttributeValue($attribute)
|
998 | 999 | $select->join(
|
999 | 1000 | [$tableAlias => $attribute->getBackend()->getTable()],
|
1000 | 1001 | $condition,
|
1001 |
| - [$fieldAlias => new \Zend_Db_Expr('MAX(' . $tableAlias . '.value)')] |
| 1002 | + [$fieldAlias => new Zend_Db_Expr('MAX(' . $tableAlias . '.value)')] |
1002 | 1003 | )->group(
|
1003 | 1004 | 'e.entity_type_id'
|
1004 | 1005 | );
|
@@ -1035,8 +1036,8 @@ public function getAttributeValueCountByRange($attribute, $range)
|
1035 | 1036 | [$tableAlias => $attribute->getBackend()->getTable()],
|
1036 | 1037 | $condition,
|
1037 | 1038 | [
|
1038 |
| - 'count_' . $attributeCode => new \Zend_Db_Expr('COUNT(DISTINCT e.entity_id)'), |
1039 |
| - 'range_' . $attributeCode => new \Zend_Db_Expr('CEIL((' . $tableAlias . '.value+0.01)/' . $range . ')') |
| 1039 | + 'count_' . $attributeCode => new Zend_Db_Expr('COUNT(DISTINCT e.entity_id)'), |
| 1040 | + 'range_' . $attributeCode => new Zend_Db_Expr('CEIL((' . $tableAlias . '.value+0.01)/' . $range . ')') |
1040 | 1041 | ]
|
1041 | 1042 | )->group(
|
1042 | 1043 | 'range_' . $attributeCode
|
@@ -1074,8 +1075,8 @@ public function getAttributeValueCount($attribute)
|
1074 | 1075 | [$tableAlias => $attribute->getBackend()->getTable()],
|
1075 | 1076 | $condition,
|
1076 | 1077 | [
|
1077 |
| - 'count_' . $attributeCode => new \Zend_Db_Expr('COUNT(DISTINCT e.entity_id)'), |
1078 |
| - 'value_' . $attributeCode => new \Zend_Db_Expr($tableAlias . '.value') |
| 1078 | + 'count_' . $attributeCode => new Zend_Db_Expr('COUNT(DISTINCT e.entity_id)'), |
| 1079 | + 'value_' . $attributeCode => new Zend_Db_Expr($tableAlias . '.value') |
1079 | 1080 | ]
|
1080 | 1081 | )->group(
|
1081 | 1082 | 'value_' . $attributeCode
|
@@ -1281,7 +1282,7 @@ public function getProductCountSelect()
|
1281 | 1282 | 'count_table.product_id = e.entity_id',
|
1282 | 1283 | [
|
1283 | 1284 | 'count_table.category_id',
|
1284 |
| - 'product_count' => new \Zend_Db_Expr('COUNT(DISTINCT count_table.product_id)') |
| 1285 | + 'product_count' => new Zend_Db_Expr('COUNT(DISTINCT count_table.product_id)') |
1285 | 1286 | ]
|
1286 | 1287 | )->where(
|
1287 | 1288 | 'count_table.store_id = ?',
|
@@ -2058,28 +2059,29 @@ protected function _applyProductLimitations()
|
2058 | 2059 | */
|
2059 | 2060 | protected function _applyZeroStoreProductLimitations()
|
2060 | 2061 | {
|
2061 |
| - $filters = $this->_productLimitationFilters; |
| 2062 | + $filters = $this->_productLimitationFilters; |
2062 | 2063 | $categories = $this->getChildrenCategories((int)$filters['category_id']);
|
2063 | 2064 |
|
2064 | 2065 | $categoryProductSelect = $this->getConnection()->select();
|
2065 |
| - $categoryProductSelect->from("catalog_category_product"); |
2066 |
| - $categoryProductSelect->reset(\Magento\Framework\DB\Select::ORDER); |
2067 |
| - $categoryProductSelect->reset(\Magento\Framework\DB\Select::LIMIT_COUNT); |
2068 |
| - $categoryProductSelect->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET); |
2069 |
| - $categoryProductSelect->reset(\Magento\Framework\DB\Select::COLUMNS); |
| 2066 | + $categoryProductSelect->from($this->getTable('catalog_category_product')) |
| 2067 | + ->reset(Select::ORDER) |
| 2068 | + ->reset(Select::LIMIT_COUNT) |
| 2069 | + ->reset(Select::LIMIT_OFFSET) |
| 2070 | + ->reset(Select::COLUMNS); |
| 2071 | + |
2070 | 2072 | $categoryProductSelect->columns([
|
2071 | 2073 | "product_id" => "product_id",
|
2072 |
| - "min_position" => new \Zend_Db_Expr("MIN(position)") |
| 2074 | + "min_position" => new Zend_Db_Expr("MIN(position)") |
2073 | 2075 | ]);
|
2074 | 2076 | $categoryProductSelect->where("category_id IN (?)", $categories);
|
2075 | 2077 | $categoryProductSelect->group("product_id");
|
2076 | 2078 |
|
2077 |
| - $joinCond = "cat_pro.product_id = e.entity_id"; |
| 2079 | + $joinCond = 'cat_pro.product_id = e.entity_id'; |
2078 | 2080 |
|
2079 |
| - $fromPart = $this->getSelect()->getPart(\Magento\Framework\DB\Select::FROM); |
| 2081 | + $fromPart = $this->getSelect()->getPart(Select::FROM); |
2080 | 2082 | if (isset($fromPart['cat_pro'])) {
|
2081 | 2083 | $fromPart['cat_pro']['joinCondition'] = $joinCond;
|
2082 |
| - $this->getSelect()->setPart(\Magento\Framework\DB\Select::FROM, $fromPart); |
| 2084 | + $this->getSelect()->setPart(Select::FROM, $fromPart); |
2083 | 2085 | } else {
|
2084 | 2086 | $this->getSelect()->join(
|
2085 | 2087 | ['cat_pro' => $categoryProductSelect],
|
@@ -2527,7 +2529,7 @@ private function addIsSaleableAttributeToFilter($condition): self
|
2527 | 2529 | foreach ($columns as $columnEntry) {
|
2528 | 2530 | list($correlationName, $column, $alias) = $columnEntry;
|
2529 | 2531 | if ($alias == 'is_saleable') {
|
2530 |
| - if ($column instanceof \Zend_Db_Expr) { |
| 2532 | + if ($column instanceof Zend_Db_Expr) { |
2531 | 2533 | $field = $column;
|
2532 | 2534 | } else {
|
2533 | 2535 | $connection = $this->getSelect()->getConnection();
|
|
0 commit comments