com.konakart.blif
Interface BasketMgrIf

All Known Implementing Classes:
BasketMgr

public interface BasketMgrIf

BasketMgrIf Interface which an implementation of this manager must adhere to.


Method Summary
 int addToBasket(java.lang.String sessionId, int customerId, BasketIf item)
          Determines the customerId to use and calls the private method with the customerId.
 int addToBasketWithOptions(java.lang.String sessionId, int customerId, BasketIf item, AddToBasketOptionsIf options)
          If options is set to null, this method is identical to addToBasket().
 java.lang.String createEncodedProduct(int productId, OptionIf[] opts)
          Create the encoded product The customers_basket table contains a products_id field which is encoded like this : 1{3}6{4}3 which means product of id==1 with product_options of id==3 and product_options_values of id==6 followed by product_options of id==4 and product_options_values of id==3.
 Option findOptionInProduct(ProductIf p, Option o)
          The basket object must have a populated product object with options.
 Basket[] getBasketItemsPerCustomer(java.lang.String sessionId, int customerId, int languageId)
          Get the basket items for a customer.
 Basket[] getBasketItemsPerCustomerWithOptions(java.lang.String sessionId, int customerId, int languageId, AddToBasketOptionsIf options)
          Get the basket items for a customer.
 void mergeBaskets(java.lang.String sessionId, int customerFromId)
          Add all items from the basket of customerFrom to the basket of customerTo which is retrieved from the sessionId.
 void mergeBasketsWithOptions(java.lang.String sessionId, int customerFromId, AddToBasketOptionsIf options)
          Add all items from the basket of customerFrom to the basket of customerTo which is retrieved from the sessionId.
 void populateOptsForBasketItem(Basket item, int priceId, int languageId, AddToBasketOptionsIf a2bOptions)
          The customers_basket table contains a products_id field which is encoded like this : 1{4}3{3}6 which means product of id==1 with product_options of id==4 and product_options_values of id==3 followed by product_options of id==3 and product_options_values of id==6.
 void removeBasketItemsPerCustomer(java.lang.String sessionId, int customerId)
          We determine which customerId to use and then delete all basket items that exist for this customer by calling the private method.
 void removeFromBasket(java.lang.String sessionId, int customerId, BasketIf item)
          We must remove the customers_basket record and any associated customers_basket_attributes records.
 void updateBasket(java.lang.String sessionId, int customerId, BasketIf item)
          If the sessionId is null, we check the customerId to ensure that it is negative.
 void updateBasketWithOptions(java.lang.String sessionId, int customerId, BasketIf item, AddToBasketOptionsIf options)
          If the sessionId is null, we check the customerId to ensure that it is negative.
 Basket[] updateBasketWithStockInfo(BasketIf[] basketItems)
          Receives an array of basket items and updates each one with the current stock level.
 Basket[] updateBasketWithStockInfoWithOptions(BasketIf[] basketItems, AddToBasketOptionsIf options)
          Receives an array of basket items and updates each one with the current stock level.
 

Method Detail

getBasketItemsPerCustomer

Basket[] getBasketItemsPerCustomer(java.lang.String sessionId,
                                   int customerId,
                                   int languageId)
                                   throws java.lang.Exception
Get the basket items for a customer. We determine which customerId to use and then call the private method. Although we read the final_price from the db, we set it through a calculation since OsCommerce doesn't store this in the DB. We do store it in the DB but never use it directly from the DB.

Parameters:
sessionId -
customerId -
languageId -
Returns:
Returns an array of Basket Items
Throws:
java.lang.Exception

getBasketItemsPerCustomerWithOptions

Basket[] getBasketItemsPerCustomerWithOptions(java.lang.String sessionId,
                                              int customerId,
                                              int languageId,
                                              AddToBasketOptionsIf options)
                                              throws java.lang.Exception
Get the basket items for a customer. We determine which customerId to use and then call the private method. Although we read the final_price from the db, we set it through a calculation since OsCommerce doesn't store this in the DB. We do store it in the DB but never use it directly from the DB. If options is set to null then this call is identical to getBasketItemsPerCustomer(). The options may determine from where we read the price and quantity of the basket items.

Parameters:
sessionId -
customerId -
languageId -
options -
Returns:
Returns an array of Basket Items
Throws:
java.lang.Exception

addToBasketWithOptions

int addToBasketWithOptions(java.lang.String sessionId,
                           int customerId,
                           BasketIf item,
                           AddToBasketOptionsIf options)
                           throws java.lang.Exception
If options is set to null, this method is identical to addToBasket(). Otherwise the functionality differs depending on the combination of options set.

Parameters:
sessionId -
customerId -
item -
options -
Returns:
Returns the id of the newly created Basket object
Throws:
java.lang.Exception

addToBasket

int addToBasket(java.lang.String sessionId,
                int customerId,
                BasketIf item)
                throws java.lang.Exception
Determines the customerId to use and calls the private method with the customerId.

Parameters:
sessionId -
customerId -
item -
Returns:
Returns the id of the newly created Basket object
Throws:
java.lang.Exception

findOptionInProduct

Option findOptionInProduct(ProductIf p,
                           Option o)
                           throws KKException
The basket object must have a populated product object with options. The option passed in as a parameter is only partially populated so we try to find it in the array of options of the product and return the fully populated one.

Parameters:
p -
o -
Returns:
Option
Throws:
KKException

updateBasket

void updateBasket(java.lang.String sessionId,
                  int customerId,
                  BasketIf item)
                  throws KKException,
                         com.workingdogs.village.DataSetException,
                         java.lang.Exception
If the sessionId is null, we check the customerId to ensure that it is negative. If it is negative, this means that it is a non registered customer or a customer that hasn't logged in yet and so there is no customer mapped to the session id. Otherwise we ensure that the sessionId is valid and that it points to the customerId passed in as a parameter.

Parameters:
sessionId -
customerId -
item -
Throws:
java.lang.Exception
com.workingdogs.village.DataSetException
KKException

updateBasketWithOptions

void updateBasketWithOptions(java.lang.String sessionId,
                             int customerId,
                             BasketIf item,
                             AddToBasketOptionsIf options)
                             throws KKException,
                                    com.workingdogs.village.DataSetException,
                                    java.lang.Exception
If the sessionId is null, we check the customerId to ensure that it is negative. If it is negative, this means that it is a non registered customer or a customer that hasn't logged in yet and so there is no customer mapped to the session id. Otherwise we ensure that the sessionId is valid and that it points to the customerId passed in as a parameter. If options is set to null, this method is identical to updateBasket(). Otherwise the functionality differs depending on the combination of options set.

Parameters:
sessionId -
customerId -
item -
options -
Throws:
java.lang.Exception
com.workingdogs.village.DataSetException
KKException

removeBasketItemsPerCustomer

void removeBasketItemsPerCustomer(java.lang.String sessionId,
                                  int customerId)
                                  throws java.lang.Exception
We determine which customerId to use and then delete all basket items that exist for this customer by calling the private method.

Parameters:
sessionId -
customerId -
Throws:
java.lang.Exception

removeFromBasket

void removeFromBasket(java.lang.String sessionId,
                      int customerId,
                      BasketIf item)
                      throws java.lang.Exception
We must remove the customers_basket record and any associated customers_basket_attributes records.

Parameters:
sessionId -
customerId -
item -
Throws:
java.lang.Exception

createEncodedProduct

java.lang.String createEncodedProduct(int productId,
                                      OptionIf[] opts)
Create the encoded product The customers_basket table contains a products_id field which is encoded like this : 1{3}6{4}3 which means product of id==1 with product_options of id==3 and product_options_values of id==6 followed by product_options of id==4 and product_options_values of id==3. The order is very important (product option ids increasing) since this the encoded product has to match regardless of the ordering of the options in the ops array.

Parameters:
productId -
opts -
Returns:
The encoded string

mergeBaskets

void mergeBaskets(java.lang.String sessionId,
                  int customerFromId)
                  throws java.lang.Exception
Add all items from the basket of customerFrom to the basket of customerTo which is retrieved from the sessionId. This is done when a customer logs in, to move his temporary basket to his permanent basket.

Parameters:
sessionId -
customerFromId -
Throws:
java.lang.Exception

mergeBasketsWithOptions

void mergeBasketsWithOptions(java.lang.String sessionId,
                             int customerFromId,
                             AddToBasketOptionsIf options)
                             throws java.lang.Exception
Add all items from the basket of customerFrom to the basket of customerTo which is retrieved from the sessionId. This is done when a customer logs in, to move his temporary basket to his permanent basket. If options is set to null then this call is identical to mergeBaskets(). The options may determine from where we read the price and quantity of the basket items.

Parameters:
sessionId -
customerFromId -
options -
Throws:
java.lang.Exception

updateBasketWithStockInfo

Basket[] updateBasketWithStockInfo(BasketIf[] basketItems)
                                   throws java.lang.Exception
Receives an array of basket items and updates each one with the current stock level. This is a useful check to make before checking out, to see whether the stock level is sufficient. If the product or any of the product attributes of a basket item no longer exist, then that basket item is not returned. This means that the size of the returned array may be smaller than the size of the array passed in as a parameter.

Parameters:
basketItems -
Returns:
Returns an array of basket items with updated stock level
Throws:
java.lang.Exception

updateBasketWithStockInfoWithOptions

Basket[] updateBasketWithStockInfoWithOptions(BasketIf[] basketItems,
                                              AddToBasketOptionsIf options)
                                              throws java.lang.Exception
Receives an array of basket items and updates each one with the current stock level. This is a useful check to make before checking out, to see whether the stock level is sufficient. If the product or any of the product attributes of a basket item no longer exist, then that basket item is not returned. This means that the size of the returned array may be smaller than the size of the array passed in as a parameter. If options is set to null, this method is identical to updateBasketWithStockInfo(). Otherwise the functionality differs depending on the combination of options set.

Parameters:
basketItems -
options - An object containing options for the method. It may be set to null.
Returns:
Returns an array of basket items with updated stock level
Throws:
java.lang.Exception

populateOptsForBasketItem

void populateOptsForBasketItem(Basket item,
                               int priceId,
                               int languageId,
                               AddToBasketOptionsIf a2bOptions)
                               throws java.lang.Exception
The customers_basket table contains a products_id field which is encoded like this : 1{4}3{3}6 which means product of id==1 with product_options of id==4 and product_options_values of id==3 followed by product_options of id==3 and product_options_values of id==6. We have to read this encoded field called encodedProduct and create an array of Options and then set the opts attribute and the productId attribute of the Basket object passed in.
An exception is thrown if the product options no longer exist.

Parameters:
item -
priceId -
languageId -
a2bOptions -
Throws:
java.lang.Exception


Copyright © 2011 DS Data Systems UK Ltd.