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

SetShoppingCart


This method is used in run-time event action sets to support the Persistent Shopping Cart and anonymous users adding items to the Shopping Cart.

SetShoppingCart is used in the eSales WebLogin Action Set. This action set is associated with the WebLogin run-time event for the Siebel eSales application object. When a Siebel eSales user logs in, the WebLogin run-time event is triggered. This in turn triggers the eSales Web Login Action Set and executes the SetShoppingCart method.

The method checks if there is already a current quote in the session as indicated by the CurrentQuoteId profile attribute:

Expected Preconditions Before the Method Can Be Called

Arguments

None.

Pseudo-Algorithm

  1. If the Is Anonymous profile attribute = TRUE, End.
  2. Check the CurrentQuoteId profile attribute:
  3. If empty or = EMPTY_CART, there is no current quote. Go to step 3;

    Else go to step 4.

  4. Get the Catalog business object and the Quote, Quote Item, and Quote Item XA business components. Query the Quote business component with the search specification [Contact Id] = LoginId () AND [Quote Type] = LookupValue ('QUOTE_TYPE', 'Persistent Cart') to find the quote record of type Persistent Cart for that user. One or zero records will be returned.
  5. If one record is returned, the user has a Persistent Cart. Set the CurrentQuoteId profile attribute to the record ID, then go to step 8.

  6. Get the Catalog business object and the Quote, Quote Item, and Quote Item XA business components. Query the Quote business component with the search specification [Id] = GetProfileAttr("CurrentQuoteId") to get the current quote. Check the Quote Type field value:
  7. If [Quote Type]= LookupValue ('QUOTE_TYPE', 'Anonymous Quote'), the current quote is an anonymous user's Shopping Cart. Go to step 5;

    Else, go to step 6.

  8. Before converting Anonymous Quote to Persistent Cart, it is necessary to check if the user already has a Persistent Shopping Cart. Get a second instance of the Catalog business object and the Quote, Quote Item, and Quote Item XA business components. Query the second instance of the Quote business component with the search specification [Contact Id] = LoginId () AND [Quote Type] = LookupValue ('QUOTE_TYPE', 'Persistent Cart'). It will return one or zero records.
  9. If it returns no records, go to step 6;

    If it returns one record, it is necessary to resolve the conflict between the anonymous quote and an existing persistent Shopping Cart. Go to step 7.

  10. Convert Anonymous Quote to Persistent Cart:
  11. Set [Account Id] to the account ID of the current user;

    Set [Contact Id] to the login ID of the current user;

    Set [Quote Type] to LookupValue ('QUOTE_TYPE', 'Persistent Cart');

    Set [Price List Id] to the current price list ID;

    End.

  12. There are two quote records: the quote record in the first Quote instance is the Anonymous Quote; the record in the second Quote instance is the previous Persistent Shopping Cart. Save the previous Persistent Shopping Cart as a quote with a name.
  13. If the price list in the current quote is different from the current price list, set [Price List Id] to the current price list ID in the system.

 Siebel eSales Administration Guide 
 Published: 18 April 2003