Change/ update order with new payment
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Change/ update order with new payment
Hi
Currently in Aimeos , if you are in checkout and you selected for example Paypal , it creates an order ID and redirects you to Paypal , but what I noticed if you cancel and it takes you back to the confirmation page where you can change the payment, if you click on change payment , it will take you to select a new payment , if I selected a different payment I noticed that Aimeos Creates a NEW order ID for that new payment.
MY Question: Is there away to have it where we can Updates the same OrderID which is stored in the session with the NEW payment without creating a whole new order?
I am looking at this code with is in Payment.php class:
How we could do that is it possible?
Currently in Aimeos , if you are in checkout and you selected for example Paypal , it creates an order ID and redirects you to Paypal , but what I noticed if you cancel and it takes you back to the confirmation page where you can change the payment, if you click on change payment , it will take you to select a new payment , if I selected a different payment I noticed that Aimeos Creates a NEW order ID for that new payment.
MY Question: Is there away to have it where we can Updates the same OrderID which is stored in the session with the NEW payment without creating a whole new order?
I am looking at this code with is in Payment.php class:
Code: Select all
$orderId = $context->getSession()->get( 'aimeos/orderid' );
$orderItem = $orderCntl->getItem($orderId,false);
// can we update the PAYMENT HERE? which function will update the order with new payment
Re: Change/ update order with new payment
It would be easier to delete the existing order and create a new one from the basket in the session because after the payment option changes, the basket total and the records in the mshop_order_base_service table needs to be replaced:
https://github.com/aimeos/ai-client-htm ... d.php#L273
https://github.com/aimeos/ai-client-htm ... d.php#L273
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Change/ update order with new payment
Sounds like s good idea
but how do we delete the order? I cant find a function that would delete the order by the orderid?
but how do we delete the order? I cant find a function that would delete the order by the orderid?
Re: Change/ update order with new payment
There's no controller method for this but you can use the order managers directly:
Afterwards, the complete order is gone. If you have the order base ID, you only need the last line.
Code: Select all
$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
$order = $manager->getItem( $orderId );
\Aimeos\MShop\Factory::createManager( $context, 'order/base' )->deleteItem( $order->getBaseId() );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Change/ update order with new payment
Great
Thanks
Thanks