Bookshelf Home | Contents | Index | Search | PDF |
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.
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:
- Product to Quote Item
- Product XA VBC to Quote Item XA
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.
- 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.
- 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.
Arguments
The AddToCart method has the arguments shown in Table 35.
.
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.
- End.
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;
Else End.
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eSales Administration Guide Published: 18 April 2003 |