File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed
CatalogImportExport/Model/Export Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -1548,7 +1548,9 @@ public function filterAttributeCollection(\Magento\Eav\Model\ResourceModel\Entit
1548
1548
{
1549
1549
$ validTypes = array_keys ($ this ->_productTypeModels );
1550
1550
$ validTypes = array_combine ($ validTypes , $ validTypes );
1551
- $ collection ->addFieldToFilter ('attribute_code ' , ['nin ' => $ this ->_bannedAttributes ]);
1551
+ if (!empty ($ this ->_bannedAttributes )) {
1552
+ $ collection ->addFieldToFilter ('attribute_code ' , ['nin ' => $ this ->_bannedAttributes ]);
1553
+ }
1552
1554
foreach (parent ::filterAttributeCollection ($ collection ) as $ attribute ) {
1553
1555
$ attrApplyTo = $ attribute ->getApplyTo ();
1554
1556
$ attrApplyTo = array_combine ($ attrApplyTo , $ attrApplyTo );
Original file line number Diff line number Diff line change @@ -429,4 +429,15 @@ public function prepareCollection(\Magento\Framework\Data\Collection $collection
429
429
$ this ->setCollection ($ collection );
430
430
return $ this ->getCollection ();
431
431
}
432
+
433
+ protected function _prepareCollection ()
434
+ {
435
+ if ($ this ->getCollection ()) {
436
+ if ($ this ->getCollection ()->isLoaded ()) {
437
+ $ this ->getCollection ()->clear ();
438
+ }
439
+ }
440
+
441
+ return parent ::_prepareCollection ();
442
+ }
432
443
}
Original file line number Diff line number Diff line change @@ -378,11 +378,8 @@ public function getAttributeCollection()
378
378
*/
379
379
public function filterAttributeCollection (\Magento \Framework \Data \Collection $ collection )
380
380
{
381
- /** @var $attribute \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */
382
- foreach ($ collection as $ attribute ) {
383
- if (in_array ($ attribute ->getAttributeCode (), $ this ->_disabledAttributes )) {
384
- $ collection ->removeItemByKey ($ attribute ->getId ());
385
- }
381
+ if (!empty ($ this ->_disabledAttributes )) {
382
+ $ collection ->addFieldToFilter ('attribute_code ' , ['nin ' => $ this ->_disabledAttributes ]);
386
383
}
387
384
388
385
return $ collection ;
Original file line number Diff line number Diff line change @@ -389,7 +389,10 @@ abstract public function export();
389
389
*/
390
390
public function filterAttributeCollection (\Magento \Eav \Model \ResourceModel \Entity \Attribute \Collection $ collection )
391
391
{
392
- return $ collection ->addFieldToFilter ('attribute_code ' , ['nin ' => $ this ->_disabledAttrs ]);
392
+ if (!empty ($ this ->_disabledAttrs )) {
393
+ $ collection ->addFieldToFilter ('attribute_code ' , ['nin ' => $ this ->_disabledAttrs ]);
394
+ }
395
+ return $ collection ;
393
396
}
394
397
395
398
/**
You can’t perform that action at this time.
0 commit comments