ImportDefinitions XML


#1

Hi all,
I’m new to Pimcore and I’m trying to define new xml import with ImportDefinitions plugin.
Settings defined as shown.


XPATH defined as : /PRODUCTINFORMATION/PRODUCTS/PRODUCT
Example Xpath is the same
Example file is: Mid Ocean Brands 20190122 03:00:27 IT <PRODUCT_NUMBER>AR1249-16</PRODUCT_NUMBER> <PRODUCT_BASE_NUMBER>AR1249</PRODUCT_BASE_NUMBER> <PRODUCT_ID>10134325</PRODUCT_ID> <PRODUCT_PRINT_ID>40000011</PRODUCT_PRINT_ID> <PRODUCT_NAME>TARGET</PRODUCT_NAME> COLLECTION <SHORT_DESCRIPTION>Bussola nautica</SHORT_DESCRIPTION> <LONG_DESCRIPTION>Bussola nautica in alluminio in confezione di latta.</LONG_DESCRIPTION> 10,5X8X2 CM <NET_WEIGHT>0,103</NET_WEIGHT> <GROSS_WEIGHT>0,133</GROSS_WEIGHT> <GROSS_WEIGHT_UNIT>KG</GROSS_WEIGHT_UNIT> <COLOR_CODE>16</COLOR_CODE> <COLOR_DESCRIPTION>argento opaco</COLOR_DESCRIPTION> <MATERIAL_TYPE>Metal</MATERIAL_TYPE> <CATEGORY_CODE>MOBL&G_SRVCOP</CATEGORY_CODE> <CATEGORY_LEVEL_1>MIDOCEANBRANDS</CATEGORY_LEVEL_1> <CATEGORY_LEVEL_2>TEMPO LIBERO</CATEGORY_LEVEL_2> <CATEGORY_LEVEL_3>SOPRAVVIVENZA</CATEGORY_LEVEL_3> <CATEGORY_LEVEL_4>BUSSOLA</CATEGORY_LEVEL_4> <IMAGE_URL>http://xxxxxxx.com/image/AR1249_16.jpg</IMAGE_URL> <THUMBNAIL_URL>http://xxxxxxx.com/thumb/th_AR1249_16.jpg</THUMBNAIL_URL> <COMMODITY_CODE>9014 1000</COMMODITY_CODE> <COUNTRY_OF_ORIGIN>CN</COUNTRY_OF_ORIGIN> <PACKAGING_CARTON> 0,560 0,265 0,215 <SIZE_UNIT>M</SIZE_UNIT> 13,347 <WEIGHT_UNIT>KG</WEIGHT_UNIT> 0,032 <VOLUME_UNIT>M3</VOLUME_UNIT> <INNER_CARTON_QUANTITY>10</INNER_CARTON_QUANTITY> <CARTON_QUANTITY>100</CARTON_QUANTITY> </PACKAGING_CARTON>
But no colums shown in Mapping folder and an error is raised at savings.
Timestamp: Sun Jan 27 2019 17:51:47 GMT+0100 (Ora standard dell’Europa centrale) Status: 500 | Internal Server Error URL: /admin/import_definitions/definitions/get-columns Method: GET Message: Call to a member function getData() on null Trace: #0 /pimcore/cipi/vendor/w-vision/import-definitions/src/ImportDefinitionsBundle/Controller/ImportDefinitionController.php(91): ImportDefinitionsBundle\Provider\XmlProvider->getColumns(Array) #1 /pimcore/cipi/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(151): ImportDefinitionsBundle\Controller\ImportDefinitionController->getColumnsAction(Object(Symfony\Component\HttpFoundation\Request)) #2 /pimcore/cipi/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #3 /pimcore/cipi/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(200): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #4 /pimcore/cipi/web/app.php(42): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #5 {main}

Can someone help me?


#2

can you open a issue on github pls?


#3

But it seems that the example file isn’t configured properly


#4

[dpfaffenbauer] opened issue on github can you please help me?
Regards


#5

I already replied. Pls read it and reply to it.


#6

Hi dpfaffenbauer,

corrected xml is ```

Mid Ocean Brands
20190122
03:00:27
IT


<PRODUCT_NUMBER>AR1249-16</PRODUCT_NUMBER>
<PRODUCT_BASE_NUMBER>AR1249</PRODUCT_BASE_NUMBER>
<PRODUCT_ID>10134325</PRODUCT_ID>
<PRODUCT_PRINT_ID>40000011</PRODUCT_PRINT_ID>
<PRODUCT_NAME>TARGET</PRODUCT_NAME>
COLLECTION
<SHORT_DESCRIPTION>Bussola nautica</SHORT_DESCRIPTION>
<LONG_DESCRIPTION>Bussola nautica in alluminio in confezione di latta.</LONG_DESCRIPTION>
10,5X8X2 CM
<NET_WEIGHT>0,103</NET_WEIGHT>
<GROSS_WEIGHT>0,133</GROSS_WEIGHT>
<GROSS_WEIGHT_UNIT>KG</GROSS_WEIGHT_UNIT>
<COLOR_CODE>16</COLOR_CODE>
<COLOR_DESCRIPTION>argento opaco</COLOR_DESCRIPTION>
<MATERIAL_TYPE>Metal</MATERIAL_TYPE>
<CATEGORY_CODE>MOBL&G_SRVCOP</CATEGORY_CODE>
<CATEGORY_LEVEL_1>MIDOCEANBRANDS</CATEGORY_LEVEL_1>
<CATEGORY_LEVEL_2>TEMPO LIBERO</CATEGORY_LEVEL_2>
<CATEGORY_LEVEL_3>SOPRAVVIVENZA</CATEGORY_LEVEL_3>
<CATEGORY_LEVEL_4>BUSSOLA</CATEGORY_LEVEL_4>
<IMAGE_URL>http://xxx.com/image/AR1249_16.jpg</IMAGE_URL>
<THUMBNAIL_URL>http://xxx.com/thumb/th_AR1249_16.jpg</THUMBNAIL_URL>
<COMMODITY_CODE>9014 1000</COMMODITY_CODE>
<COUNTRY_OF_ORIGIN>CN</COUNTRY_OF_ORIGIN>
<PACKAGING_CARTON>
0,560
0,265
0,215
<SIZE_UNIT>M</SIZE_UNIT>
13,347
<WEIGHT_UNIT>KG</WEIGHT_UNIT>
0,032
<VOLUME_UNIT>M3</VOLUME_UNIT>
<INNER_CARTON_QUANTITY>10</INNER_CARTON_QUANTITY>
<CARTON_QUANTITY>100</CARTON_QUANTITY>
</PACKAGING_CARTON>


but the error persists what I’m wrong?

Best Regards


#7

is that all or just one entry?


#8

It’s just one entry of all


#9

First of all: that doesn’t work with Import Definitions. It has to be an array of entries.

Second of all: Put it in manually if its just one :smiley:


#10

Hi Dominik,
Can you please give me an “Array example”? It’s just one for testing all catalog is about 4000 Products :frowning:


#11

To configure the Definition, you need a subset of your XML, so ImportDefinitions knows what to work with. The example is just needed to make the mapping available. It potentially could be the whole catalog file, but that would need a lot of memory, thus it should only be a subset.


#12

Hi dominik,
I knowe that the example must be only a subset of whole catalog file but
the error is raised before inserting xml provider settings.
After entering
Name:
Provider;
loader:
class:
and saving the erorr is shown.
What I’m wrong?


#13

I have no idea what you are doing wrong… Sorry, pls try to debug the issue.


#14

Issue debbuged and found the problem, can You please provide an axample of xpath?


#15

Sorry, but I don’t know what data set you need of your XML. Pls try to search on google how xpath works.


#16

Hi, dominik
thank you for your reply
already done search on google for xpath and tested some xml, but I dont’t understend why in mapping are not shown the values specified in xpath.
For example:
<?xml version=“1.0” encoding=“UTF-8”?>

<bookstore>

<book category=“cooking”>
<title lang=“en”>Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>

<book category=“children”>
<title lang=“en”>Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>

<book category=“web”>
<title lang=“en”>XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>

<book category=“web”>
<title lang=“en”>Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>

</bookstore>

xpath for book’s titles is
/bookstore/book/title

In mapping “from column” I see only “Custom” , 0 but no book titles.
Regards


#17

I would go with xpath: /bookstore/book