Forum

Thread tagged as: Problem, Shop

Order with custom status not saved

Hello,

I'm trying to checkout with custom status that I've created. I've followed directions in https://forum.grabaperch.com/forum/08-11-2016-account-only-customers-order-status but with the manually created status, the order doesn't save nor throw any errors. Predefined statuses work fine. My status has index 110, but I've tried less and more. Thanks for help!

perch_shop_checkout('manual', array(
            'status' => 'created_pending_payment',
            'return_url' => '/order',
            'cancel_url' => '/order-failed'
        ));
Jiri Zavadil

Jiri Zavadil 0 points

  • 5 years ago

just found out that only the predefined statuses above index 100 work - "created" and "payment_failed" have the same issue

Drew McLellan

Drew McLellan 2638 points
Perch Support

What do you mean by save? If the status is <100 then it's not seen as a completed order yet.

I meant stored in database and visible in admin Order listing with the manually set status. The order just evaporates.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I feel like I'm being annoying asking for clarification again, but 'evaporates'? Does the row exist and then get deleted, or is it not created? It would really help if you could be as clear as possible.

Sorry, it's totally fine, I just didn't sleep today.

I put items in cart -> log in / fill member forms -> checkout with the snippet above and get a blank screen. No errors in php log, no order in admin, no order in database. This happens with manually set status created(index 0), payment failed(50) and my created_pending_payment (110)

Repeating the exact same steps with manually set statuses paid (125), processing (150), cancelled (200), dispatched (250), returned (300), partial_refund (350), refunded (400) creates new order in db and admin

I hope I've explained it better this time :)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the blank screen like a page is loaded that has nothing on it, or is an error being thrown that isn't being logged properly?

Are you able to turn on debug and get any output at that point?

Hello Drew,

sorry for the delay. I was checking if the order was perch_shop_order_successful() which also checks if $Order->is_paid() in /addons/apps/perch_shop/runtime/orders.php so it wasn't returning anything.

The orders are correctly saved to database.

However, they are not listed in admin, because they are checked for $Statuses->get_status_and_above('paid') in /addons/apps/perch_shop_orders/modes/orders.list.pre.php

which is cumbersome when you're using the manual gateway for handling the payment as cash on delivery after the order is dispatched. :)

also, I'm unable to list perch_shop_order_items(perch_shop_successful_order_id()), because of $Statuses->get_status_and_above('paid') in /addons/apps/perch_shop/lib/PerchShop_Orders.class.php

Drew McLellan

Drew McLellan 2638 points
Perch Support

Perhaps the solution is to add a new status for when the balance is paid on delivery.

That's what I did, but to keep the logical flow of the order, it needs to have an index lower than 'paid', because the order is paid after it's created, processed and dispatched.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Sure, sounds fine.

... and when i create an order with status index lower than paid, the order is hidden in administration.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's right - the order isn't complete until it's hit the paid status, or one above it.

Yeah, but how can it hit the paid status until the shop owner dispatches it and customer pays for it? The owner never sees it.

This flow only works for online payments - when shop owner doesn't care about the order until it's paid.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's an ecommerce system, so yes, it's designed for online payments. If you need to have another payment stage later in the process then you have the ability to add that.

Okay, another model situation: When online payment fails for whatever reason, the shop owner will never ever know about such order until customer tells him, because the order won't list in admin. So he may lose $$$ while not knowing about it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that's normal. It's not uncommon to have a great many incomplete orders. Customers abandon the process at various stages all the time.

If a payment fails, there's a status for that.