@@ -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 ,
@@ -364,37 +370,37 @@ protected function getTierAndGroupPrices(array $listSku, $table)
364
370
if ($ listSku ) {
365
371
if (isset ($ exportFilter ) && !empty ($ exportFilter )) {
366
372
$ date = $ exportFilter [\Magento \Catalog \Model \Category::KEY_UPDATED_AT ];
367
- if ($ date [0 ]) {
368
- $ updatedAtFrom = date ( 'Y-m-d H:i:s ' , strtotime ($ date [0 ]));
373
+ if (isset ( $ date [0 ]) && ! empty ( $ date [ 0 ]) ) {
374
+ $ updatedAtFrom = date ('Y-m-d H:i:s ' , strtotime ($ date [0 ]));
369
375
}
370
- if ($ date [1 ]) {
371
- $ updatedAtTo = date ( 'Y-m-d H:i:s ' , strtotime ($ date [1 ]));
376
+ if (isset ( $ date [1 ]) && ! empty ( $ date [ 1 ]) ) {
377
+ $ updatedAtTo = date ('Y-m-d H:i:s ' , strtotime ($ date [1 ]));
372
378
}
373
379
}
374
380
try {
375
381
$ select = $ this ->_connection ->select ()
376
382
->from (
377
- ['cpe ' => $ this ->_connection ->getTableName ('catalog_product_entity ' )],
383
+ ['cpe ' => $ this ->_resource ->getTableName ('catalog_product_entity ' )],
378
384
$ selectFields
379
385
)
380
386
->joinInner (
381
- ['ap ' => $ this ->_connection ->getTableName ($ table )],
387
+ ['ap ' => $ this ->_resource ->getTableName ($ table )],
382
388
'ap.entity_id = cpe.entity_id ' ,
383
389
[]
384
390
)
385
391
->where ('cpe.entity_id IN (?) ' , $ listSku );
386
392
387
393
if (isset ($ price [0 ]) && !empty ($ price [0 ])) {
388
- $ select ->where ('ap.value >=? ' , $ price [0 ]);
394
+ $ select ->where ('ap.value >= ? ' , $ price [0 ]);
389
395
}
390
396
if (isset ($ price [1 ]) && !empty ($ price [1 ])) {
391
- $ select ->where ('ap.value <=? ' , $ price [1 ]);
397
+ $ select ->where ('ap.value <= ? ' , $ price [1 ]);
392
398
}
393
399
if (isset ($ updatedAtFrom ) && !empty ($ updatedAtFrom )) {
394
400
$ select ->where ('cpe.updated_at >= ? ' , $ updatedAtFrom );
395
401
}
396
402
if (isset ($ updatedAtTo ) && !empty ($ updatedAtTo )) {
397
- $ select ->where ('cpe.updated_at <=? ' , $ updatedAtTo );
403
+ $ select ->where ('cpe.updated_at <= ? ' , $ updatedAtTo );
398
404
}
399
405
$ exportData = $ this ->_connection ->fetchAll ($ select );
400
406
} catch (\Exception $ e ) {
0 commit comments