2

I'm trying to add an attribute to the categories, but i'm unable to add the attribute to the admin view by adding the ui_component xml document (module/test/view/adminhtml/ui_component/category_form.xml). See the xml document below

<?xml version="1.0" encoding="UTF-8"?>
        <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
            <fieldset name="general">
                <field name="custom_attribute">
                    <argument name="data" xsi:type="array">
                        <item name="config" xsi:type="array">
                            <item name="sortOrder" xsi:type="number">50</item>
                            <item name="dataType" xsi:type="string">varchar</item>
                            <item name="formElement" xsi:type="string">input</item>
                            <item name="label" xsi:type="string" translate="true">Custom field</item>
                            <item name="default" xsi:type="number">0</item>
                        </item>
                    </argument>
                </field>
            </fieldset>
        </form>

I'm getting the folling code (in short) 1 exception(s):

Exception #0 (Exception): Warning: DOMDocument::loadXML():

Input is not proper UTF-8, indicate encoding !

What am I doing wrong?

  • <?xml version="1.0" encoding="UTF-8"?> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> Your Data </form> Standard Format – Ankit Shah Oct 31 '16 at 2:30
  • Explain to me, why you send me the standard format. Didn't I use the standard format? – Anton Oct 31 '16 at 17:56
  • Do you use Developer Mode? – KAndy Nov 1 '16 at 7:28
  • Yes I use developer Mode – Anton Nov 3 '16 at 19:48
1

You need to change

<item name="dataType" xsi:type="string">varchar</item>

to

<item name="dataType" xsi:type="string">text</item>
  • I already tried changing the datatype. No luck! – Anton Oct 31 '16 at 17:46
1

Fixed it myself. Just cleared all my caches and setup di compile and deployed the static content. After that there was no more xml exception!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.