on 01-23-2019 1:13 PM
We are using a 6.3 version b2c. When a user adds products to cnd they are moved to unapproved status later on, when the user tries to access the cnd try to checkout, it is throwing a 404 error.
For this I made some changes by removing the unapproved products from the cart data wherever we are accessing the cartdata object. But while placing the order in placeorder method of SummaryCheckoutStepController.java, it is taking me back to the cart page and saying the product is removed and when I try to place order this time, it throws a null pointer.
Which is a better way to handle this scenario? How can I remove the unapproved products from cart when the user comes to the cart page and then after the order can be placed successfully?
use this at the beginning of the cart method
if (validateCart(redirectModel))
{
return redirectToCartPage();
}
protected boolean validateCart(final RedirectAttributes redirectModel)
{
//Validate the cart
List<CartModificationData> modifications = new ArrayList<>();
try
{
modifications = cartFacade.validateCartData();
}
catch (final CommerceCartModificationException e)
{
LOG.error("Failed to validate cart", e);
}
if (!modifications.isEmpty())
{
redirectModel.addFlashAttribute("validationData", modifications);
// Invalid cart. Bounce back to the cart page.
return true;
}
return false;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.