Product Personalization Tutorial - Working with XML

Product Personalization Tutorial – Working with XML

3. Form Options / Working with xml

Following Magento standards for developers, we’ve enabled you to create / customize the personalization form fields using the Magento’s standard xml configuration documents. If you are experienced with editing Magento’s layout or config files, you will most likely recognize the format right away, and won’t have any issues creating your configuration form. If not, that’s not a problem at all. Just go through this section of the tutorial and as it explains everything there is to know about creating the personalization form.

The form configuration file can be found in: /your magento root folder/app/code/community/SMDesign/ProductPersonalization/etc/ folder, and it’s the file named : product_personalization.xml

Please locate the product_personalization.xml file, and open it in your favorite editor. The start of the file should look a bit like this (this is the much shorter version of the config ) :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0"?>
  <personalization>
    <groups>
      <general>
        <label>Addiconal information</label>
        <frontend_type>text</frontend_type>
        <sort_order>10</sort_order>
        <fields>
          <personal_information>
          <label>Personal Information </label>
          <frontend_type>textarea</frontend_type>
          <required>true</required>
          </personal_information>
        </fields>
      </general>
    </groups>
  </personalization>
</config>

 

The important node is the node , as this is where you need to enter/configure the form field elements that you want to have on your personalization form. On the example code above, there’s only one form element defined, and it’s the textarea element named personal_information and labeled Personal information. As an example, here’s how the personalization form with the config above would look like on the product details page :

05-personalization-form-with-textarea-field-example

And here’s the config code for that element in the form:

1
2
3
4
5
<personal_information>
  <label>Personal Information </label>
  <frontend_type>textarea</frontend_type>
  <required>true</required>
</personal_information>

 

By changing the values in the code, you can change the label, and the type of the element in the form, as well as reordering elements and setting the “required option” on certain elements.

Share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInPin on Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *