#3637 - Cart accumulation and breadcrumb bugs
| Identifier | #3637 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | Cart accumulation and breadcrumb bugs |
| Status | Completed |
| Handling member | Chris Graham |
| Addon | shopping |
| Description | Added a test product and clicked Buy. The item is added to the cart. Whenever I visit the shopping cart page (using the main menu) it seems to add another entry (and order ID) into the my order page (again I visited this page using the main menu). I now have 7 entries awaiting payment and no option to delete any of them from the orders page (despite being logged in as admin, so I assume the member cannot delete orders from this page, though of course they likely wouldn't need to if not for this bug).
Additionally clicking on an order number from the my orders presents a breadcrumb which links back to 'orders' which cannot be found as the page name is 'my_orders'. |
| Steps to reproduce | |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
(Click to enlarge)
1) Breadcrumb issues - solved, including some I also found in the Admin Zone, along with an issue with a bad <title> on the shopping cart.
2) Also fixed that order cancellation option showed for already cancelled orders in Admin Zone.
3) I have made it smarter about clearing out old orders.
a) If you explicitly cancel your order from the payment gateway, it actually will now do less order cleaning up, only cleaning out orders that are over a week old. It won't actually delete that order now. So this goes against what you are suggesting, but it's important because there's nothing stopping someone clicking back to get back to the payment gateway then deciding to proceed. And that would result in a payment with no matching order, not good!
b) Additionally when old orders are cleaned up, if there are notes on that order it won't now delete them, but cancel them.
c) However, when refreshing the cart it will still create duplicate orders. This is necessary because the order has to be created immediately, as the payment gateway buttons are directly embedded on the cart.
i) It is perfectly possible for someone to open the cart, pay, the payment to be delayed coming back to the site then refresh - so we can't delete the pending order and recreate because it might have a payment coming soon (we can't allow a payment not matched with an order).
ii) ... and we can't just keep the same order open in the cart either for the same reason (we can't allow double purchase by letting them click pay on that order twice).
iii) we could probably try and track that an exact same order exists and reset to an empty cart, or show an error message. But we don't know that existing order was actually carried through to payment.
d) It will however delete pending orders more than a week old when refreshing the cart.
I think the proper solution to '3c' would be to not have payment gateway buttons direct on the cart, but to pass through an interstitial page - which would create the order and clear the cart. However that's adding further complexity, and the cart is meant for very simple use cases. i.e. selling T-shirts and mugs, not running a sophisticated store. It may also be a violation of the T&Cs of payment gateways who want you to use their code and logos in a specific way.
Just think of any time you going to the cart as the 'checkout' step, and any changes to the contents of the cart, or going back to the checkout, is creating a new order. Just we can't clear out the old one as we can't track what might have happened on the payment gateway end prior to a payment finishing being processed.