Jump to content

Get order details with date


NicolaiFriis

Recommended Posts

Hello. 
Is there any way to get all orders with a specific status and the status update datetime? 

Order::getOrderIdsByStatus(5); returns all orders with status "closed"
OrderDetail::getList($orders[10]);  gives me the details on the orders above, but without a datetime parameter. 

I only want to get the orders which has been "Closed" within the last hour or so. 

Any ideas?

Link to comment
Share on other sites

yes its possible, for this you can use the variable invoice_date

$sql = "SELECT * FROM ps_orders WHERE current_state = $state AND invoice_date < $date";

you can also make the condition base on different date variable

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
On 6/22/2020 at 7:20 PM, Razi said:

yes its possible, for this you can use the variable invoice_date

$sql = "SELECT * FROM ps_orders WHERE current_state = $state AND invoice_date < $date";

you can also make the condition base on different date variable

Is there a way to do it by just calling a method of Order class/object?

I need all orders with a certain status newer than a certain date.

I know how to do it in SQL, but I'm trying to figure out if it can be done purely within the code?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...