Jump to content

[API WebService] get orders sorted by date

Recommended Posts

Hello, I am developing a website to receive orders from several prestashop.
I bring the orders from php with;

$ opt = [
                     'resource' => 'orders',
                     'display' => '[id, reference, total_paid, id_customer, id_cart, id_address_delivery, current_state, payment, date_add]',
                     'sort' => '[id_DESC]',
                     'limit' => '10'
             $ xml = $ webService-> get ($ opt);
             $ resources = $ xml-> orders-> children (); 

I have tried to change the sort to "date_add_DESC" but it does not return anything.
I have thought about ordering the array when I have filled it with php's usort () function,

            usort($ArrayPedidos, function ($a, $b) {
                return strcmp($a["fecha"], $b["fecha"]);

but I can't, any help would be good for me. thanks.


Edited by anderrios (see edit history)

Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More