public class BasketMgr extends BaseMgr implements BasketMgrIf
Modifier and Type | Class and Description |
---|---|
protected class |
BasketMgr.OptionSortOrderComparator
Used to sort the Option objects based on option id
|
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
log
the log
|
templateBaseDir
Modifier and Type | Method and Description |
---|---|
protected int |
addToBasket(int customerId,
Basket item,
AddToBasketOptionsIf options)
We must take the information passed into the method and create a customers_basket record as
well as one or more customers_basket_attributes records.
|
int |
addToBasket(java.lang.String sessionId,
int customerId,
BasketIf item)
Determines the customerId to use and calls the protected 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().
|
protected void |
checkBasketBelongsToCustomer(int customerId,
int basketId)
Throws an exception if the basket item doesn't belong to the customer.
|
protected void |
checkBasketOptions(Basket b)
We may have the case where the basket object has an array of options that only have the id
and value id set.
|
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.
|
protected FetchProductOptionsIf |
createFetchProductOptions(AddToBasketOptionsIf options)
Creates a FetchProductOptions object from an AddToBasketOptions
|
Option |
findOptionInProduct(ProductIf p,
Option o)
The basket object must have a populated product object with options.
|
protected Basket |
getBasket(int basketId)
Used to get a basket object using the primary key
|
Basket[] |
getBasketItemsPerCustomer(java.lang.String sessionId,
int customerId,
int languageId)
Get the basket items for a customer.
|
protected Basket[] |
getBasketItemsPerCustomerWithOptions(int customerId,
Address customerAddr,
int languageId,
AddToBasketOptionsIf options)
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.
|
protected Basket[] |
getBasketItemsPerEncodedProductAndCustomer(int customerId,
java.lang.String encodedProduct)
This is used to see if a product that we are adding to the basket already exists in it.
|
protected int |
getCustomerId(java.lang.String sessionId,
int customerId)
If the sessionId is null, we check the customerId to ensure that it is negative.
|
Option[] |
getOptsForBasketItem(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.
|
protected boolean |
isEnhancedVariantHandlingModeEnabled() |
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.
|
protected void |
removeBasketItemsPerCustomer(int customerId)
We delete all basket items that exist for the customer passed in as a parameter.
|
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 protected method.
|
protected void |
removeFromBasket(int customerId,
BasketIf item)
We must remove the customers_basket record and any associated customers_basket_attributes
records.
|
void |
removeFromBasket(java.lang.String sessionId,
int customerId,
BasketIf item)
We must remove the customers_basket record and any associated customers_basket_attributes
records.
|
protected void |
setCriteriaWithStandardAttributes(KKCriteria c,
AddToBasketOptionsIf options)
Sets the criteria with the standard attributes so as not to have to repeat this code many
times.
|
protected void |
updateBasket(int customerId,
Basket item,
AddToBasketOptionsIf options)
We must update the customers_basket record.
|
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.
|
acquireLock, addInsertAttr, addInsertAttr, addStringRuleConstraint, addStringRuleConstraint, checkRequired, escapeHTML, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, getAdminEngMgr, getBasketMgr, getBillingMgr, getBookableProductMgr, getCacheMgr, getCatMgr, getConfigMgr, getCookieMgr, getCurrMgr, getCustMgr, getCustomerIdFromSession, getCustomerStatsMgr, getCustomerTagMgr, getEmailMgr, getEng, getEventMgr, getExportMgr, getHTMLEscaper, getKonaKartConfig, getKonaKartConfig, getKonaKartConfig, getLangMgr, getManuMgr, getMiscItemMgr, getMiscPriceMgr, getMode, getModeString, getMqMgr, getMultiStoreMgr, getNewCriteria, getNewCriteria, getOrderIntegrationMgr, getOrderMgr, getOrderTotalMgr, getPaymentMgr, getProdMgr, getProductsToCategoresCriteria, getPromMgr, getPunchOutMgr, getRewardPointMgr, getSecMgr, getShippingMgr, getSolrMgr, getStoreId, getStoreMgr, getStoreTime, getSuggestionMgr, getTaxMgr, getTemplate, getTemplateRoot, getVelocityContextMgr, getWishListMgr, init, insertKKEvent, insertKKEvent, isBusiness, isBusinessOrEnterprise, isClassPresent, isCommunity, isDeadlockException, isEnterprise, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareCustomersOrProducts, isMultiStoreSharedDb, isMultiStoreShareProducts, isMultiVendor, isUnix, manageThrowable, releaseLock, updateStaticVariablesNow
public BasketMgr(KKEngIf eng) throws java.lang.Exception
eng
- the engjava.lang.Exception
- an unexpected exceptionpublic Basket[] getBasketItemsPerCustomer(java.lang.String sessionId, int customerId, int languageId) throws java.lang.Exception
getBasketItemsPerCustomer
in interface BasketMgrIf
sessionId
- the sessionIdcustomerId
- the customerIdlanguageId
- the languageIdjava.lang.Exception
- an unexpected exceptionpublic Basket[] getBasketItemsPerCustomerWithOptions(java.lang.String sessionId, int customerId, int languageId, AddToBasketOptionsIf options) throws java.lang.Exception
getBasketItemsPerCustomerWithOptions
in interface BasketMgrIf
sessionId
- the sessionIdcustomerId
- the customerIdlanguageId
- the languageIdoptions
- the optionsjava.lang.Exception
- an unexpected exceptionprotected Basket[] getBasketItemsPerCustomerWithOptions(int customerId, Address customerAddr, int languageId, AddToBasketOptionsIf options) throws java.lang.Exception
customerId
- the customerIdcustomerAddr
- the customerAddrlanguageId
- the languageIdoptions
- the optionsjava.lang.Exception
- an unexpected exceptionpublic int addToBasketWithOptions(java.lang.String sessionId, int customerId, BasketIf item, AddToBasketOptionsIf options) throws java.lang.Exception
addToBasketWithOptions
in interface BasketMgrIf
sessionId
- the sessionIdcustomerId
- the customerIditem
- the itemoptions
- the optionsjava.lang.Exception
- an unexpected exceptionpublic int addToBasket(java.lang.String sessionId, int customerId, BasketIf item) throws java.lang.Exception
addToBasket
in interface BasketMgrIf
sessionId
- the sessionIdcustomerId
- the customerIditem
- the itemjava.lang.Exception
- an unexpected exceptionprotected int addToBasket(int customerId, Basket item, AddToBasketOptionsIf options) throws java.lang.Exception
customerId
- the customerIditem
- the itemoptions
- the optionsjava.lang.Exception
- an unexpected exceptionprotected Basket[] getBasketItemsPerEncodedProductAndCustomer(int customerId, java.lang.String encodedProduct) throws org.apache.torque.TorqueException, com.workingdogs.village.DataSetException
customerId
- the customerIdencodedProduct
- the encodedProductorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)protected void checkBasketOptions(Basket b) throws com.konakart.app.KKException
b
- the bcom.konakart.app.KKException
- an unexpected KKException exceptionpublic Option findOptionInProduct(ProductIf p, Option o) throws com.konakart.app.KKException
findOptionInProduct
in interface BasketMgrIf
p
- the po
- the ocom.konakart.app.KKException
- an unexpected KKException exceptionpublic void updateBasket(java.lang.String sessionId, int customerId, BasketIf item) throws com.konakart.app.KKException, com.workingdogs.village.DataSetException, java.lang.Exception
updateBasket
in interface BasketMgrIf
sessionId
- the sessionIdcustomerId
- the customerIditem
- the itemjava.lang.Exception
- an unexpected exceptioncom.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptionpublic void updateBasketWithOptions(java.lang.String sessionId, int customerId, BasketIf item, AddToBasketOptionsIf options) throws com.konakart.app.KKException, com.workingdogs.village.DataSetException, java.lang.Exception
updateBasketWithOptions
in interface BasketMgrIf
sessionId
- the sessionIdcustomerId
- the customerIditem
- the itemoptions
- the optionsjava.lang.Exception
- an unexpected exceptioncom.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptionprotected void updateBasket(int customerId, Basket item, AddToBasketOptionsIf options) throws com.konakart.app.KKException, com.workingdogs.village.DataSetException, java.lang.Exception
customerId
- the customerIditem
- the itemoptions
- the optionsjava.lang.Exception
- an unexpected exceptioncom.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptionpublic void removeBasketItemsPerCustomer(java.lang.String sessionId, int customerId) throws java.lang.Exception
removeBasketItemsPerCustomer
in interface BasketMgrIf
sessionId
- the sessionIdcustomerId
- the customerIdjava.lang.Exception
- an unexpected exceptionprotected void removeBasketItemsPerCustomer(int customerId) throws java.lang.Exception
customerId
- the customerIdjava.lang.Exception
- an unexpected exceptionpublic void removeFromBasket(java.lang.String sessionId, int customerId, BasketIf item) throws java.lang.Exception
removeFromBasket
in interface BasketMgrIf
sessionId
- the sessionIdcustomerId
- the customerIditem
- the itemjava.lang.Exception
- an unexpected exceptionprotected void removeFromBasket(int customerId, BasketIf item) throws java.lang.Exception
customerId
- the customerIditem
- the itemjava.lang.Exception
- an unexpected exceptionpublic void populateOptsForBasketItem(Basket item, int priceId, int languageId, AddToBasketOptionsIf a2bOptions) throws java.lang.Exception
populateOptsForBasketItem
in interface BasketMgrIf
item
- the itempriceId
- the priceIdlanguageId
- the languageIda2bOptions
- the a2bOptionsjava.lang.Exception
- an unexpected exceptionpublic Option[] getOptsForBasketItem(Basket item, int priceId, int languageId, AddToBasketOptionsIf a2bOptions) throws java.lang.Exception
getOptsForBasketItem
in interface BasketMgrIf
item
- the itempriceId
- the priceIdlanguageId
- the languageIda2bOptions
- the a2bOptionsjava.lang.Exception
- an unexpected exceptionpublic java.lang.String createEncodedProduct(int productId, OptionIf[] opts)
createEncodedProduct
in interface BasketMgrIf
productId
- the productIdopts
- the optspublic void mergeBaskets(java.lang.String sessionId, int customerFromId) throws java.lang.Exception
mergeBaskets
in interface BasketMgrIf
sessionId
- the sessionIdcustomerFromId
- the customerFromIdjava.lang.Exception
- an unexpected exceptionpublic void mergeBasketsWithOptions(java.lang.String sessionId, int customerFromId, AddToBasketOptionsIf options) throws java.lang.Exception
mergeBasketsWithOptions
in interface BasketMgrIf
sessionId
- the sessionIdcustomerFromId
- the customerFromIdoptions
- the optionsjava.lang.Exception
- an unexpected exceptionprotected int getCustomerId(java.lang.String sessionId, int customerId) throws java.lang.Exception
sessionId
- the sessionIdcustomerId
- the customerIdjava.lang.Exception
- an unexpected exceptionprotected void checkBasketBelongsToCustomer(int customerId, int basketId) throws org.apache.torque.TorqueException, com.konakart.app.KKException
customerId
- the customerIdbasketId
- the basketIdorg.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)com.konakart.app.KKException
- an unexpected KKException exceptionpublic Basket[] updateBasketWithStockInfo(BasketIf[] basketItems) throws java.lang.Exception
updateBasketWithStockInfo
in interface BasketMgrIf
basketItems
- the basketItemsjava.lang.Exception
- an unexpected exceptionpublic Basket[] updateBasketWithStockInfoWithOptions(BasketIf[] basketItems, AddToBasketOptionsIf options) throws java.lang.Exception
updateBasketWithStockInfoWithOptions
in interface BasketMgrIf
basketItems
- the basketItemsoptions
- the optionsjava.lang.Exception
- an unexpected exceptionprotected FetchProductOptionsIf createFetchProductOptions(AddToBasketOptionsIf options)
options
- the optionsprotected Basket getBasket(int basketId) throws java.lang.Exception
basketId
- the basketIdjava.lang.Exception
- an unexpected exceptionprotected void setCriteriaWithStandardAttributes(KKCriteria c, AddToBasketOptionsIf options)
c
- the coptions
- the AddToBasketOptionsIf optionsprotected boolean isEnhancedVariantHandlingModeEnabled() throws java.lang.Exception
java.lang.Exception
Copyright © 2018 DS Data Systems UK Ltd.