Hamendra Sunthwal Posted August 17, 2020 Share Posted August 17, 2020 I am trying to get all order ids, i am not sure to use function or execute sql query which one is fast considering the performance ? Is their any way get it ? Link to comment Share on other sites More sharing options...
Hamendra Sunthwal Posted August 17, 2020 Author Share Posted August 17, 2020 (edited) I get timeout when i try to change orderstatus in prestashop not sure what is missing. Quote I get timeout when i try to change orderstatus in prestashop not sure what is missing. <?php $sts_id = $_POST['status_id']; $order_box = $_POST['orderBox']; $selected_orders = implode(",", $order_box); $get_orders = 'SELECT id_order FROM `' . _DB_PREFIX_ . 'orders` WHERE id_order in (' . $selected_orders . ') and current_state !=' . $sts_id; $get_order_id = Db::getInstance()->ExecuteS($get_orders); if (count($get_order_id) > 0) { $order_to_convert = array_column($get_order_id, 'id_order'); foreach ($order_to_convert as $odr_id) { $objOrder = new Order($odr_id); $history = new OrderHistory(); $history->id_order = (int) $objOrder->id; $history->changeIdOrderState($sts_id, (int) ($objOrder->id)); } } Quote Edited August 17, 2020 by Hamendra Sunthwal (see edit history) Link to comment Share on other sites More sharing options...
Jeff A Posted August 22, 2020 Share Posted August 22, 2020 I have never had much luck finding any documentation on the data-model - if you do find any, share the URL! Here is what I use for PAID orders - you can change the ORD.current_state=.. to the state you are interested in. SELECT ORD.reference AS order_ref, ORD.date_add AS order_date, OL.name AS order_status, ORD.valid AS order_valid, CONCAT( CU.firstname, ' ', CU.lastname ) AS customer, LOWER( CU.email ) AS email, AD.city AS City, CL.name AS country, ORD.payment AS payment_type, ORD.total_paid_tax_incl as total_paid_incl, CY.iso_code as currency FROM orders ORD LEFT JOIN customer CU ON ( CU.id_customer = ORD.id_customer ) LEFT JOIN address AD ON ( AD.id_address = ORD.id_address_delivery ) LEFT JOIN country_lang CL ON ( CL.id_country = AD.id_country AND CL.id_lang = 1 ) LEFT JOIN order_state_lang OL ON ( OL.id_order_state = ORD.current_state AND OL.id_lang = 1 ) LEFT JOIN currency CY ON ( CY.id_currency = ORD.id_currency ) WHERE ORD.current_state = 2 ORDER BY ORD.date_add, ORD.id_order 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