@@ -153,14 +153,15 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
153
153
/**
154
154
* Items per page for collection limitation
155
155
*
156
- * @var null
156
+ * @var int| null
157
157
*/
158
158
protected $ _itemsPerPage = null ;
159
159
160
160
/**
161
161
* Header columns for export file
162
162
*
163
163
* @var array
164
+ * @deprecated
164
165
*/
165
166
protected $ _headerColumns = [];
166
167
@@ -234,17 +235,15 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
234
235
protected $ _fieldsMap = [
235
236
'image ' => 'base_image ' ,
236
237
'image_label ' => "base_image_label " ,
237
- 'image ' => 'base_image ' ,
238
- 'image_label ' => 'base_image_label ' ,
239
238
'thumbnail ' => 'thumbnail_image ' ,
240
239
'thumbnail_label ' => 'thumbnail_image_label ' ,
241
240
self ::COL_MEDIA_IMAGE => 'additional_images ' ,
242
241
'_media_image_label ' => 'additional_image_labels ' ,
243
- Product ::COL_STORE => 'store_view_code ' ,
244
- Product ::COL_ATTR_SET => 'attribute_set_code ' ,
245
- Product ::COL_TYPE => 'product_type ' ,
246
- Product ::COL_CATEGORY => 'categories ' ,
247
- Product ::COL_PRODUCT_WEBSITES => 'product_websites ' ,
242
+ self ::COL_STORE => 'store_view_code ' ,
243
+ self ::COL_ATTR_SET => 'attribute_set_code ' ,
244
+ self ::COL_TYPE => 'product_type ' ,
245
+ self ::COL_CATEGORY => 'categories ' ,
246
+ self ::COL_PRODUCT_WEBSITES => 'product_websites ' ,
248
247
'status ' => 'product_online ' ,
249
248
'news_from_date ' => 'new_from_date ' ,
250
249
'news_to_date ' => 'new_to_date ' ,
@@ -691,7 +690,7 @@ protected function updateDataWithCategoryColumns(&$dataRow, &$rowCategories, $pr
691
690
*/
692
691
public function _getHeaderColumns ()
693
692
{
694
- return $ this ->_customHeadersMapping ($ this ->_headerColumns );
693
+ return $ this ->_customHeadersMapping ($ this ->rowCustomizer -> addHeaderColumns ( $ this -> _headerColumns ) );
695
694
}
696
695
697
696
/**
@@ -700,13 +699,13 @@ public function _getHeaderColumns()
700
699
* @param array $customOptionsData
701
700
* @param array $stockItemRows
702
701
* @return void
702
+ * @deprecated Logic will be moved to _getHeaderColumns in future release
703
+ *
704
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
703
705
*/
704
706
protected function setHeaderColumns ($ customOptionsData , $ stockItemRows )
705
707
{
706
708
if (!$ this ->_headerColumns ) {
707
- $ customOptCols = [
708
- 'custom_options ' ,
709
- ];
710
709
$ this ->_headerColumns = array_merge (
711
710
[
712
711
self ::COL_SKU ,
@@ -719,21 +718,19 @@ protected function setHeaderColumns($customOptionsData, $stockItemRows)
719
718
$ this ->_getExportMainAttrCodes (),
720
719
[self ::COL_ADDITIONAL_ATTRIBUTES ],
721
720
reset ($ stockItemRows ) ? array_keys (end ($ stockItemRows )) : [],
722
- [],
723
721
[
724
722
'related_skus ' ,
725
723
'related_position ' ,
726
724
'crosssell_skus ' ,
727
725
'crosssell_position ' ,
728
726
'upsell_skus ' ,
729
- 'upsell_position '
730
- ],
731
- ['additional_images ' , 'additional_image_labels ' , 'hide_from_product_page ' ]
727
+ 'upsell_position ' ,
728
+ 'additional_images ' ,
729
+ 'additional_image_labels ' ,
730
+ 'hide_from_product_page ' ,
731
+ 'custom_options '
732
+ ]
732
733
);
733
- // have we merge custom options columns
734
- if ($ customOptionsData ) {
735
- $ this ->_headerColumns = array_merge ($ this ->_headerColumns , $ customOptCols );
736
- }
737
734
}
738
735
}
739
736
@@ -892,10 +889,12 @@ protected function getExportData()
892
889
$ productIds = array_keys ($ rawData );
893
890
$ stockItemRows = $ this ->prepareCatalogInventory ($ productIds );
894
891
895
- $ this ->rowCustomizer ->prepareData ($ this ->_getEntityCollection (), $ productIds );
892
+ $ this ->rowCustomizer ->prepareData (
893
+ $ this ->_prepareEntityCollection ($ this ->_entityCollectionFactory ->create ()),
894
+ $ productIds
895
+ );
896
896
897
897
$ this ->setHeaderColumns ($ multirawData ['customOptionsData ' ], $ stockItemRows );
898
- $ this ->_headerColumns = $ this ->rowCustomizer ->addHeaderColumns ($ this ->_headerColumns );
899
898
900
899
foreach ($ rawData as $ productId => $ productData ) {
901
900
foreach ($ productData as $ storeId => $ dataRow ) {
@@ -1231,9 +1230,6 @@ private function appendMultirowData(&$dataRow, &$multiRawData)
1231
1230
return null ;
1232
1231
} elseif ($ storeId != Store::DEFAULT_STORE_ID ) {
1233
1232
$ dataRow [self ::COL_STORE ] = $ this ->_storeIdToCode [$ storeId ];
1234
- if (isset ($ productData [Store::DEFAULT_STORE_ID ][self ::COL_VISIBILITY ])) {
1235
- $ dataRow [self ::COL_VISIBILITY ] = $ productData [Store::DEFAULT_STORE_ID ][self ::COL_VISIBILITY ];
1236
- }
1237
1233
}
1238
1234
$ dataRow [self ::COL_SKU ] = $ sku ;
1239
1235
return $ dataRow ;
0 commit comments