cart
cart copied to clipboard
Don't empty cart while developing
While developing is useful to not empty the cart after a order is created to save some time by example when testing payments.
I tried setting preventClearCart
in the payment Typoscript setup and the cart doesn't empty but then, when I create another order, I get this error You can not redeclare the order number of your cart.
What I understood is that the error is produced because the new generated order number is different from the one stored in php session that is the first generated order number.
This is correct. A cart saves the generated order number. If you make another order with the same cart, it already has an order number. A possible solution is, to remove the finisher (https://github.com/extcode/cart/blob/master/Configuration/TypoScript/setup.typoscript#L60-L62) in development mode, so that no order number will be generated, or you can replace this finisher with your own implementation and check the cart if an order number is already given.
Ok thanks, I'll try to unset the OrderNumberFinisher.
Another maybe possible solution is to change the condition to allow developer to cheat the order number check like this:
$applicationContext = GeneralUtility::getApplicationContext();
if (($this->orderNumber) && ($this->orderNumber !== $orderNumber) && !$applicationContext->isDevelopment()) {
throw new \LogicException(
'You can not redeclare the order number of your cart.',
1413969668
);
}
but I'm not sure if this won't create problems elsewhere.
@extcode As I can see this issue seems to be solved with your answer and the feedback from the author. I suggest closing this ticket!?