|
12 | 12 | use Magento\Catalog\Model\Indexer\Product\Price\PriceTableResolver; |
13 | 13 | use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; |
14 | 14 | use Magento\Catalog\Model\Product\Gallery\ReadHandler as GalleryReadHandler; |
| 15 | +use Magento\Catalog\Model\ResourceModel\Category; |
15 | 16 | use Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory; |
16 | 17 | use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; |
17 | 18 | use Magento\CatalogUrlRewrite\Model\Storage\DbStorage; |
|
23 | 24 | use Magento\Framework\Indexer\DimensionFactory; |
24 | 25 | use Magento\Store\Model\Indexer\WebsiteDimensionProvider; |
25 | 26 | use Magento\Store\Model\Store; |
26 | | -use Magento\Catalog\Model\ResourceModel\Category; |
27 | 27 |
|
28 | 28 | /** |
29 | 29 | * Product collection |
@@ -1013,9 +1013,9 @@ public function getMaxAttributeValue($attribute) |
1013 | 1013 | $tableAlias = $attributeCode . '_max_value'; |
1014 | 1014 | $fieldAlias = 'max_' . $attributeCode; |
1015 | 1015 | $condition = 'e.entity_id = ' . $tableAlias . '.entity_id AND ' . $this->_getConditionSql( |
1016 | | - $tableAlias . '.attribute_id', |
1017 | | - $attribute->getId() |
1018 | | - ); |
| 1016 | + $tableAlias . '.attribute_id', |
| 1017 | + $attribute->getId() |
| 1018 | + ); |
1019 | 1019 |
|
1020 | 1020 | $select->join( |
1021 | 1021 | [$tableAlias => $attribute->getBackend()->getTable()], |
@@ -1048,9 +1048,9 @@ public function getAttributeValueCountByRange($attribute, $range) |
1048 | 1048 | $tableAlias = $attributeCode . '_range_count_value'; |
1049 | 1049 |
|
1050 | 1050 | $condition = 'e.entity_id = ' . $tableAlias . '.entity_id AND ' . $this->_getConditionSql( |
1051 | | - $tableAlias . '.attribute_id', |
1052 | | - $attribute->getId() |
1053 | | - ); |
| 1051 | + $tableAlias . '.attribute_id', |
| 1052 | + $attribute->getId() |
| 1053 | + ); |
1054 | 1054 |
|
1055 | 1055 | $select->reset(\Magento\Framework\DB\Select::GROUP); |
1056 | 1056 | $select->join( |
@@ -1088,9 +1088,9 @@ public function getAttributeValueCount($attribute) |
1088 | 1088 |
|
1089 | 1089 | $select->reset(\Magento\Framework\DB\Select::GROUP); |
1090 | 1090 | $condition = 'e.entity_id=' . $tableAlias . '.entity_id AND ' . $this->_getConditionSql( |
1091 | | - $tableAlias . '.attribute_id', |
1092 | | - $attribute->getId() |
1093 | | - ); |
| 1091 | + $tableAlias . '.attribute_id', |
| 1092 | + $attribute->getId() |
| 1093 | + ); |
1094 | 1094 |
|
1095 | 1095 | $select->join( |
1096 | 1096 | [$tableAlias => $attribute->getBackend()->getTable()], |
@@ -1783,30 +1783,19 @@ public function addAttributeToSort($attribute, $dir = self::SORT_ORDER_ASC) |
1783 | 1783 | */ |
1784 | 1784 | protected function _prepareProductLimitationFilters() |
1785 | 1785 | { |
1786 | | - if (isset( |
1787 | | - $this->_productLimitationFilters['visibility'] |
1788 | | - ) && !isset( |
1789 | | - $this->_productLimitationFilters['store_id'] |
1790 | | - ) |
1791 | | - ) { |
| 1786 | + if (isset($this->_productLimitationFilters['visibility']) |
| 1787 | + && !isset($this->_productLimitationFilters['store_id'])) { |
1792 | 1788 | $this->_productLimitationFilters['store_id'] = $this->getStoreId(); |
1793 | 1789 | } |
1794 | | - if (isset( |
1795 | | - $this->_productLimitationFilters['category_id'] |
1796 | | - ) && !isset( |
1797 | | - $this->_productLimitationFilters['store_id'] |
1798 | | - ) |
1799 | | - ) { |
| 1790 | + |
| 1791 | + if (isset($this->_productLimitationFilters['category_id']) |
| 1792 | + && !isset($this->_productLimitationFilters['store_id'])) { |
1800 | 1793 | $this->_productLimitationFilters['store_id'] = $this->getStoreId(); |
1801 | 1794 | } |
1802 | | - if (isset( |
1803 | | - $this->_productLimitationFilters['store_id'] |
1804 | | - ) && isset( |
1805 | | - $this->_productLimitationFilters['visibility'] |
1806 | | - ) && !isset( |
1807 | | - $this->_productLimitationFilters['category_id'] |
1808 | | - ) |
1809 | | - ) { |
| 1795 | + |
| 1796 | + if (isset($this->_productLimitationFilters['store_id']) |
| 1797 | + && isset($this->_productLimitationFilters['visibility']) |
| 1798 | + && !isset($this->_productLimitationFilters['category_id'])) { |
1810 | 1799 | $this->_productLimitationFilters['category_id'] = $this->_storeManager->getStore( |
1811 | 1800 | $this->_productLimitationFilters['store_id'] |
1812 | 1801 | )->getRootCategoryId(); |
@@ -1837,14 +1826,8 @@ protected function _productLimitationJoinWebsite() |
1837 | 1826 | $filters['website_ids'], |
1838 | 1827 | 'int' |
1839 | 1828 | ); |
1840 | | - } elseif (isset( |
1841 | | - $filters['store_id'] |
1842 | | - ) && (!isset( |
1843 | | - $filters['visibility'] |
1844 | | - ) && !isset( |
1845 | | - $filters['category_id'] |
1846 | | - )) && !$this->isEnabledFlat() |
1847 | | - ) { |
| 1829 | + } elseif (isset($filters['store_id']) && !$this->isEnabledFlat() |
| 1830 | + && (!isset($filters['visibility']) && !isset($filters['category_id']))) { |
1848 | 1831 | $joinWebsite = true; |
1849 | 1832 | $websiteId = $this->_storeManager->getStore($filters['store_id'])->getWebsiteId(); |
1850 | 1833 | $conditions[] = $this->getConnection()->quoteInto('product_website.website_id = ?', $websiteId, 'int'); |
@@ -2431,7 +2414,6 @@ private function getGalleryReadHandler() |
2431 | 2414 | * |
2432 | 2415 | * @return \Magento\Catalog\Model\ResourceModel\Product\Gallery |
2433 | 2416 | * @deprecated 101.0.1 |
2434 | | - * |
2435 | 2417 | */ |
2436 | 2418 | private function getMediaGalleryResource() |
2437 | 2419 | { |
|
0 commit comments