Order price, cost, rebate set to 0 after setting payment status

Help for integrating the Laravel package
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!
bar_on
Posts: 15
Joined: 28 Jul 2024, 01:45

Order price, cost, rebate set to 0 after setting payment status

Post by bar_on » 24 Mar 2025, 06:06

Code: Select all

$manager = MShop::create($context, 'order');
$order   = $manager->get($orderId);
$order->setStatusPayment(4)
Before I set the payment the order has its price, costs and rebate. After setting it in a custom frontend controller, the data returned are 0.

Before:

Code: Select all

"order.price": "450.00",
            "order.costs": "55.00",
            "order.rebate": "0.00",
After:

Code: Select all

"order.price" => "0.00"
    "order.costs" => "0.00"
    "order.rebate" => "0.00"
I want to keep the original order data so that I can retrieve the price after payment. Thanks.

Version:
"aimeos/aimeos-laravel": "~2023.10",
"php": "^8.1.0",

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Order price, cost, rebate set to 0 after setting payment status

Post by aimeos » 24 Mar 2025, 14:20

Add "->off()" to the order item to avoid the basket plugins to modify the order if you change something:

Code: Select all

$manager = MShop::create($context, 'order');
$order   = $manager->get($orderId)->off();
$order->setStatusPayment(4);
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

bar_on
Posts: 15
Joined: 28 Jul 2024, 01:45

Re: Order price, cost, rebate set to 0 after setting payment status

Post by bar_on » 24 Mar 2025, 18:47

Order price is still set to 0 after this change.
This is the payment status and order total before payment intent was created (custom controller).
Screenshot 2025-03-24 at 11.38.58 AM.png
Screenshot 2025-03-24 at 11.38.58 AM.png (57.69 KiB) Viewed 27563 times
Screenshot 2025-03-24 at 11.38.45 AM.png
Screenshot 2025-03-24 at 11.38.45 AM.png (104.37 KiB) Viewed 27563 times
This is after the payment intent was created.
Screenshot 2025-03-24 at 11.39.51 AM.png
Screenshot 2025-03-24 at 11.39.51 AM.png (97.37 KiB) Viewed 27563 times
Screenshot 2025-03-24 at 11.39.55 AM.png
Screenshot 2025-03-24 at 11.39.55 AM.png (85.37 KiB) Viewed 27563 times
The problem doesn't happen if I manually change the payment status in jqadm platform, but when I call

Code: Select all

$order->setStatusPayment(4);
$manager->save($order);
in backend,
all the prices will be set to 0.

The entire code is as follows:

Code: Select all

$context = app('aimeos.context')->get();
    	$manager = MShop::create($context, 'order');
        $order   = $manager->get($orderId)->off();
        $order->setStatusPayment(4); // set pending status
        $manager->save($order);
I think there's problem on function setStatusPayment, or manager->save(), but I'm not sure how to proceed, thanks!

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Order price, cost, rebate set to 0 after setting payment status

Post by aimeos » 25 Mar 2025, 12:32

Payment status is set here:
https://github.com/aimeos/aimeos-core/b ... d.php#L241

Saving the item is done there:
https://github.com/aimeos/aimeos-core/b ... d.php#L615

There's no code executed with sets the price of the order to 0.00. Can you check what happens in that methods in your case?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply