Skip to content

Commit 15957c9

Browse files
committed
AC-711::CR Changes done
1 parent ce80a0c commit 15957c9

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Magento\Store\Model\Indexer\WebsiteDimensionProvider;
2626
use Magento\Store\Model\Store;
2727
use Magento\Catalog\Model\ResourceModel\Category;
28+
use Zend_Db_Expr;
2829

2930
/**
3031
* Product collection
@@ -613,7 +614,7 @@ protected function _initSelect()
613614
[self::MAIN_TABLE_ALIAS => $this->getEntity()->getFlatTableName()],
614615
null
615616
)->columns(
616-
['status' => new \Zend_Db_Expr(ProductStatus::STATUS_ENABLED)]
617+
['status' => new Zend_Db_Expr(ProductStatus::STATUS_ENABLED)]
617618
);
618619
$this->addAttributeToSelect($this->getResource()->getDefaultAttributes());
619620
if ($this->_catalogProductFlatState->getFlatIndexerHelper()->isAddChildData()) {
@@ -998,7 +999,7 @@ public function getMaxAttributeValue($attribute)
998999
$select->join(
9991000
[$tableAlias => $attribute->getBackend()->getTable()],
10001001
$condition,
1001-
[$fieldAlias => new \Zend_Db_Expr('MAX(' . $tableAlias . '.value)')]
1002+
[$fieldAlias => new Zend_Db_Expr('MAX(' . $tableAlias . '.value)')]
10021003
)->group(
10031004
'e.entity_type_id'
10041005
);
@@ -1035,8 +1036,8 @@ public function getAttributeValueCountByRange($attribute, $range)
10351036
[$tableAlias => $attribute->getBackend()->getTable()],
10361037
$condition,
10371038
[
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 . ')')
10401041
]
10411042
)->group(
10421043
'range_' . $attributeCode
@@ -1074,8 +1075,8 @@ public function getAttributeValueCount($attribute)
10741075
[$tableAlias => $attribute->getBackend()->getTable()],
10751076
$condition,
10761077
[
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')
10791080
]
10801081
)->group(
10811082
'value_' . $attributeCode
@@ -1281,7 +1282,7 @@ public function getProductCountSelect()
12811282
'count_table.product_id = e.entity_id',
12821283
[
12831284
'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)')
12851286
]
12861287
)->where(
12871288
'count_table.store_id = ?',
@@ -2058,28 +2059,29 @@ protected function _applyProductLimitations()
20582059
*/
20592060
protected function _applyZeroStoreProductLimitations()
20602061
{
2061-
$filters = $this->_productLimitationFilters;
2062+
$filters = $this->_productLimitationFilters;
20622063
$categories = $this->getChildrenCategories((int)$filters['category_id']);
20632064

20642065
$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+
20702072
$categoryProductSelect->columns([
20712073
"product_id" => "product_id",
2072-
"min_position" => new \Zend_Db_Expr("MIN(position)")
2074+
"min_position" => new Zend_Db_Expr("MIN(position)")
20732075
]);
20742076
$categoryProductSelect->where("category_id IN (?)", $categories);
20752077
$categoryProductSelect->group("product_id");
20762078

2077-
$joinCond = "cat_pro.product_id = e.entity_id";
2079+
$joinCond = 'cat_pro.product_id = e.entity_id';
20782080

2079-
$fromPart = $this->getSelect()->getPart(\Magento\Framework\DB\Select::FROM);
2081+
$fromPart = $this->getSelect()->getPart(Select::FROM);
20802082
if (isset($fromPart['cat_pro'])) {
20812083
$fromPart['cat_pro']['joinCondition'] = $joinCond;
2082-
$this->getSelect()->setPart(\Magento\Framework\DB\Select::FROM, $fromPart);
2084+
$this->getSelect()->setPart(Select::FROM, $fromPart);
20832085
} else {
20842086
$this->getSelect()->join(
20852087
['cat_pro' => $categoryProductSelect],
@@ -2527,7 +2529,7 @@ private function addIsSaleableAttributeToFilter($condition): self
25272529
foreach ($columns as $columnEntry) {
25282530
list($correlationName, $column, $alias) = $columnEntry;
25292531
if ($alias == 'is_saleable') {
2530-
if ($column instanceof \Zend_Db_Expr) {
2532+
if ($column instanceof Zend_Db_Expr) {
25312533
$field = $column;
25322534
} else {
25332535
$connection = $this->getSelect()->getConnection();

0 commit comments

Comments
 (0)