@@ -127,6 +127,13 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
127
127
*/
128
128
protected $ _attributeTypes = [];
129
129
130
+ /**
131
+ * Attributes defined by user
132
+ *
133
+ * @var array
134
+ */
135
+ protected $ userDefinedAttributes = [];
136
+
130
137
/**
131
138
* Product collection
132
139
*
@@ -261,7 +268,11 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
261
268
*/
262
269
protected $ dateAttrCodes = [
263
270
'special_from_date ' ,
264
- 'special_to_date '
271
+ 'special_to_date ' ,
272
+ 'news_from_date ' ,
273
+ 'news_to_date ' ,
274
+ 'custom_design_from ' ,
275
+ 'custom_design_to '
265
276
];
266
277
267
278
/**
@@ -910,20 +921,25 @@ protected function collectRawData()
910
921
}
911
922
$ fieldName = isset ($ this ->_fieldsMap [$ code ]) ? $ this ->_fieldsMap [$ code ] : $ code ;
912
923
913
- if (in_array ($ code , $ this ->dateAttrCodes )) {
914
- $ attrValue = $ this ->_localeDate ->formatDateTime (
915
- new \DateTime ($ attrValue ),
916
- \IntlDateFormatter::SHORT ,
917
- \IntlDateFormatter::NONE ,
918
- null ,
919
- date_default_timezone_get ()
920
- );
921
- } else if ($ this ->_attributeTypes [$ code ] === 'datetime ' ) {
922
- $ attrValue = $ this ->_localeDate ->formatDateTime (
923
- new \DateTime ($ attrValue ),
924
- \IntlDateFormatter::SHORT ,
925
- \IntlDateFormatter::SHORT
926
- );
924
+ if ($ this ->_attributeTypes [$ code ] === 'datetime ' ) {
925
+ if (
926
+ in_array ($ code , $ this ->dateAttrCodes )
927
+ || in_array ($ code , $ this ->userDefinedAttributes )
928
+ ) {
929
+ $ attrValue = $ this ->_localeDate ->formatDateTime (
930
+ new \DateTime ($ attrValue ),
931
+ \IntlDateFormatter::SHORT ,
932
+ \IntlDateFormatter::NONE ,
933
+ null ,
934
+ date_default_timezone_get ()
935
+ );
936
+ } else {
937
+ $ attrValue = $ this ->_localeDate ->formatDateTime (
938
+ new \DateTime ($ attrValue ),
939
+ \IntlDateFormatter::SHORT ,
940
+ \IntlDateFormatter::SHORT
941
+ );
942
+ }
927
943
}
928
944
929
945
if ($ storeId != Store::DEFAULT_STORE_ID
@@ -1380,6 +1396,9 @@ protected function initAttributes()
1380
1396
$ this ->_attributeValues [$ attribute ->getAttributeCode ()] = $ this ->getAttributeOptions ($ attribute );
1381
1397
$ this ->_attributeTypes [$ attribute ->getAttributeCode ()] =
1382
1398
\Magento \ImportExport \Model \Import::getAttributeType ($ attribute );
1399
+ if ($ attribute ->getIsUserDefined ()) {
1400
+ $ this ->userDefinedAttributes [] = $ attribute ->getAttributeCode ();
1401
+ }
1383
1402
}
1384
1403
return $ this ;
1385
1404
}
0 commit comments