Synchronization between Magento and Gigya's Data Store (DS) is provided through an optional, separate module that can be installed on top of the main Gigya Extension for Magento.
The DS Sync module adds the ability to pull data from Gigya's Data Store and map it into the user account database in Magento.
Customers who only use Gigya's account storage, and do not use the Gigya Data Store service, do not have to install this additional module.
Note that DS is supported by Gigya CMS module version 3.2.1 and up.
Installation and Implementation
To implement DS sync follow these steps:
1. Download and Install DS Sync
Install it in your Magento site. See instructions for downloading and installing a Magento extension.
2. Configure the local.XML file
You create a Data Store mapping configuration file in the same way you created the account field mapping file. The following piece of code demonstrates defining the account mapping, the DS mapping and the method of data extraction, in the local.xml file.
Example: following is an example of a local.xml file.
|gigya||Wrapper for the mapping and data extraction definitions in the local.xml file|
|mapping_file||Element that contains both the account and DS mapping file definitions||Nested in gigya tag.|
|account_mapping||The path and filename of the account mapping file. For more information, see Using RaaS with Magento||Nested in mapping_file tag. Specify the full path to the file from the server root.|
|ds_mapping||The path and filename of the DS mapping file. See below for an in-depth explanation of the JSON object.||Nested in mapping_file tag. Specify the full path to the file from the server root.|
|ds||Wrapper for the query_type tag, which defines the method of data extraction||Nested in gigya tag|
|query_type||Defines the data extraction method, whether ds.get or ds.search. We recommend using search in most cases. ds.get may be used only when passing a single OID.||Nested in ds tag|
3. Map Fields as JSON Objects
Define the Magento field to be mapped to the Gigya field in your DS field mapping file (referred to in the ds_mapping tag in the local.xml file) as an array of JSON objects. Each object contains one mapping definition, i.e., one Gigya DS field to one Magento field.
Example: The following file maps the ds.test.data field from Gigya DS to a field called custom2 in Magento:
For each field mapping (each object in the array), the following parameters are specified:
|||magentoName||Field name in Magento (case sensitive).|
|||magentoType||The field data type in Magento - int (short/long), string (varchar(X)), date, Boolean.|
|||gigyaName||Field in Gigya DS in the following format: ds.<dstype>.<dsfieldname> , where ds is fixed, and the type (table) and field name should be specified (case sensitive).|
|||gigyaType||The field data type in Gigya.|
|||custom||An array in which to specify the Data Store oid parameter.|
Deactivating DS Sync
To deactivate DS synchronization:
- In the server, go to the magento/app/etc folder.
- Open the DS Sync module's XML file: Gigya_Ds.xml.
- Change the value of the active element from true to false: <active>false</active>.
- Flush the Magento cache.
Calling and Transforming DS Data
You can manually fetch data from the Data Store. You can also listen to specified events using a hook, and transform DS data as needed.
You can download our sample "Magento Example" module and install according to Magento's documentation.. For example, in the Ds.php file, Magento extracts data from a "score" field in the Data Store, and multiplies its value by 2. You can see an example of the configuration file here.
Review the code and use the module as a reference for your own hook implementations.
You can read more about Magento Observers here.