Magento 1.0 - Gigya Data Store (DS) Synchronization

Skip to end of metadata
Go to start of metadata

« Back to Gigya Extension for Magento 1.x

Overview

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

Request the extension by opening a support ticket

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>
	<mapping_file>
		<account_mapping>/example/app/code/community/Gigya/Social/etc/account_mappings.json</account_mapping> <!-- This is the account mapping definition, already done when configuring mapping between Gigya and Magento -->
		<ds_mapping>/example/app/code/community/Gigya/Ds/etc/ds_mappings.json</ds_mapping> <!--This is the mapping definition for DS data -->
	</mapping_file>
	<ds>
		<query_type>search</query_type> <!-- Defines the data extraction method, whether get or search. Search is recommended in most cases -->
	</ds>	
</gigya>
ElementDescriptionNotes
gigyaWrapper for the mapping and data extraction definitions in the local.xml file 
mapping_fileElement that contains both the account and DS mapping file definitionsNested in gigya tag.
account_mappingThe path and filename of the account mapping file. For more information, see Using RaaS with MagentoNested in mapping_file tag. Specify the full path to the file from the server root.
ds_mappingThe 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.
dsWrapper for the query_type tag, which defines the method of data extractionNested in gigya tag
query_typeDefines 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:

[
	{
	    "magentoName": "custom2",
	    "magentoType": "string",
	    "gigyaName": "ds.test.data",
	    "gigyaType": "string",
	    "custom": {
	        "old": "segments"
	    }
	}
]

For each field mapping (each object in the array), the following parameters are specified:

RequiredKeyDescription
magentoNameField name in Magento (case sensitive).
magentoTypeThe field data type in Magento - int (short/long), string (varchar(X)), date, Boolean.
gigyaNameField 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).
gigyaTypeThe field data type in Gigya.
customAn array in which to specify the Data Store oid parameter.

Deactivating DS Sync

To deactivate DS synchronization:

  1. In the server, go to the magento/app/etc folder.
  2. Open the DS Sync module's XML file: Gigya_Ds.xml.
  3. Change the value of the active element from true to false: <active>false</active>.
  4. 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.

Save

Save

  • No labels