• Resolved ilyapokrov

    (@ilyapokrov)


    I ask you to tell me.
    What if the file looks like this? How to correctly determine the category, gender and everything sotal?

    <categories>
    <category id="1">Mens</category>
    <category id="2" parentId="1">sweaters and shirts</category>
    <category id="3" parentId="2">sweaters</category>
    <category id="4" parentId="1">jackets and trousers</category>
    </categories>
    <offer>
    <categoryId>3</categoryId>
    <categoryId>10</categoryId>
    </offer>

    I am now doing something like this:

    function my_map_data( $data ) {
        $map = array(
    		'3' => 'sweaters',
     );
        return ( array_key_exists( $data, $map ) ) ? $map[ $data ] : $data;
    }

    But something tells me that I am doing nonsense and need to compare categories differently.

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

The topic ‘How do I match categories?’ is closed to new replies.