Siebel eSales Administration Guide > Shopping Service API > User Action Methods >

AddToCart


This method is invoked to add an item to the Shopping Cart. It checks the input argument Action. Depending on the value of Action, the Shopping Cart takes different actions, as described in the Table 31.

Table 31. Shopping Cart Actions
Action
Method Invoked
AddToCart
DefaultAddToCart
Customize
DefaultAddToCart
QuickAdd
QuickAdd
AddTrainingItem
AddTrainingItem
AddEventItem
AddTrainingItem
AddEventSessionItem
AddTrainingItem

What the AddToCart method does is to create one or more (for complex products) records in the Quote Item business component in the current quote record (indicated by CurrentQuoteId) in the Quote business component.

If the product has extended attributes, it will also copy the extended attribute values from the Product XA VBC business component to the Quote Item XA business component. The extended attributes for a product are in the XA Attribute Value business component. End users can select values for each modifiable attribute; these selections are stored in the Product XA VBC business component.

For example, if you add a product with four attributes to the Shopping Cart, you create one record in the Quote Item business component and four records in the Quote Item XA business component. The mapping is as follows:

Expected Preconditions Before the Method Can Be Called

Arguments

The AddToCart method has the arguments shown in Table 35.

.

Table 35. AddToCart Arguments
Name
Type
Data Type
Optional
Comments
Action
Input
String
Y
Specifies the action to take.
Action can take the following values:
  • AddToCart
  • Customize
  • QuickAdd
  • AddTrainingItem
  • AddEventItem
  • AddEventSessionItem
AddToCart Quote Fields
Input
String
Y
Concatenated string of Quote business component field name/value pairs.
AddToCart deconstructs this string and sets the corresponding fields in the Quote business component.
AddToCart AutoQuote
Input
String
Y
Used to decide whether to create a new quote automatically if there is no current quote.
If empty, AddToCart will look for the server component parameter with the same name.
AddToCart
GotoView
Input
String
Y
Used to decide to which view to navigate after completing adding an item.
If empty, AddToCart will look for the server component parameter with the same name.
Source Currency Code
Input
String
Y
Specifies the currency code for the price.
If not empty and not equal to the currency code in the quote, AddToCart will do the currency conversion and set the converted Price field in the quote item.
Quote Id
Output
String
Y
Returns the quote ID for the current quote.
Quote Item Id
Output
String
Y
Returns the quote item ID.
ReturnVal
Output
String
Y
Returns Success or Fail. Not used.

Pseudo-Algorithm for AddToCart

Follow these steps when using a pseudo-algorithm for AddToCart:

  1. Call CanAddToCart method to check if can add item to the Shopping Cart:
  2. If the CurrentQuoteId profile attribute is not empty and is a valid quote ID, return TRUE;

    else if the AddToCartAutoQuote input argument is TRUE, return TRUE;

    else if the AddToCartAutoQuote server component parameter is TRUE, return TRUE;

    else return FALSE.

  3. Check the Action input argument:
  4. If Action = AddTrainingItem or AddEventItem or AddEventSessionItem, call the AddTrainingItem method;

    Else if Action = QuickAdd, call the QuickAdd method;

    Else if Action = AddToCart or Customize:

    Call the DefaultAddToCart method.

  5. Call the PostAddToCart method.

Pseudo-Algorithm for DefaultAddToCart

Follow these steps when using a pseudo-algorithm for DefaultAddToCart:

  1. Get the Quote, Quote Item, and Quote Item XA business components.
  2. Call AddHeader to make sure there is a current quote for adding an item, What AddHeader is doing is to make sure if there is a current quote, if there is not current. AddHeader will create a new quote and set the CurrentQuoteID profile attribute value to the Row ID of the newly created quote record.
  3. Create a new record in the Quote Item business component.
  4. Populate that line item with information from Product the user has selected.
  5. Check the Action input argument:
  6. If Action = Customize, then call ReConfigCxProd to launch the customizable product run-time view.

  7. End.

Pseudo-Algorithm for PostAddToCart

Follow these steps when using a pseudo-algorithm for PostAddToCart:

  1. Check the Action input argument:
  2. If Action = Customize, End;

    Else go to step 2.

  3. Check the AddToCartGotoView input argument:
  4. If not empty, then navigate to that view and End;

    Else go to step 3.

  5. Check the AddToCartGotoView server component parameter:
  6. If not empty and <> NONE, then navigate to that view and End;

    Else End.


 Siebel eSales Administration Guide 
 Published: 18 April 2003