Home Forums ACF PRO Mapping int values from XML to multiple related strings


Mapping int values from XML to multiple related strings

  • Hi everyone,
    I’m struggling to find out ho to map integer values coming from XML and convert them to strings for the frontend of my website.

    This is part of the XML I’m importing:

    			<info id="1"><id>1</id><assigned_value>0</assigned_value></info>
    			<info id="2"><id>2</id><assigned_value>0</assigned_value></info>
    			<info id="3"><id>3</id><assigned_value>1</assigned_value></info>
    			<info id="55"><id>55</id><assigned_value>3</assigned_value></info>

    This is an example of informations I have to map for ID-52, and every ID have such a “dictionary” or corresponding values:

    Info  55 - Energy Class
    possible value	meaning
    0	Not yet defined
    1	A+/passive
    2	A
    3	B
    4	C
    5	D
    6	E
    7	F
    8	G
    9	Not subjected to certification
    10	A4 (only for APE 2015)
    11	A3 (only for APE 2015)
    12	A2 (only for APE 2015)
    13	A1 (only for APE 2015)

    On the frontend obviously i see the numbers, but I’d really love to see what they refer to =( How can I achieve this result?

    Thanks in advance to everyone who will help me.

  • @franzkekko How does your question relate to ACF? This forum is specifically for questions about ACF. Your question looks like it would be better suited for Stack Overflow.

  • good point. That’s my explanation:

    I mapped ACF fields to WP-ALL-Import. In this way every field coming from the XML goes to a specific ACF_field that I can show then in frontend. But, as I explained, on the frontend I see numbers instead of string values (obviously, ’cause they are not converted in any way)…and that’s exactly what I’m trying to solve =)

    I thought this was the right place to ask to, because in frontend I’m using shortcodes to show values inside a table.
    Am I doing it the right way? How can I convert numbers to strings?
    Thanks again,

  • Solved, the key was inside some hidden configuration of WP_ALL_Import.
    Not exactly solved, but solving…step by step.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Mapping int values from XML to multiple related strings’ is closed to new replies.