|Bookshelf Home | Contents | Index | Search | PDF|
Siebel eSales Administration Guide > Shopping Service API > User Action Methods >
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
- 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. 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 pricing.
The user properties for the Internal Product by Price List Optional business component are listed in Table 32.
Table 32. 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 pricing 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 pricing. Field:Reference Price Reference Price Similar to Field:Base Price. Used in attribute pricing. Field:Price Book Id Price Book Id Similar to Field:Base Price. Used in attribute pricing. Field:Promotional Price Promotional Price Similar to Field:Base Price. Used in attribute pricing. Field:Quantity Quantity Similar to Field:Base Price. Refers to the Quantity field. Used in attribute pricing and in the Shopping Service. Field:Your Price Your Price Similar to Field:Base Price. Used in attribute pricing. 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 pricing.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 will decide 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 will automatically create a new quote. If its value is N or FALSE, AddToCart will not automatically create a new quote.
- If the AddToCartAutoQuote input argument is empty, AddToCart checks the AddToCartAutoQuote server component parameter (Table 33).
- 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 will navigate to the specified view.
- If this input is empty, the Shopping Service will look for the AddToCartGotoView server component parameter as defined for InfraShoppingService in the repository (Table 33).
- Server component parameters. The server component parameters used by the Shopping Service business service are listed in Table 33. These parameters can be changed by navigating to Server Administration > Components > Component Parameters or by modifying the application configuration (.cfg) file.
Table 33. 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 will automatically create 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 will navigate the user to that view after finishing the AddToCart method. AnonymousQuote TRUE The value can be TRUE or FALSE.If it is TRUE, AddToCart will allow anonymous users to add items to the Shopping Cart, and it will create quotes with quote type Anonymous Quote.If it is FALSE, AddToCart will 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 will automatically fill 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 will support 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 will trigger the eSales Web Login Action Set. The SetShoppingCart method in that action set will load 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 34, using the Catalog business object as an example.
Table 34. 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.
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 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
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:
- Call CanAddToCart method to check if can add item 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.
- 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.
- Call the PostAddToCart method.
Pseudo-Algorithm for DefaultAddToCart
Follow these steps when using a pseudo-algorithm for DefaultAddToCart:
- Get the Quote, Quote Item, and Quote Item XA business components.
- 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.
- Create a new record in the Quote Item business component.
- Populate that line item with information from Product the user has selected.
- Check the Action input argument:
If Action = Customize, then call ReConfigCxProd to launch the customizable product run-time view.
Pseudo-Algorithm for PostAddToCart
Follow these steps when using a pseudo-algorithm for PostAddToCart:
- Check the Action input argument:
If Action = Customize, End;
Else go to step 2.
- Check the AddToCartGotoView input argument:
If not empty, then navigate to that view and End;
Else go to step 3.
- Check the AddToCartGotoView server component parameter:
If not empty and <> NONE, then navigate to that view and End;
|Bookshelf Home | Contents | Index | Search | PDF|
Siebel eSales Administration Guide
Published: 18 April 2003