public class AdminAbandonedCartBatchMgr extends AdminBatchBaseMgr
AdminBatchBaseMgr.CustTagCounter
AdminBaseMgr.StaticData
log
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, debugStackTraceExclusions, kkAdminPropsFilePath, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir
Constructor and Description |
---|
AdminAbandonedCartBatchMgr(KKAdminIf eng) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
abandonedCartBatch(java.lang.String logName,
java.lang.String appendLogStr,
java.lang.String recordFetchSizeStr,
java.lang.String emailTemplateName,
java.lang.String numEmailThreadsStr,
java.lang.String abandonedNumDaysStr,
java.lang.String promotionName,
java.lang.String couponNumDaysExpiryStr,
java.lang.String sendMultipleCouponsStr)
The purpose of this batch job is to detect when a cart has been abandoned by a registered
customer and to send out an email with a coupon to the customer.
|
private com.konakart.db.KKCriteria |
getExpiredBasketCriteria(int size,
int numDays)
Create a criteria object for reading expired basket records
|
private AdminPromotion[] |
getPromotionsPerName(java.lang.String name)
Returns one or more promotions with name matching the name passed in as a parameter
|
private void |
removeExpiredCoupons(java.io.BufferedWriter bw,
int promotionId,
com.konakart.db.KKCriteria selectCrit,
com.konakart.db.KKCriteria updateCrit,
int couponNumDaysExpiry,
int recordFetchSize)
Removes all coupons connected to the promotion that have expired.
|
private boolean |
sendAbandonedCartEmail(java.io.BufferedWriter bw,
AdminCustomerMgrIf custMgr,
AdminOrderMgrIf orderMgr,
AdminPromotionMgrIf prmMgr,
int customerId,
AdminPromotion promotion,
java.lang.String templateName,
int couponNumDaysExpiry,
boolean sendMultipleCoupons,
com.konakart.db.KKCriteria selectCrit,
com.konakart.db.KKCriteria updateCrit,
java.util.concurrent.ExecutorService executor)
private method to create and insert a coupon code and send an email to the customer with the
code.
|
ensureCustomerTagIsPresent, getAdEngConf, getAdminJsonEngine, getBatchLogName, getBoolean, getCustomerTagsHash, getInt, getIntArray, getIntArray, getLiteCustomerCriteria, getLiteCustomers, getLogName, getOrders, getSkuForProduct, insertOrUpdateCustomerTag, trimMultiTag, validateTemplate
addInsertAttr, addInsertAttr, addStringRuleConstraint, addStringRuleConstraint, checkAPICallEnabled, checkIntInRange, checkIntIsSet, checkRequired, executeQuery, executeQuery, getAdminAddressMgr, getAdminAuditMgr, getAdminBillingMgr, getAdminBookableProductMgr, getAdminCatMgr, getAdminConfigMgr, getAdminContentMgr, getAdminCurrMgr, getAdminCustMgr, getAdminCustPwdHistMgr, getAdminCustTagMgr, getAdminEmailMgr, getAdminEng, getAdminEngineCacheMgr, getAdminEventMgr, getAdminExecuteMgr, getAdminFileMgr, getAdminFilterMgr, getAdminHtmlMgr, getAdminImportMgr, getAdminLanguageMgr, getAdminManuMgr, getAdminMessageMgr, getAdminMiscItemMgr, getAdminMiscPriceMgr, getAdminModulesMgr, getAdminMultiStoreMgr, getAdminOrderMgr, getAdminPdfMgr, getAdminProdAttrMgr, getAdminProdMgr, getAdminPromMgr, getAdminReviewMgr, getAdminSearchRuleMgr, getAdminSecMgr, getAdminServletMgr, getAdminShipmentMgr, getAdminSolrMgr, getAdminStoreMgr, getAdminSuggestionMgr, getAdminTagMgr, getAdminTaxMgr, getAdminValidationMgr, getAdminVelocityContextMgr, getAdminWishListMgr, getBooleanFromString, getDebugStackTraceExclusions, getEmailThreadGracefulShutdownTimeout, getExportMgr, getExportMgr, getExportXMLData, getIntFromString, getKkAdminPropsFilePath, getKkConfig, getKkInstanceId, getMode, getModeString, getMqMgr, getNewCriteria, getNewCriteria, getNewCriteria, getNewCriteria, getOtherModuleByName, getPostSearchText, getPreSearchText, getProductsToCategoresCriteria, getPropertyValue, getPropertyValue, getPropertyValueAsBool, getPropertyValueAsInt, getPropertyValueAsLong, getRecordCount, getRecordCount, getRewardPointMgr, getSingleIntResult, getStoreId, getTemplate, getTemplateBase, getXml_io, init, insertKKEvent, insertKKEvent, isBusiness, isBusinessOrEnterprise, isCommunity, isConfigSet, isEnterprise, isMultiStoreLanguagesShared, isMultiStoreMode, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareCustomersOrProducts, isMultiStoreShareProducts, isMultiStoreSingleDBCSMode, isMultiStoreSingleDBMode, isMultiStoreSingleDBNonCSMode, isUnix, isWindows, manageException, manageThrowable, refreshConfigs, removeCData, sendMQMessages, setAdminEng, setDebugStackTraceExclusions, setKkAdminPropsFilePath, setupWildCardRules, setWildCardAfter, setWildCardBefore, shutdownGracefully, shutdownGracefully, timestampStr, updateStaticVariablesNow
public AdminAbandonedCartBatchMgr(KKAdminIf eng) throws java.lang.Exception
eng
- the engjava.lang.Exception
- an unexpected exceptionpublic java.lang.String abandonedCartBatch(java.lang.String logName, java.lang.String appendLogStr, java.lang.String recordFetchSizeStr, java.lang.String emailTemplateName, java.lang.String numEmailThreadsStr, java.lang.String abandonedNumDaysStr, java.lang.String promotionName, java.lang.String couponNumDaysExpiryStr, java.lang.String sendMultipleCouponsStr) throws java.lang.Exception
The email template must exist in all available locales since the country code from the customer's locale is used. If the customer's locale has not been set, then the country code of the default language is used.
logName
- The name of the log which shouldn't include the path or extension. i.e. It should
be myLog rather than /logs/myLog.txt.appendLogStr
- If set to false, a new log will be created every time the batch job is run.
Otherwise new data will be appended to the existing log. It defaults to false. The
old log is overwritten if the name is the same.recordFetchSizeStr
- It the batch involves reading many records in a loop, this determines the maximum
number read in any one loop. It defaults to 100.emailTemplateName
- The name of the eMail template if the batch involves sending eMails to customers.
The name should not include the extension or the underscore+country code. i.e. It
should be myTemplate rather than myTemplate_en.vm. The country code and file
extension will be added automatically.numEmailThreadsStr
- If the batch involves sending eMails to customers, this determines how many eMail
sender threads are used. It defaults to 5.abandonedNumDaysStr
- The number of days that need to have passed before a mail is sent. The granularity
of the timing is to the day rather than considering 24 hours. e.g. If set to one,
and the batch job is run today, then a mail is sent out for a cart abandoned any
time yesterday.promotionName
- If the name contains the name of a valid promotion, then a coupon is generated
(which by default can only be used once), attached to the promotion and sent to
the customer in the email.couponNumDaysExpiryStr
- The coupon is deleted from the database once this number of days has passed. If
the string doesn't contain a valid positive number, the coupon is never deleted.sendMultipleCouponsStr
- If set to true the customer may receive more than one active coupon. e.g. The
customer has abandoned cart items so a coupon is sent out. A customer adds new
cart items without checking out, so a new coupon is sent. If set to false, we
check whether the customer already has an active coupon for the promotion before
sending out a new one. The default is false.java.lang.Exception
- an unexpected exceptionprivate com.konakart.db.KKCriteria getExpiredBasketCriteria(int size, int numDays)
size
- the sizenumDays
- the numDaysprivate AdminPromotion[] getPromotionsPerName(java.lang.String name) throws com.workingdogs.village.DataSetException, org.apache.torque.TorqueException
name
- the namecom.workingdogs.village.DataSetException
- an unexpected exception due to data in Torque (the database layer)org.apache.torque.TorqueException
- an unexpected exception in Torque (the database layer)private boolean sendAbandonedCartEmail(java.io.BufferedWriter bw, AdminCustomerMgrIf custMgr, AdminOrderMgrIf orderMgr, AdminPromotionMgrIf prmMgr, int customerId, AdminPromotion promotion, java.lang.String templateName, int couponNumDaysExpiry, boolean sendMultipleCoupons, com.konakart.db.KKCriteria selectCrit, com.konakart.db.KKCriteria updateCrit, java.util.concurrent.ExecutorService executor) throws java.lang.Exception
bw
- the bwcustMgr
- the custMgrorderMgr
- the orderMgrprmMgr
- the prmMgrcustomerId
- the customerIdpromotion
- We pass the promotion rather than the promotionId because this gives you the
option of adding promotion details to the email.templateName
- the templateNamecouponNumDaysExpiry
- the couponNumDaysExpirysendMultipleCoupons
- the sendMultipleCouponsselectCrit
- the selectCritupdateCrit
- the updateCritexecutor
- the executorjava.lang.Exception
- an unexpected exceptionprivate void removeExpiredCoupons(java.io.BufferedWriter bw, int promotionId, com.konakart.db.KKCriteria selectCrit, com.konakart.db.KKCriteria updateCrit, int couponNumDaysExpiry, int recordFetchSize) throws java.lang.Exception
bw
- the bwpromotionId
- the promotionIdselectCrit
- the selectCritupdateCrit
- the updateCritcouponNumDaysExpiry
- the couponNumDaysExpiryrecordFetchSize
- the recordFetchSizejava.lang.Exception
- an unexpected exceptionCopyright © 2018 DS Data Systems UK Ltd.