-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reimplement User Cart Revise Cancellation #2166
Comments
@dpfaffenbauer Is there a reason why this has been removed? Otherwise, we could provide an PR which implements the original behavior. |
@solverat It never was implemented with the new Order Flow. How would you implement it? |
@dpfaffenbauer: I just tested it via this roughly implemented snippet: if ($cancelButton instanceof ClickableInterface && $form->isSubmitted() && $cancelButton->isClicked()) {
if ($order instanceof Concrete) {
$this->get(HistoryLogger::class)->log(
$order,
'User Cart Revise Cancellation'
);
}
$order->setSaleState(OrderSaleStates::STATE_CART);
$this->get('coreshop.cart.manager')->persistCart($order);
$request->getSession()->set(
sprintf('%s.%s', 'coreshop.cart', $order->getStore()->getId()),
$order->getId()
);
return $this->redirectToRoute('coreshop_cart_summary');
} Which just will bring back the user's cart. Of course, this snippet should:
BTW: While testing this, I found some orphans:
|
Let's think about the consequences of reseting the state instead of creating a new cart:
Not sure if it woudl be better to create a new cart and populate it with the same items. Sort of similar like it was with CS 2 |
In CS2, the original cart object has been re-assigned, so it was a bit easier. However, creating a new cart object leads to the same problem you've mentioned (second item of your list). What if the cart has been populated with other data (additional fields during the checkout, for example)? I still think, the re-assignment is the better way to go. I admit, the Order-Number could be an issue, so resetting that field would solve that. Everything else can be ignored: The order is still invalid at this point. Also: The workflow will trigger again. |
No, that is not what I meant. The O1 Number will never be reassigned and there is no order then. Once a Order has a Order Number it should stay an Order. My suggestion: Copy the Order and make it a cart. Then additional Data is also copied. |
Ah, I forgot about the sequence generator. Well, yes, cloning the object is the only way to go. |
Same Problem here. Is there a solution for this yet? |
@hSpille has not been implemented on our end |
Maybe the order could just have its state switched back to |
@m0nken I don't really like that, since the Order should get cancelled so the number isn't missing. What if the User never checks out? The Order O0010 would then be missing and never be found. It honestly shouldn't be too difficult, just take the OrderItems, Copy them, and attach them to a new Cart. |
@dpfaffenbauer Good point! Just wanted to check if that could have been an option. |
Now
CoreShop/src/CoreShop/Bundle/FrontendBundle/Controller/OrderController.php
Line 66 in c4ddac0
Original
CoreShop/src/CoreShop/Bundle/FrontendBundle/Controller/OrderController.php
Lines 75 to 100 in 100b1b3
The text was updated successfully, but these errors were encountered: