Infor syteline connect Magento

Product Description from Infor Syteline to Magento with HexaSync

Overview of data transformation?

Data transformation is the process of changing the format, structure, or values of data. One of the most common tasks of eCommerce and ERP integration projects are EXTRACTING product information from ERP then TRANSFORMING to the appropriate format then LOADING into an eCommerce website. However, we do not plan to talk much about data transformation in theory in this article. We are going to give you an example of synchronizing product description data between Infor Syteline (or Infor CloudSuite Industrial) and a Magento eCommerce Website and keeping the data format similarly on both systems.

Transform product description data

overview data transformation

The above picture is a description of a product that is displayed in the Infor Syteline ERP. When product data was loaded to the Magento eCommerce website via HexaSync Integration Platform, data was shown on the product detail page on the front-end as in the picture below.

the data's description

As you see the difference in the product description was displayed on Magento Website with all the new lines removed.

The problem is pretty simple, Syteline stores line breaks "\n" "\r" in plain text data field while our Magento development team stript all newlines “\n" "\r" with this simple function in their source code.

str_replace(array("\r", "\n"), '', $string)

What are possible solutions?

There are some ways to solve this problem that we can think of.

  1. The magento development team may customize magento theme to convert plain text to HTML break before displaying on front-end with the below simple PHP function
str_replace(array("\r", "\n"), '<br/>', $string)
  1. The product data managemen team keeps using the plain text data, HexaSync transform new line characters to HTML break.
# This is how HexaSync transform the description plain text in a single row data
{{item.description | hexasync.string.plain_text_to_html}}

# CSharp
public static string PlainTextToHtml(string input)
{
    if (string.IsNullOrWhiteSpace(input))
    {
        return input;
    }
    return input
        # This will translate \r\n into <br /> and keep the new line in the browser textbox
        .Replace("\r\n", "<br />\n")
        .Replace("\n", "<br />\n");
}
  1. Another way, Syteline uses RTF format, HexaSync transform RTF format to HTML
# This is how HexaSync transform the description in a rtf format in a single row data
{{item.description | hexasync.string.rtf_to_html}}

# CSharp
public static string RtfToHtml(string input)
{
    if (string.IsNullOrWhiteSpace(input))
    {
        return input;
    }
    # https://github.com/erdomke/RtfPipe
    var html = RtfPipe.Rtf.ToHtml(input);
    return html;
}
  1. Or Syteline uses HTML Format, HexaSync synchronize whatever in Syteline into Magento. This is the easiest request if Syteline provided enough information, but life is not easy that way.

How we resolved this simple issue?

Being a data integration company, we have to deal with data transformation daily. It is impossible for keeping asking the source of data to be formatted in the way we prefer. Therefore, we have to design our HexaSync Integration Platform to be compatible with any kind of possible data format.

With that approach, we add a very simple transformation method into our platform to convert newline plain text characters "\n" "\r" to HTML break tag as we describe in solution 1 above

Below is how the product description looks on the Magento eCommerce website after transforming.

magento ecommerce website after transforming.

If we take a look at the Magento backend, we will see HexaSync loaded transformed product description data with HTML <br/> tag format instead of plain text as inside Syteline.

magento backend dashboard

Conclusion

In this article, we shared a common problem that our integration solution helps customers daily, data transformation. We also introduced briefly our approach in ERP & eCommerce projects to deliver happiness to all parties. If you have any concerns, please feel free to visit our magento & erp integrations products or contact us for free consulting.

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email