Skip to content

Commit 1be8ffc

Browse files
Merge branch 'MAGNIMEX-156-Fix-Updated-At' into 'master'
Magnimex 156 fix updated at See merge request !151
2 parents 043d57a + 94b07e0 commit 1be8ffc

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product
3737
*/
3838
protected $_entityTypeCode;
3939

40+
/**
41+
* @var
42+
*/
43+
protected $_resource;
44+
4045
/**
4146
* @var int
4247
*/
@@ -122,6 +127,7 @@ public function __construct(
122127
) {
123128
$this->_storeResolver = $storeResolver;
124129
$this->_groupRepository = $groupRepository;
130+
$this->_resource = $resource;
125131
parent::__construct(
126132
$localeDate,
127133
$config,
@@ -362,24 +368,39 @@ protected function getTierAndGroupPrices(array $listSku, $table)
362368
}
363369
}
364370
if ($listSku) {
371+
if (isset($exportFilter) && !empty($exportFilter)) {
372+
$date = $exportFilter[\Magento\Catalog\Model\Category::KEY_UPDATED_AT];
373+
if (isset($date[0]) && !empty($date[0])) {
374+
$updatedAtFrom = date('Y-m-d H:i:s', strtotime($date[0]));
375+
}
376+
if (isset($date[1]) && !empty($date[1])) {
377+
$updatedAtTo = date('Y-m-d H:i:s', strtotime($date[1]));
378+
}
379+
}
365380
try {
366381
$select = $this->_connection->select()
367382
->from(
368-
['cpe' => $this->_connection->getTableName('catalog_product_entity')],
383+
['cpe' => $this->_resource->getTableName('catalog_product_entity')],
369384
$selectFields
370385
)
371386
->joinInner(
372-
['ap' => $this->_connection->getTableName($table)],
387+
['ap' => $this->_resource->getTableName($table)],
373388
'ap.entity_id = cpe.entity_id',
374389
[]
375390
)
376391
->where('cpe.entity_id IN (?)', $listSku);
377392

378393
if (isset($price[0]) && !empty($price[0])) {
379-
$select->where('ap.value>=?', $price[0]);
394+
$select->where('ap.value >= ?', $price[0]);
380395
}
381396
if (isset($price[1]) && !empty($price[1])) {
382-
$select->where('ap.value<=?', $price[1]);
397+
$select->where('ap.value <= ?', $price[1]);
398+
}
399+
if (isset($updatedAtFrom) && !empty($updatedAtFrom)) {
400+
$select->where('cpe.updated_at >= ?', $updatedAtFrom);
401+
}
402+
if (isset($updatedAtTo) && !empty($updatedAtTo)) {
403+
$select->where('cpe.updated_at <= ?', $updatedAtTo);
383404
}
384405
$exportData = $this->_connection->fetchAll($select);
385406
} catch (\Exception $e) {

0 commit comments

Comments
 (0)