Would anyone happen to have an example of a SELECT query that returns the most recent order status of all orders?
Would anyone happen to have an example of a SELECT query that returns the most recent order status of all orders?
Not sure where you are wanting this to run ... phpMyAdmin or in your Zen Cart Admin ...
This should work in phpMyAdmin ...
I added a few fields but you can add more if you need them ...Code:select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name from orders_status s, orders o where o.orders_status = s.orders_status_id and s.language_id = '1' order by o.orders_id DESC;
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
That works for me Ajeh. I'm trying to write code that validates if a certain order qualifies for a type of transaction for a module I'm trying to write. I can mess with it on my local database and see where it takes me.
Thanks.
Hi Perhaps you can help me too...
Can you tell me how I can have it so I can get the following:
If Order status = 11 (or orders_status_name = 'Shipped')
Then Show Customer name, Company Name and full address? Or perhaps even insert a "between date" (1/1/2010 to 1/1/2011) if possible?
Thanks in advance.
Start with the original SQL and add to the WHERE the orders_status = 11 and then start adding in the fields you want included:
In phpMyAdmin, if you browse the orders table and hit the SQL you will see a list of the field names on the right to help you do this ...Code:select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name from orders_status s, orders o where o.orders_status = s.orders_status_id and s.language_id = '1' and o.orders_status = 11 order by o.orders_id DESC;
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
I cannot reproduce an error ... it works for me just fine ...
Test and see what happens if you use the code:
and change the 11 to 3 ... just to see if it works ...Code:select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name from orders_status s, orders o where o.orders_status = s.orders_status_id and s.language_id = '1' and o.orders_status = 11 order by o.orders_id DESC;
If still a problem, browse the orders table and click on search ... and find the field orders_status = 11
Check that all fields listed exist in your database ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Weird ... thanks for the update that this is now working for you ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Bookmarks