Content

Article Import for F2C

The component can import articles into Form2Content component from an XML or CSV.

Download

Insert your email address. Download link will be sent to this email address.

component
joomla 2.5joomla 3.2

Article Import for F2C is a component for Joomla 2.5+ and 3+. It can import articles into Form2Content component which is one of the most favorite CCK's (Content Construction Kit) for Joomla!. It can save you dozens of hours of time transferring articles manually.

The component can import any information into predefined content fields. You can also make use of an advanced feature for clasifying articles into different categories according to any information from the XML.

Supported formats are XML and CSV. Although the component can import only from an XML file, it will automatically convert CSV file into XML during an upload of the CSV file.

Key features

  • Cron support
  • Source files can be XML or CSV
  • EN and CZ languages, more can be added
  • Multiple XML templates can be created and used
  • Great for Joomla! 1.5 to 3.x migration and all other combinations

Caution

This component is not a universal solution for every XML structure. We recommend to contact us for confirmation that this component is suitable for your needs. We will gladly help you to set it up before the purchase. It is possible to export the setting you make and use it again after the purchase. Also, you can try it in our demo.

Version Version created Version description
1.1.2 2014-10-29 12:57:18 Hyperlink and Email field attributes. Better CSV to XML conversion.
1.1.1 2014-10-22 07:57:41 Added option to delete unvalid articles. Message about amount of imported / updated articles appears after import, asset … Progress view will load faster - it's not loading whole XML anymore
1.1.0 2014-08-12 15:26:49 Added option for automatic article refresh.
1.0.5 2014-05-29 12:22:28 Unused code deleted
1.0.4 2014-03-20 10:27:55 fixed URL spaces problem, added email and link field support, typo bug fixed, when conditions not filled, do not use them fix
1.0.3 2013-10-14 14:24:50 Joomla 3 ready
1.0.2 2013-07-10 08:55:35
1.0.1 2013-07-08 06:54:28

XML Import – Component Overview

List of XML Templates

After installing the XML Import Component, you will see the list of predefined XML templates. Just go to Components > XML Import. To create a new XML template, just click the "New" icon in the upper right corner. To edit an existing XML template, click on it's title.

Article-Import-for-Form2content-List.png

Creating a New XML Template

After clicking the "New" icon, you will see a form where you define the new template. You have to fill in: Title, URL of XML and Language. The XML URL must be provided by an existing website from where you want to transfer the articles. You can also upload an XML file. If you want to upload a CSV file, the XML Import Component will first convert it to an XML file and then further work with it. You have to set the language every time as Joomla! creates individual tables for every language. Once everything is set, click the "Save" icon.

Article-Import-for-Form2content-New.png

XML Template Settings

After saving the XML URL, other parameters will show up. In the XML Preview tab on the left, you will see the XML tag overview. You can copy/paste the tags into the Form2content tab on the right and thus map your XML to the Joomla/Form2Content database. In the picture on the left, you can see a ready XML template. Once your tags are mapped, just set how many articles you want to import by setting the "Start On" and "End On" fields in the "General Settings" on the left and then click the "Save and Parse" icon in the upper right corner.

Debug Log

The XML Import Component logs almost all operations. If there is an error or something is not parsed correctly, you can find in the "Debug Log". The "Debug Log" can be configured to show "Errors only" or "Nothing". It helps parse the product quicker and saves your database capacity if your import is debugged.

CSV Settings

The XML Import Component can operate with XML files only but it can process a CSV file as well. It converts the CSV file to an XML automatically so it can parse it. You can do a CSV export in all common spreadsheet applications such as Microsoft Excel or Open Office Calc. Therefore, you can edit your articles in, say, Microsoft Excel and then import them into Form2Content.

Easy-Parser-Edit-csv.png

Automated Jobs (CRON)

The XML can be updated by automated CRON jobs. CRON is a server feature where you enter the URL which you want to update and set the time, e.g. every day at 3pm. You can set your custom URL by adding a Secret (a custom alfa-numeric code) to prevent attacks. In the template settings you can define whether the XML should be updated from the given public address.

Easy-Parser-cron.png

General Settings

Every XML template must have a title. It is recommended to set the title according to the type of imported items or source > simply to know what you are importing in the future (in case of multiple templates).

Article-Import-for-Form2content-general-settings.png

As mentioned before, you can upload an XML or CSV file or set a public URL. When uploading a file from your computer, the URL is defined automatically.

Then you have to set the start item and end item by filling in the "Start On" and "End On" fields. This is useful when testing an upload of one item. It is also possible that the parsing process will take longer and will exceed the server's maximum execution time. In this case, you can divide the XML into two parts by parsing the first half and then the second half separately.

It is also possible to hide old items by setting the "Hide older than [h]" option. The value is entered in hours. After parsing, the time of the last modification is changed at each item and a script un-publishes all items that are older than the value you entered. This way, you can exclude old items from the import.

Select the Language option just in case of a multilingual website.

The last option in the General Settings is setting an XML URL updated by CRON jobs.

Easy-Parser-XML-preview.png

The XML Import Component will create a simple XML Overview where you can see the structure and which XML tags are used including their count. In the picture on the left you can see that there are 4 097 products / articles in the XML.

Using this overview, you can copy / paste the tags into particular fields in the Product tab on the right. Be aware that this is just an overview and check the tags with your XML file.

Setting of Form2Content content type

Some options that are may not be clear are described in this section.

Delete all articles...

Clicking this link will delete all articles from categories specified below this link. Insert category IDs, save the XML template and then delete all articles inside these categories. This option is used for faster setup of XML template. Not for production. Backup database before clicking this link.

XML object

XML object is the XML tag inside which the artcle information is stored. If you look at the example of XML preview, XML object is "product" XML tag.

F2C Content Type

You need to have content type defined at F2C component first. Then you'll see it at this list and you can select it.

Identificator

Every article must have its own identificator. It must be a unique piece of information. AIF2C will decide during the second import whether to insert a new article (Identificator not found in the database) or update the existing one.

ID is

This select list option is connected with the Identificator. At identificator you select the name of the XML tag which stores the ID information. At the ID is Select list, you specify what the information is in the database. You can use Article title or any other field of content type. If you don't see any fields of content type, make sure you've selected one and saved the XML template.

Identificator in alias

Sometimes you can insert identificator into the alias e.g. if you have more articles with the same name.

Category selection

At this text area field you can specify JSON definition of conditions how you want to sort articles to different categories. If you want to import only into one category, skip this and select it below. If you need help with this feature, contact us and we will gladly help you.

Example of JSON conditions:

Article-Import-for-Form2content-f2c-settings.png

[
    {
        "conditions":[
            {
                "name":"nemovitost_typ",
                "comparator":"==",
                "values":["Domy a vily"]
            }
        ],
        "categories":["11"]
    },{
        "conditions":[
            {
                "name":"nemovitost_typ",
                "comparator":"==",
                "values":["Byty"]
            }
        ],
        "categories":["10"]
    },{
        "conditions":[
            {
                "name":"nemovitost_typ",
                "comparator":"==",
                "values":["Pozemky"]
            }
        ],
        "categories":["12"]
    },{
        "conditions":[
            {
                "name":"nemovitost_typ",
                "comparator":"==",
                "values":["Chaty a rekreacni objekty"]
            }
        ],
        "categories":["13"]
    },{
        "conditions":[
            {
                "name":"nemovitost_typ",
                "comparator":"==",
                "values":["Komercni objekty"]
            }
        ],
        "categories":["14"]
    },{
        "conditions":[
            {
                "name":"nemovitost_typ",
                "comparator":"!in_array",
                "values":["Domy a vily","Byty","Pozemky","Chaty a rekreacni objekty"]
            }
        ],
        "categories":["15"]
    },{
        "conditions":[
            {
                "name":"nemovitost_uir_obec_kod",
                "comparator":"!in_array",
                "values":["513431","513458","554782"]
            }
        ],
        "categories":["16"]
    },{
        "conditions":[
            {
                "name":"zakazka_stav",
                "comparator":"!=",
                "values":["Aktivni"]
            },{
                "name":"zakazka_stav",
                "comparator":"!=",
                "values":["Realizovano"]
            },{
                "name":"zakazka_datum_editace",
                "comparator":"<",
                "values":["now - 5184000"],
                "format":"date"
            }
        ],
        "glue":"({0} or ({1} and {2}))",
        "categories":["16"]
    }
]

This is real example for importing real estates into F2C. Debugging of these conditions was not easy. As you can see there is quite many of them. So we also developed a debugging table where is written how every condition was evaluated. That table is created for each specific article and it can be different for every article.

Article-Import-for-Form2content-debug.png

Explanation of one condition

Let's make a closer look at one of the conditions:


    {
        "conditions":[
            {
                "name":"nemovitost_typ",
                "comparator":"==",
                "values":["Byty"]
            }
        ],
        "categories":["10"]
    }

The code above will create a condition

IF ( value_of_xml_tag_name:nemovitost_typ == "Byty") THEN put article to category with ID=10

Available comparators

ComparatorExplanation
== equal
!= not equal
> bigger than
< smaller than
<= bigger or equal to
>= smaller of equal to
in_array value exists in array
!in_array value doesn't exists in array

Date operations

You could notice the example on JSON code that we are comparing date value from the XML with the "now - 5184000". "now" will be replaced with current date of the import in seconds. 5184000 is 60 days in seconds. The whole condition will import only articles less than 60 days.

Skip value instead category ID

Note that you can specify category ID as the result of the condition and also there is skip value. When conditions return skip value, no article is imported. So you don't have to import every article but you can skip those you don't want to. Evaluation of conditions is done before any database operation so skipping unwanted articles can speed up the importing process.

Form2Content article refresh

There is one more step to finish the import. After every import it is necessary to refresh all articles.

Components > Form2Content > Select articles by the check box in the head of the articles table > Click Refresh.

comments powered by Disqus

Additional information

For our products there is:

  • no warranty!
  • no support!
  • it is as it is
  • use it on your own risk!