Skip to content

Commit 36d075d

Browse files
committed
1 parent 4886bee commit 36d075d

File tree

3 files changed

+44
-80
lines changed

3 files changed

+44
-80
lines changed

app/code/core/Mage/Reports/Model/Resource/Report/Collection/Abstract.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,48 @@ public function load($printQuery = false, $logQuery = false)
261261
}
262262
return parent::load($printQuery, $logQuery);
263263
}
264+
265+
266+
/**
267+
* Get SQL for get record count
268+
*
269+
* @return Varien_Db_Select
270+
* @see Mage_Reports_Model_Resource_Report_Product_Viewed_Collection
271+
* @see Mage_Sales_Model_Resource_Report_Bestsellers_Collection
272+
*/
273+
public function getSelectCountSql()
274+
{
275+
$this->_renderFilters();
276+
$select = clone $this->getSelect();
277+
$select->reset(Zend_Db_Select::ORDER);
278+
return $this->getConnection()->select()->from($select, 'COUNT(*)');
279+
}
280+
281+
/**
282+
* Set ids for store restrictions
283+
*
284+
* @param array $storeIds
285+
* @return $this
286+
* @see Mage_Reports_Model_Resource_Report_Product_Viewed_Collection
287+
* @see Mage_Sales_Model_Resource_Report_Bestsellers_Collection
288+
*/
289+
public function addStoreRestrictions($storeIds)
290+
{
291+
if (!is_array($storeIds)) {
292+
$storeIds = [$storeIds];
293+
}
294+
$currentStoreIds = $this->_storesIds;
295+
if (isset($currentStoreIds) && $currentStoreIds != Mage_Core_Model_App::ADMIN_STORE_ID
296+
&& $currentStoreIds != [Mage_Core_Model_App::ADMIN_STORE_ID]
297+
) {
298+
if (!is_array($currentStoreIds)) {
299+
$currentStoreIds = [$currentStoreIds];
300+
}
301+
$this->_storesIds = array_intersect($currentStoreIds, $storeIds);
302+
} else {
303+
$this->_storesIds = $storeIds;
304+
}
305+
306+
return $this;
307+
}
264308
}

app/code/core/Mage/Reports/Model/Resource/Report/Product/Viewed/Collection.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -153,46 +153,6 @@ protected function _initSelect()
153153
return $this;
154154
}
155155

156-
/**
157-
* Get SQL for get record count
158-
*
159-
* @return Varien_Db_Select
160-
*/
161-
#[\Override]
162-
public function getSelectCountSql()
163-
{
164-
$this->_renderFilters();
165-
$select = clone $this->getSelect();
166-
$select->reset(Zend_Db_Select::ORDER);
167-
return $this->getConnection()->select()->from($select, 'COUNT(*)');
168-
}
169-
170-
/**
171-
* Set ids for store restrictions
172-
*
173-
* @param array $storeIds
174-
* @return $this
175-
*/
176-
public function addStoreRestrictions($storeIds)
177-
{
178-
if (!is_array($storeIds)) {
179-
$storeIds = [$storeIds];
180-
}
181-
$currentStoreIds = $this->_storesIds;
182-
if (isset($currentStoreIds) && $currentStoreIds != Mage_Core_Model_App::ADMIN_STORE_ID
183-
&& $currentStoreIds != [Mage_Core_Model_App::ADMIN_STORE_ID]
184-
) {
185-
if (!is_array($currentStoreIds)) {
186-
$currentStoreIds = [$currentStoreIds];
187-
}
188-
$this->_storesIds = array_intersect($currentStoreIds, $storeIds);
189-
} else {
190-
$this->_storesIds = $storeIds;
191-
}
192-
193-
return $this;
194-
}
195-
196156
/**
197157
* Redeclare parent method for applying filters after parent method
198158
* but before adding unions and calculating totals

app/code/core/Mage/Sales/Model/Resource/Report/Bestsellers/Collection.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -154,46 +154,6 @@ protected function _initSelect()
154154
return $this;
155155
}
156156

157-
/**
158-
* Get SQL for get record count
159-
*
160-
* @return Varien_Db_Select
161-
*/
162-
#[\Override]
163-
public function getSelectCountSql()
164-
{
165-
$this->_renderFilters();
166-
$select = clone $this->getSelect();
167-
$select->reset(Zend_Db_Select::ORDER);
168-
return $this->getConnection()->select()->from($select, 'COUNT(*)');
169-
}
170-
171-
/**
172-
* Set ids for store restrictions
173-
*
174-
* @param array $storeIds
175-
* @return $this
176-
*/
177-
public function addStoreRestrictions($storeIds)
178-
{
179-
if (!is_array($storeIds)) {
180-
$storeIds = [$storeIds];
181-
}
182-
$currentStoreIds = $this->_storesIds;
183-
if (isset($currentStoreIds) && $currentStoreIds != Mage_Core_Model_App::ADMIN_STORE_ID
184-
&& $currentStoreIds != [Mage_Core_Model_App::ADMIN_STORE_ID]
185-
) {
186-
if (!is_array($currentStoreIds)) {
187-
$currentStoreIds = [$currentStoreIds];
188-
}
189-
$this->_storesIds = array_intersect($currentStoreIds, $storeIds);
190-
} else {
191-
$this->_storesIds = $storeIds;
192-
}
193-
194-
return $this;
195-
}
196-
197157
/**
198158
* Redeclare parent method for applying filters after parent method
199159
* but before adding unions and calculating totals

0 commit comments

Comments
 (0)