XML Importer / TYPO3 / attributes and categories won't update and throwing errors

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
kai_lf
Posts: 7
Joined: 26 Mar 2021, 21:47

XML Importer / TYPO3 / attributes and categories won't update and throwing errors

Post by kai_lf » 10 Mar 2023, 08:54

I am in the process of implementing the XML importer for categories, products and attributes in our shop. Initially, all three XML work really well. Only when I want to import the attributes or the categories a second time I get error messages "... Integrity constraint violation: 1062 Duplicate entry ...".
With the products it works fine. If I delete the categories or attributes in the shop and import them, everything is fine.
Is it possible that an update of the categories and attributes does not work - or what am I doing wrong? Is there anything else I can configure?
I am using aimeos V22.10.5 / TYPO3 11.5.24

User avatar
aimeos
Administrator
Posts: 7858
Joined: 01 Jan 1970, 00:00

Re: XML Importer / TYPO3 / attributes and categories won't update and throwing errors

Post by aimeos » 13 Mar 2023, 16:23

The "ref" attribute in the XML nodes must contain the unique key that is required match existing records, e.g.:

Code: Select all

<attributeitem ref="product|color|black"
It contains record domain, type and value for attributes.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

kai_lf
Posts: 7
Joined: 26 Mar 2021, 21:47

Re: XML Importer / TYPO3 / attributes and categories won't update and throwing errors

Post by kai_lf » 14 Mar 2023, 12:31

Yess. Thanx! I had some UTF8 encoding Problems. For all having similar problems...
If you are using PHP and simpleXML -> initialize your XML like:

Code: Select all

$this->productsxml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><attributes/>');
Output:

Code: Select all

<attributeitem ref="product|Größe|M">
    <attribute.domain><![CDATA[product]]></attribute.domain>
    <attribute.type><![CDATA[Größe]]></attribute.type>
    <attribute.code><![CDATA[M]]></attribute.code>
    <attribute.label><![CDATA[Größe-M]]></attribute.label>
  </attributeitem>
I had:

Code: Select all

$this->productsxml = new SimpleXMLElement('<attributes/>');
Output:

Code: Select all

 <attributeitem ref="product|Gr&#xF6;&#xDF;e|M">
    <attribute.domain><![CDATA[product]]></attribute.domain>
    <attribute.type><![CDATA[Größe]]></attribute.type>
    <attribute.code><![CDATA[M]]></attribute.code>
    <attribute.label><![CDATA[Größe-M]]></attribute.label>
  </attributeitem>
which generates a valid XML, but was not importable to aimeos, because of "Gr&#xF6;&#xDF;e" = Größe.

Post Reply