Search Results for

    Show / Hide Table of Contents

    Matching Records in Magento v2

    When attempting to update records in Magento v2 you can provide a and in a match object to try and return a matching record. You can also provide multiple values to match on by providing a match collection in .

    For example, if I wanted to match customers between Magento v2 and Sage 50 based on a custom field called 'sage_account_number' I could provide the following data:

    <?xml version="1.0" encoding="utf-8"?>
    <ArrayOfCustomer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Customer>
      <match>
        <field>sage_account_number</field>
        <value>ZYNK0001</value>
      </match>
        <group_id>1</group_id>
        <dob xsi:nil="true" />
        <email>[email protected]</email>
        <firstname>Adam</firstname>
        <lastname>Wardle</lastname>
        <gender>0</gender>
        <store_id>1</store_id>
        <website_id>1</website_id>
        <addresses>
          <address>
            <region>
              <region>Tyne &amp; Wear</region>
            </region>
            <country_id>GB</country_id>
            <street>
              <string>Nelson House</string>
              <string>Jesmond</string>
            </street>
            <telephone>214153215</telephone>
            <postcode>NE2 3AE</postcode>
            <city>Newcastle</city>
            <firstname>Adam</firstname>
            <lastname>Wardle</lastname>
            <default_billing>true</default_billing>
            <default_shipping>true</default_shipping>
          </address>
        </addresses>
      </Customer>
    </ArrayOfCustomer>
    
    <?xml version="1.0" encoding="utf-8"?>
    <ArrayOfCustomer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <Customer>
        <matches>
          <match>
            <field>lastname</field>
            <value>JOE001</value>
          </match>
          <match>
            <field>email</field>
            <value>[email protected]</value>
          </match>
        </matches>
        <group_id>440</group_id>
        <firstname>Joe</firstname>
        <lastname>JOE001</lastname>
        <email>[email protected]</email>
        <store_id>1</store_id>
        <website_id>1</website_id>
      </Customer>
    </ArrayOfCustomer>
    
    In This Article
    Zynk Documentation © 2021, Zynk Software Limited. Zynk is a registered trademark of Zynk Software Limited