caromax Posted October 1, 2013 Share Posted October 1, 2013 (edited) I do not control mysql and I want a little help.I would like to get an SQL query for all orders being delivered (with the id_order_state = 4). An expert can give me an application that works please ? I use PS1.25 Edited October 2, 2013 by caromax (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted October 1, 2013 Share Posted October 1, 2013 select * from orders where current_state=4 this query should help Link to comment Share on other sites More sharing options...
caromax Posted October 1, 2013 Author Share Posted October 1, 2013 (edited) Hi, This query does not work on the old prestashop (1.25). can you help me please ? Edited October 1, 2013 by caromax (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted October 1, 2013 Share Posted October 1, 2013 so you use prestashop 1.2.5 ? remember to write about your prestashop version if you've got questions like this Link to comment Share on other sites More sharing options...
caromax Posted October 2, 2013 Author Share Posted October 2, 2013 Ok, is done Link to comment Share on other sites More sharing options...
vekia Posted October 2, 2013 Share Posted October 2, 2013 so if it is done, can you show what kind of query you used please? Link to comment Share on other sites More sharing options...
caromax Posted October 2, 2013 Author Share Posted October 2, 2013 I wrote that it's done because I noticed version prestashop in the first post. But I have not found solution to the query, I do not have enough knowledge to this! Someone can help me please ? Link to comment Share on other sites More sharing options...
vekia Posted October 2, 2013 Share Posted October 2, 2013 are you able to show me what kind of fields your ps_order table has got? im asking because i havent got any 1.2 installation and i can't check it Link to comment Share on other sites More sharing options...
caromax Posted October 3, 2013 Author Share Posted October 3, 2013 Hi, Thank's for your reply. My ps_orders table is like this: CREATE TABLE IF NOT EXISTS `ps_orders` ( `id_order` int(10) unsigned NOT NULL auto_increment, `id_carrier` int(10) unsigned NOT NULL, `id_lang` int(10) unsigned NOT NULL, `id_customer` int(10) unsigned NOT NULL, `id_cart` int(10) unsigned NOT NULL, `id_currency` int(10) unsigned NOT NULL, `id_address_delivery` int(10) unsigned NOT NULL, `id_address_invoice` int(10) unsigned NOT NULL, `secure_key` varchar(32) NOT NULL default '-1', `payment` varchar(255) NOT NULL, `module` varchar(255) default NULL, `recyclable` tinyint(1) unsigned NOT NULL default '0', `gift` tinyint(1) unsigned NOT NULL default '0', `gift_message` text, `shipping_number` varchar(32) default NULL, `total_discounts` decimal(10,2) NOT NULL default '0.00', `total_paid` decimal(10,2) NOT NULL default '0.00', `total_paid_real` decimal(10,2) NOT NULL default '0.00', `total_products` decimal(10,2) NOT NULL default '0.00', `total_shipping` decimal(10,2) NOT NULL default '0.00', `total_wrapping` decimal(10,2) NOT NULL default '0.00', `invoice_number` int(10) unsigned NOT NULL default '0', `delivery_number` int(10) unsigned NOT NULL default '0', `invoice_date` datetime NOT NULL, `delivery_date` datetime NOT NULL, `valid` int(1) unsigned NOT NULL default '0', `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, PRIMARY KEY (`id_order`), KEY `id_customer` (`id_customer`), KEY `id_cart` (`id_cart`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; and ps_order_history table like this : CREATE TABLE IF NOT EXISTS `ps_order_history` ( `id_order_history` int(10) unsigned NOT NULL auto_increment, `id_employee` int(10) unsigned NOT NULL, `id_order` int(10) unsigned NOT NULL, `id_order_state` int(10) unsigned NOT NULL, `date_add` datetime NOT NULL, PRIMARY KEY (`id_order_history`), KEY `order_history_order` (`id_order`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; Link to comment Share on other sites More sharing options...
vekia Posted October 3, 2013 Share Posted October 3, 2013 thank you! hre is the query: select * from ps_orders o INNER JOIN ps_order_history oh ON o.id_order = oh.id_order WHERE oh.id_order_state = 4 Link to comment Share on other sites More sharing options...
caromax Posted October 3, 2013 Author Share Posted October 3, 2013 Thank you @vekia. This query works but i obtains all orders that have the id 4.I want to have the ID 4 only if it is the last status order , you understand me ? 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