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

AddToCart Method


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 Table 15.

Table 15. 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 records (for complex products) 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 also copies 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:

  • Product to Quote Item
  • Product XA VBC to Quote Item XA

Preconditions for Calling the AddToCart Method

  • Where AddToCart can be called. This method can be called from either an applet or a business component. In each case, the caller function needs to call the SetBusComp method to set the current business component to the Shopping Service instance.

    The Shopping Service instance needs to use the current business component to get the current business object and all the context information. Therefore, you cannot invoke this method from an applet that does not have a business component.

  • Quote record. The Shopping Cart is just a quote record whose row ID equals the CurrentQuoteId profile attribute. The Quote Type field value for this current quote record can be Quotation, Persistent Cart, or Anonymous Quote.
    • If it is Quotation, then the current quote is a normal quote.
    • If it is Persistent Cart, it means this application supports the Persistent Shopping Cart and this quote is the Persistent Shopping Cart for that user.
    • If it is Anonymous Quote, it means this application allows anonymous users to add items to the Shopping Cart and this user is an anonymous user.
  • Price List Id, Promotion Id, and Campaign Id fields. The current quote record has a Price List Id field, a Promotion Id field, and a Campaign Id field. The field value for Price List Id cannot be empty. The field values for Promotion Id and Campaign Id can be empty or not.

    There are also three corresponding profile attributes—PromotionId, CampaignId, and PriceListId. These can be set by Siebel eMarketing when a user clicks the hyperlink on a Web offer. Therefore, the field values for Price List Id, Campaign Id, and Promotion Id in the current quote record can be different from the values in the PriceListId, CampaignId, and PromotionId profile attributes. When users add items to the Shopping Cart, these three field values in the current quote record are set to the value from the corresponding profile attributes.

  • Internal Product by Price List Optional business component. This is the underlying product business component for AddToCart, QuickAdd, and Customize.

    All other business components use this business component as the proxy business component for AddToCart. This is because only this business component has extended attribute child business components such as Product XA VBC and XA Attribute Value. In addition, it is used in Attribute Adjustments.

    The user properties for the Internal Product by Price List Optional business component are listed in Table 16.

    Table 16. Internal Product by Price List Optional BC User Properties
    Name
    Value
    Explanation

    Field:Base Price

    Catalog Price

    The C++ code for the Shopping Service and Attribute Adjustments refers to certain fields. Instead of hard-coding the field name in C++, this user property is used for mapping between the field to which the C++ code refers and the actual field name in the business component.

    For example, this user property indicates that the Base Price to which the C++ code refers is called Catalog Price in the Internal Product by the Price List Optional business component.

    This way, Base Price in the C++ code can be mapped to different fields in different business components.

    Field:Catalog Price

    Catalog Price

    Similar to Field:Base Price. Used in Attribute Adjustments.

    Field:Reference Price

    Reference Price

    Similar to Field:Base Price. Used in Attribute Adjustments.

    Field:Price Book Id

    Price Book Id

    Similar to Field:Base Price. Used in Attribute Adjustments.

    Field:Promotional Price

    Promotional Price

    Similar to Field:Base Price. Used in Attribute Adjustments.

    Field:Quantity

    Quantity

    Similar to Field:Base Price. Refers to the Quantity field. Used in Attribute Adjustments and in the Shopping Service.

    Field:Your Price

    Your Price

    Similar to Field:Base Price. Used in Attribute Adjustments.

    Product XA

    Product XA VBC

    Indicates that the extended attribute to use is Product XA VBC.

    SetPriceListSearch

    Y

    Indicates that the [Price List Id] = GetProfileAttr("PriceListId") search specification should be applied to the business component.

    If used, only products that are on the current price list are visible in Siebel eSales.

    Use Promotional Price

    Y

    Used in Attribute Adjustments.

    When this is Y, the Base Price equals the Promotional Price if the Promotional Price field is not empty. Otherwise, the Base Price equals the Reference Price.

  • AddToCartAutoQuote input argument. When there is no current quote as specified by CurrentQuoteId, AddToCart decides whether to create a new quote automatically based on certain conditions:
    • AddToCart checks the AddToCartAutoQuote input argument. If its value is Y or TRUE, AddToCart automatically creates a new quote. If its value is N or FALSE, AddToCart does not automatically create a new quote.
    • If the AddToCartAutoQuote input argument is empty, AddToCart checks the AddToCartAutoQuote server component parameter (Table 17).
  • AddToCartGotoView input argument. The calling action can also specify the next view to which to navigate after finishing the AddToCart method. This is done through the AddToCartGotoView input argument:
    • If this input is not empty, the application navigates to the specified view.
    • If this input is empty, the Shopping Service looks for the AddToCartGotoView server component parameter as defined for InfraShoppingService in the repository (Table 17).
  • Server component parameters. The server component parameters used by the Shopping Service business service are listed in Table 17. You can change these parameters by navigating to Server Administration > Components > Component Parameters.
    Table 17. Server Component Parameters in the Shopping Service
    Name
    Default Value
    Explanation

    AddToCartAutoQuote

    TRUE

    The value can be TRUE or FALSE.

    If it is TRUE, AddToCart automatically creates a new quote if there is no current quote.

    AddToCartGotoView

    NONE

    The value can be NONE or a specific view name.

    If it is a specific view name, the application navigates the user to that view after finishing the AddToCart method.

    AnonymousQuote

    TRUE

    The value can be TRUE or FALSE.

    If it is TRUE, AddToCart allows anonymous users to add items to the Shopping Cart, and it creates quotes with quote type Anonymous Quote.

    If it is FALSE, AddToCart does not allow anonymous users to add items to the Shopping Cart.

    AutoQuoteDefaultOwner

    TRUE

    The value can be TRUE or FALSE.

    If it is TRUE, when AddToCart automatically creates a new quote, it automatically fills in the Contact Id and Account Id fields with the current user's login ID and account ID.

    PersistentShoppingCart

    FALSE

    The value can be TRUE or FALSE.

    If it is TRUE, the application supports the Persistent Shopping Cart. The quote created by AddToCart will have type Persistent Cart.

    When the user logs in to the application, the run-time event triggers the eSales Web Login Action Set. The SetShoppingCart method in that action set loads the quote with type Persistent Cart for that user.

    ProductDetailView

    Product Detail - Features View (eSales)

    Specifies the view name for the Product Detail view.

    ShoppingCartView

    NONE

    Specifies the view for the Shopping Cart.

  • Business object must include all necessary business components. The list of business components that must be in the business object calling the AddToCart method is shown in Table 18, using the Catalog business object as an example.
    Table 18. Necessary Business Components in the Business Object
    Business Component
    Link
    Comment

    Internal Product by Price List Optional

     

    Underlying business component for AddToCart, QuickAdd, and Customize.

    All other business components by default use this business component as the AddToCart Proxy Buscomp.

    Internal Product by Price List Optional 2

    Catalog Category/Internal Product by Price List Optional 2

    Used in the Product list applet for AddToCart.

    This business component uses Internal Product by Price List Optional as the AddToCart Proxy Buscomp.

    XA Attribute Value

    Internal Product by Price List Optional/XA Attribute Value

    Needed for extended attributes.

    Product XA VBC

     

    Needed for extended attributes.

    Product XA VBC Form

    Internal Product by Price List Optional/Product XA VBC Form

    Needed for extended attributes.

    Quote

     

     

    Quote Item

    Quote/Quote Item

     

    Quote Item XA

     

     

    Training Class Registration

     

    Needed for AddTrainingItem.

    eEvents Event Attendee

     

    Needed for AddTrainingItem.

    eEvents Session Attendee

     

    Needed for AddTrainingItem.

    Favorite List

     

    Needed for AddToFavoriteList.

    Favorite List Item

    Favorite List/Favorite List Item

    Needed for AddToFavoriteList.

Arguments for the AddToCart Method

The AddToCart method has the arguments shown in Table 19.

Table 19. 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 looks for the server component parameter with the same name.

AddToCart
GotoView

Input

String

Y

Used to decide to which view to navigate after adding an item has been completed.

If empty, AddToCart looks 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 does the currency conversion and sets 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 whether or not a user can add items to the Shopping Cart:

    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.

  2. Check the Action input argument:

    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.

  3. 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 does is to make sure there is a current quote, if there is not a current one. 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:

    If Action = Customize, then call ReConfigCxProd to launch the customizable product run-time view.

  6. End.

Pseudo-Algorithm for PostAddToCart

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

  1. Check the Action input argument:

    If Action = Customize, End;

    Else go to step 2.

  2. Check the AddToCartGotoView input argument:

    If not empty, then navigate to that view and End;

    Else go to step 3.

  3. Check the AddToCartGotoView server component parameter:

    If not empty and <> NONE, then navigate to that view and End;

    Else End.

Siebel eSales Administration Guide Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.