(SELECT * FROM(SELECT max(id_order_state) FROM `" . _DB_PREFIX_ . "order_state` WHERE module_name = 'paynow')tblTmp) AND t1.module_name = 'paynow' AND t1.id_order_state = t2.id_order_state;"; if (Db::getInstance()->execute($sql)) { return (int)Db::getInstance()->Insert_ID(); } } catch (PrestaShopDatabaseException $exception) { PaynowLogger::error($exception->getMessage()); } return true; }