Knowledge BaseAX Developer Guide

AX Developer Guide

Sana Commerce 8.1
Your provider

Sana Commerce Customization Scenarios

Below you can find the description of two common customization scenarios of the Sana Commerce framework:

  • Adding the custom fields to the entities.
  • Adding the new functions into the Sana Commerce framework.

1. Adding the custom fields to the entities. This is the most common customization required by the partners and customers. Depending on the specific customer the AX objects can contain custom fields which also should be processed by Sana Commerce. All entities returned from AX as set of field-value elements.

Example:

this.addField ('AccountNum', customer, "", custTable);
this.addField ('Currency', customer, "", custTable);
this.addField ('Phone', customer, "", custTable);
this.addField ('NameAlias', customer, "", custTable);

or

this.addFieldValue (#billtoStreet, customer, invoiceAddress.Street);
this.addFieldValue (#billtoCity, customer, invoiceAddress.City);
this.addFieldValue (#billtoCountryRegionId, customer, invoiceAddress.CountryRegionId);
this.addFieldValue (#billtoZipCode, customer, invoiceAddress.ZipCode);

To extend it with the extra filed you need to add a new line with this format:

this.addField ('<FieldName>, <XMLNode>, <TableBuffer>);

or

this.addFieldValue ('<FieldName>, <XMLNode>, <Value>);

2. Adding the new functions into the Sana Commerce framework. Decide where to place the new function: it can be placed in several existing classes or in the new one.
Please see the table of the new and modified classes.

The new function should have 1 parameter: Request of type 'Microsoft XML, v3.0'.DOMDocument'.

After the function is created, you need to create a case in the 'SC_AXDataServiceClient' class in the 'ProcessRequest' method. For example, if you create the new function for the product class it should look like this:

case <NewFunctionName>':
      resultXml = SC_AXDataServiceClient_Product::construct().<NewMethodName>(request);
break;

At the Sana Commerce side you need to extend the AX provider, and create in it the function which will generate request xml and parse xml response.

Knowledge BaseAX Developer Guide