BlackbitDigitalCommerce / pimcore-data-director

Import Bundle for Pimcore
16 stars 3 forks source link

Strange ALERT during create tree structure #151

Open betterapp opened 6 months ago

betterapp commented 6 months ago

We have such product structure image

When I try to import product under size level in some cases I got alert and object are not created:

As You can see object exist but we got info: [INFO] No object found for "Product:path:/Product catalog/1100 - Snake/TORE/11003 - Tech/Ø5x8cm; Socket: E27; Power: 4 W; Luminous flux: 320 lm" and then strange array:

[INFO] Value for key field "path": Product:path:/Product catalog/1100 - Snake/TORE/11003 - Tech/Ø5x8cm; Socket: E27; Power: 4 W; Luminous flux: 320 lm -> {
    " E27": "",
    " Power: 4 W": "",
    " Luminous flux: 320 lm": ""
}

and then [ALERT] Unable to process item: TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given in

[INFO] --- Importing next raw data item [INFO] No object found for "Product:path:/Product catalog/1100 - Snake/TORE/11003 - Tech/Ø5x8cm; Socket: E27; Power: 4 W; Luminous flux: 320 lm" [INFO] Value for key field "path": Product:path:/Product catalog/1100 - Snake/TORE/11003 - Tech/Ø5x8cm; Socket: E27; Power: 4 W; Luminous flux: 320 lm -> { " E27": "", " Power: 4 W": "", " Luminous flux: 320 lm": "" } [INFO] Value for key field "key": 101993 - TORE Bulb 4W E27 LED 320 lumen, White/si [INFO] Value for key field "SKU": 101993 [ALERT] Unable to process item: TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given in /var/www/pimcore.dev/www/vendor/blackbit/data-director/lib/Pim/Item/Importer.php:6965 Stack trace:

0 /var/www/pimcore.dev/www/vendor/blackbit/data-director/lib/Pim/Item/Importer.php(6965): strpos()

1 /var/www/pimcore.dev/www/vendor/blackbit/data-director/lib/Pim/Item/Importer.php(553): Blackbit\DataDirectorBundle\lib\Pim\Item\Importer->getKeyConditions()

2 /var/www/pimcore.dev/www/vendor/blackbit/data-director/lib/Pim/Item/Importmanager.php(932): Blackbit\DataDirectorBundle\lib\Pim\Item\Importer->import()

3 /var/www/pimcore.dev/www/vendor/blackbit/data-director/lib/Pim/Item/Importmanager.php(640): Blackbit\DataDirectorBundle\lib\Pim\Item\Importmanager->processChunk()

4 /var/www/pimcore.dev/www/vendor/blackbit/data-director/Command/ImportPimCommand.php(309): Blackbit\DataDirectorBundle\lib\Pim\Item\Importmanager->importDataport()

5 /var/www/pimcore.dev/www/vendor/blackbit/data-director/Command/ImportPimCommand.php(202): Blackbit\DataDirectorBundle\Command\ImportPimCommand::import()

6 /var/www/pimcore.dev/www/vendor/symfony/console/Command/Command.php(326): Blackbit\DataDirectorBundle\Command\ImportPimCommand->execute()

7 /var/www/pimcore.dev/www/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()

8 /var/www/pimcore.dev/www/vendor/symfony/framework-bundle/Console/Application.php(126): Symfony\Component\Console\Application->doRunCommand()

9 /var/www/pimcore.dev/www/vendor/symfony/console/Application.php(324): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand()

10 /var/www/pimcore.dev/www/vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun()

11 /var/www/pimcore.dev/www/vendor/symfony/console/Application.php(175): Symfony\Bundle\FrameworkBundle\Console\Application->doRun()

12 /var/www/pimcore.dev/www/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(49): Symfony\Component\Console\Application->run()

13 /var/www/pimcore.dev/www/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()

14 /var/www/pimcore.dev/www/bin/console(20): require_once('...')

betterapp commented 6 months ago

@BlackbitDevs ?

betterapp commented 6 months ago

I tried to replace " ; " for " + "

And now I see sometyhing like: [INFO] Value for field path: Product:path:/Product catalog/1100 - Snake/TORE/11003 - Tech/Ø5x8cm+ Socket: E27+ Power: 4 W+ Luminous flux: 320 lm [DEBUG] Trying to find target object(s) of class \Pimcore\Model\DataObject\Product with condition ((path = ? AND key = ?)) and variables [ "/Product catalog/1100 - Snake/TORE/11003 - Tech/", "Ø5x8cm+ Socket" ]

why key use only "Ø5x8cm+ Socket" part of the whole string ?

betterapp commented 6 months ago

When I remove ' : ' it is working.

Looks like colon and semicolon can not be used in path name is it DD issue or it working like this ?

BlackbitDevs commented 5 months ago

Sorry for late response. You are right, the additional colons in Ø5x8cm+ Socket: E27+ Power: 4 W+ Luminous flux: 320 lm are the problem. For this reason, you can encapsulate the filter value with " (like in CSV): Please try to return Product:path:"/Product catalog/1100 - Snake/TORE/11003 - Tech/Ø5x8cm; Socket: E27; Power: 4 W; Luminous flux: 320 lm" in your callback function for Path.