To obtain Order details from the Back end

We can order details such as items that we are added to cart, and the summary details and all the item details using the getFieldValues method on the ModelsInit model. We can pass the parameter to retrieve the particular type of fields. The code is given below:

      var new_order_field_keys = {},
                        isCheckout = Utils.isInCheckout(request) && ModelsInit.session.isLoggedIn2(),
                        field_keys = isCheckout ? SC.Configuration.orderCheckoutFieldKeys : SC.Configuration.orderShoppingFieldKeys;

                    new_order_field_keys.items = field_keys.items;
                    new_order_field_keys.keys = field_keys.keys;
      var model_item = ModelsInit.order.getFieldValues(order_field_keys, false);

This will return all the fields on the SC.Configuration.orderCheckoutFieldKeys and SC.Configuration.orderShoppingFieldKeys such as :

We can add more custom item fields in this array of items by adding the fields on the configuration of that domain

Go to configuration subtab on the Commerce tab then configure it by using the corresponding website and domain.

Navigate to Backend subtab on the Advanced tab of the configuration and add the required fields under the item table.

Leave a comment

Your email address will not be published. Required fields are marked *