Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How do I create this custom query against magento db to fetch order status and created date for matching records? 
 
bongobongo
Jr. Member
 
Total Posts:  11
Joined:  2009-02-24
 

Hi.

I need to do a custom query against the database to do the following:

With a product name I store a custom code.
This code could look like this “AE347”.

When I create a new product I give it e.g. this name:
Some product name (AE347)

For this product I have created a custom option called “Domain name”

Now lets say some customers have placed orders and downloaded the product.
Then I want to be able to run a custom query against the database to:

Find order “created date” and status (Payed, Pending, etc) related to product which have the code “AE347” in product name and where custom option “Domain name” value related to product/order contains a specific domain e.g. “www.somedomain.com”
I want all matching orders created_date and status that match criteria.

Example: (do not know if the logic below is correct but here we go)
Before running the query I know two things:
The custom product code stored with the product title (here “AE347")
The domain name that is stored in related custom option (in this example: e.g.: “www.somedomain.com”
1. Start by finding matching records in the table that stores the value for the custom option “Domain name”.
2. Then find related products where the custom code “AE347” is in product name.
3. Then find related orders for the above tables.
OR maybe find:
1. Find related products where the custom code “AE347” is in product name.
2. Find related records in the table that stores the value for the custom option “Domain name”.
3. Find related orders for the above tables.

I have tried by looking at the table structure, to figure out how such a query could look like, but have obviously not managed to find out how to do it?

Could someone please tell me how that query would look like?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top