[MSHOP-194] resetShoppingCart() should not be called from the template but from the form processor Created: 01/Jul/15  Updated: 15/Jul/15  Resolved: 15/Jul/15

Status: Resolved
Project: Magnolia Shop (closed)
Component/s: None
Affects Version/s: 2.2
Fix Version/s: 2.3.0

Type: Improvement Priority: Neutral
Reporter: Will Scheidegger Assignee: Will Scheidegger
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 Description   

After the checkout is finished, the session variable containing the shopping cart should be reset. The ShopSingletonParagraphTemplateModel.resetShoppingCart() method is currently called from an ftl template. Besides the fact that the UI should contain close to zero business logic, it has more disadvantages:

  • what if the user closes the browser early? (template might still be rendered?)
  • what if a rendering error occurs?
  • what if the template gets modified, exchanged and the call is forgotten?
  • what if some other templating technology is used?

The proper place to reset the shopping cart is probably in the processor chain itself (as last task).



 Comments   
Comment by Will Scheidegger [ 15/Jul/15 ]

Spending some more thought on this I think resetting the shopping cart should be part of the SaveAndConfirmFormProcessor.

  • IF saving of the shopping cart was successful, it should be reset.
  • IF it was NOT successful, it should not be reset.

Therefore it makes sense to do this at this point.

To have the shopping cart available for the following form processors (order mail, confirmation mail...) and possibly the confirmation page, the cart should be moved to a new session variable: [shop name]_lastShoppingCart
Of course the other processors will need to reflect this change.

Comment by Will Scheidegger [ 15/Jul/15 ]

Shopping cart now reset when cart is solved

Generated at Mon Feb 12 07:10:16 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.