use of com.salesmanager.shop.populator.shoppingCart.ShoppingCartDataPopulator in project shopizer by shopizer-ecommerce.
the class ShoppingCartFacadeImpl method getShoppingCartData.
@Override
public ShoppingCartData getShoppingCartData(final Customer customer, final MerchantStore store, final String shoppingCartId, Language language) throws Exception {
ShoppingCart cart = null;
try {
if (customer != null) {
LOG.info("Reteriving customer shopping cart...");
cart = shoppingCartService.getShoppingCart(customer);
} else {
if (StringUtils.isNotBlank(shoppingCartId) && cart == null) {
cart = shoppingCartService.getByCode(shoppingCartId, store);
}
}
} catch (ServiceException ex) {
LOG.error("Error while retriving cart from customer", ex);
} catch (NoResultException nre) {
// nothing
}
if (cart == null) {
return null;
}
// if cart has been completed return null
if (cart.getOrderId() != null && cart.getOrderId().longValue() > 0) {
if (StringUtils.isNotBlank(shoppingCartId) && !(shoppingCartId.equals(cart.getShoppingCartCode()))) {
cart = shoppingCartService.getByCode(shoppingCartId, store);
} else {
return null;
}
}
LOG.info("Cart model found.");
ShoppingCartDataPopulator shoppingCartDataPopulator = new ShoppingCartDataPopulator();
shoppingCartDataPopulator.setShoppingCartCalculationService(shoppingCartCalculationService);
shoppingCartDataPopulator.setPricingService(pricingService);
shoppingCartDataPopulator.setimageUtils(imageUtils);
// Language language = (Language) getKeyValue( Constants.LANGUAGE );
MerchantStore merchantStore = (MerchantStore) getKeyValue(Constants.MERCHANT_STORE);
ShoppingCartData shoppingCartData = shoppingCartDataPopulator.populate(cart, merchantStore, language);
return shoppingCartData;
}
use of com.salesmanager.shop.populator.shoppingCart.ShoppingCartDataPopulator in project shopizer by shopizer-ecommerce.
the class CustomerRegistrationController method populateShoppingCartData.
private ShoppingCartData populateShoppingCartData(final ShoppingCart cartModel, final MerchantStore store, final Language language) {
ShoppingCartDataPopulator shoppingCartDataPopulator = new ShoppingCartDataPopulator();
shoppingCartDataPopulator.setShoppingCartCalculationService(shoppingCartCalculationService);
shoppingCartDataPopulator.setPricingService(pricingService);
try {
return shoppingCartDataPopulator.populate(cartModel, store, language);
} catch (ConversionException ce) {
LOGGER.error("Error in converting shopping cart to shopping cart data", ce);
}
return null;
}
use of com.salesmanager.shop.populator.shoppingCart.ShoppingCartDataPopulator in project shopizer by shopizer-ecommerce.
the class CustomerLoginController method populateShoppingCartData.
private ShoppingCartData populateShoppingCartData(final ShoppingCart cartModel, final MerchantStore store, final Language language) {
ShoppingCartDataPopulator shoppingCartDataPopulator = new ShoppingCartDataPopulator();
shoppingCartDataPopulator.setShoppingCartCalculationService(shoppingCartCalculationService);
shoppingCartDataPopulator.setPricingService(pricingService);
try {
return shoppingCartDataPopulator.populate(cartModel, store, language);
} catch (ConversionException ce) {
LOG.error("Error in converting shopping cart to shopping cart data", ce);
}
return null;
}
Aggregations