@@ -37,6 +37,11 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product
37
37
*/
38
38
protected $ _entityTypeCode ;
39
39
40
+ /**
41
+ * @var
42
+ */
43
+ protected $ _resource ;
44
+
40
45
/**
41
46
* @var int
42
47
*/
@@ -122,6 +127,7 @@ public function __construct(
122
127
) {
123
128
$ this ->_storeResolver = $ storeResolver ;
124
129
$ this ->_groupRepository = $ groupRepository ;
130
+ $ this ->_resource = $ resource ;
125
131
parent ::__construct (
126
132
$ localeDate ,
127
133
$ config ,
@@ -362,24 +368,39 @@ protected function getTierAndGroupPrices(array $listSku, $table)
362
368
}
363
369
}
364
370
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
+ }
365
380
try {
366
381
$ select = $ this ->_connection ->select ()
367
382
->from (
368
- ['cpe ' => $ this ->_connection ->getTableName ('catalog_product_entity ' )],
383
+ ['cpe ' => $ this ->_resource ->getTableName ('catalog_product_entity ' )],
369
384
$ selectFields
370
385
)
371
386
->joinInner (
372
- ['ap ' => $ this ->_connection ->getTableName ($ table )],
387
+ ['ap ' => $ this ->_resource ->getTableName ($ table )],
373
388
'ap.entity_id = cpe.entity_id ' ,
374
389
[]
375
390
)
376
391
->where ('cpe.entity_id IN (?) ' , $ listSku );
377
392
378
393
if (isset ($ price [0 ]) && !empty ($ price [0 ])) {
379
- $ select ->where ('ap.value>= ? ' , $ price [0 ]);
394
+ $ select ->where ('ap.value >= ? ' , $ price [0 ]);
380
395
}
381
396
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 );
383
404
}
384
405
$ exportData = $ this ->_connection ->fetchAll ($ select );
385
406
} catch (\Exception $ e ) {
0 commit comments