Each customizable area shows data from its default data source. For this data source, no configuration is necessary. If a customizable area shows (or modifies) data from different resource, that resource must be configured. To show other attributes from other data resources in vies or forms, the element data has to be added as a new top-level element.
In this data section, the additional attributes have to be configured accordingly.
"attributes": {
"attributname": {
"read": {
"resource": "Resourcename",
"path": "attribute read path"
},
"write": {
"resource": "Resourcename",
"path": "attribute write path"
}
}
}
The attribute read path can also contain XPath expressions and functions.
Example
An agent wants to check (and possibly modify) the customer's email address when editing the basket billing address, because an email address is required for ordering. With customization of the basket billing address and by using a different resource (BasketCustomer, which provides the customer's email address), the email address can be added to the configuration.
Because the CSC Basket Customer Info Data Provider takes care of metadata handling, the necessary type information is transferred accordingly. The attribute customeremail is available in attribute_layout or attribute_form widgets and can be edited while editing the billing address.
The following is a slightly stripped down billing address configuration:
{
"data": {
"attributes": {
"customeremail": {
"read": {
"resource": "BasketCustomer",
"path": "/email"
},
"write": {
"resource": "BasketCustomer",
"path": "/email"
}
}
}
},
"layout": [
{
"condition": "data",
"layout": [
{
"id": "address",
"layout": [
{
"attribute": "customeremail", "width":12
},
{
"attribute": "first_name",
"meta": {
"maxLength": 50
},
"width": 6
},
{
"attribute": "last_name",
"meta": {
"maxLength": 50,
"required": true
},
"width": 6
},
{... more attributes... }
]
}
]
}
],
"widgets": {
"address": {
"type": "attribute_form"
}
}
}
The resulting billing address form contains now an email that is updated outside the actual billing address.
Area-Specific Data Sources
| Customizable area | Default data source | Alternative data sources |
| Product Detail | BasketProduct | Basket Address, Customer Info, Basket |
| Basket Shipping Address | Basket Address | Customer Info, Basket |
| Basket Billing Address | Basket Address | Customer Info, Basket |
| Basket Billing Address View <ul><li>These customizable areas are also used to show a list of all basket addresses for selecting the billing or shipping address of a basket.</li><li>The data source is Basket Addresses.</li></ul> | Basket Address | Customer Info, Basket |
| Basket Shipping Address View | Basket Address | Customer Info, Basket |
| Basket Payment Instrument | Basket Payment Instrument | Customer Info, Basket |
| Price Adjustment | Price Adjustment | Basket Address, Customer Info, Basket |
| Order Payment Instrument | Order Payment Instrument | Order Address, Order |
| Order Billing Address View | Order Address | Order |
| Order Shipping Address View | Order Address | Order |
Basket
Provides data from a basket.
Name in configuration: Basket
Parameter:
| Name | Meaning | Required? |
|---|---|---|
| basket_id | ID of the basket | yes |
Basket Address
Provides data of an address of a basket.
Name in configuration: BasketAddress
Parameters:
| Name | Meaning | Required? |
|---|---|---|
| basket_id | ID of the basket | yes |
| shipment_id | ID of the shipment to fetch the address from | no, the billing address is returned otherwise |
Basket Payment Instrument
Provides data about the payment instrument.
Name in configuration: BasketPaymentInstrument
Parameters:
| Name | Meaning | Required? |
|---|---|---|
| basket_id | ID of the basket | yes |
| payment_method_id | ID of the payment method to pay with | no |
| payment_card_type | type of the credit card to use | no |
| payment_instrument_id | ID of the payment instrument | no |
Basket Product
Provides data of a product item.
Name in configuration: BasketProduct
Parameters:
| Name | Meaning | Required? |
|---|---|---|
| basket_id | ID of the basket | yes |
| item_id | ID of the product item | no, if a product_id is given |
| product_id | ID of a product | yes, if no item_id is given |
Customer Info
Provides data of a customer.
Name in configuration: BasketCustomer
Parameter:
| Name | Meaning | Required? |
|---|---|---|
| basket_id | ID of the basket | yes |
Order
Provides data from an order.
Name in configuration: Order
Parameter:
| Name | Meaning | Required? |
|---|---|---|
| order_no | order number | yes |
Order Address
Provides data of an address of an order.
Name in configuration: OrderAddress
Parameters:
| Name | Meaning | Required? |
|---|---|---|
| order_no | order number | yes |
| shipment_id | ID of the shipment to fetch the address from | no, the billing address is returned otherwise |
Order Payment Instrument
Provides data about the payment instrument of an order.
Name in configuration: OrderPaymentInstrument
Parameters:
| Name | Meaning | Required? |
|---|---|---|
| order_no | order number | yes |
| payment_method_id | ID of the payment method to pay with | no |
| payment_card_type | type of the credit card to use | no |
| payment_instrument_id | ID of the payment instrument | no |
For a provided payment_method_id, the payment_card_type is also considered and the data returned is as complete as possible:
- a credit card payment method returns a partially filled out credit card object
- a bank transfer payment method returns a partially filled out bank transfer object
- a provided payment_instrument_id returns the data of the payment instrument
Price Adjustment
Provides data of a price adjustment.
Name in configuration: BasketPriceAdjustment
Parameter:
| Name | Meaning | Required? |
|---|---|---|
| basket_id | ID of the basket | yes |
| item_id | ID of the product item | no, if a product_id is given |
Generic Data Sources
Data source: site
Provides site information, the possible properties of the site object can be checked in the Site documentation from Shop API. Here is an example using name, id, and timezone properties.
"data": {
"attributes": {
"sitename": {
"read": {
"resource": "Site",
"path": "/name"
}
},
"siteid": {
"read": {
"resource": "Site",
"path": "/id"
}
},
"sitetz": {
"read": {
"resource": "Site",
"path": "/timezone"
}
}
}
},
"layout": {
[{
"id": "siteinfo",
"condition": "data.siteid === 'SiteGenesis'",
"width": 12
}]
},
"widgets": {
"siteinfo": {
"type": "attribute_listing",
"config": {
"attributes": [
"sitename",
"siteid",
"sitetz"
],
"columns": 2
}
}
}