4141use Magento \Framework \Filesystem ;
4242use Magento \UrlRewrite \Model \UrlPersistInterface ;
4343use Magento \Catalog \Api \CategoryRepositoryInterface ;
44+ use Magento \Eav \Model \Entity \Attribute \Source \Boolean ;
4445
4546/**
4647 * Entity Adapter for importing Magento Categories
@@ -274,6 +275,8 @@ public function __construct(
274275 $ this ->getErrorAggregator ()->addErrorMessageTemplate ($ errorCode , $ message );
275276 }
276277
278+ $ this ->config = $ config ;
279+
277280 $ this ->initOnTapAttributes ()
278281 ->initWebsites ()
279282 ->initStores ()
@@ -283,7 +286,6 @@ public function __construct(
283286
284287 $ this ->entityTable = $ this ->defaultCategory ->getResource ()->getEntityTable ();
285288 $ this ->categoryImportVersionFeature = $ this ->versionFeatures ->create ('CategoryImportVersion ' );
286- $ this ->config = $ config ;
287289 }
288290
289291 /**
@@ -335,7 +337,13 @@ public function getAttributeOptions(AbstractAttribute $attribute): array
335337
336338 if ($ attribute ->usesSource ()) {
337339 // should attribute has index (option value) instead of a label?
338- $ index = in_array ($ attribute ->getAttributeCode (), $ this ->indexValueAttributes ) ? 'value ' : 'label ' ;
340+ $ index = 'label ' ;
341+ if (
342+ in_array ($ attribute ->getAttributeCode (), $ this ->indexValueAttributes ) ||
343+ $ attribute ->getSourceModel () == Boolean::class
344+ ) {
345+ $ index = 'value ' ;
346+ };
339347
340348 // only default (admin) store values used
341349 /** @var Attribute $attribute */
@@ -954,13 +962,13 @@ private function saveCategories(): self
954962
955963 $ time = !empty ($ rowData [CategoryModel::KEY_CREATED_AT ])
956964 ? strtotime ($ rowData [CategoryModel::KEY_CREATED_AT ])
957- : null ;
965+ : ' now ' ;
958966
959967 // entity table data
960968 $ entityRow = [
961969 CategoryInterface::KEY_PARENT_ID => $ parentCategory ['entity_id ' ],
962970 CategoryInterface::KEY_LEVEL => $ parentCategory [CategoryInterface::KEY_LEVEL ] + 1 ,
963- CategoryInterface::KEY_CREATED_AT => (new DateTime ($ time ))
971+ CategoryInterface::KEY_CREATED_AT => (new \ DateTime ($ time ))
964972 ->format (DateTime::DATETIME_PHP_FORMAT ),
965973 CategoryInterface::KEY_UPDATED_AT => "now() " ,
966974 CategoryInterface::KEY_POSITION => $ rowData [CategoryInterface::KEY_POSITION ]
0 commit comments