zion Posted January 21, 2021 Share Posted January 21, 2021 (edited) 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 January 21, 2021 by anderrios (see edit history) Link to comment Share on other sites More sharing options...
Siphaxzer Posted October 14, 2023 Share Posted October 14, 2023 Hi, hope fix your problem, can you give us the correct link of calling APi Link to comment Share on other sites More sharing options...
Yelish Posted October 18, 2023 Share Posted October 18, 2023 Hello, how are you? You're using a string comparison, not a date comparison. STRCMP() is a string function, so it converts idate to a string in 'YYYY-MM-DD' format and performs a string comparison. It does not convert '20030505' to the date '2003-05-05' and perform a date comparison. I hope this helps you. Best regards, and have a great day! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now