开发者

order detail with sql query in magento?

开发者 https://www.devze.com 2023-02-07 11:33 出处:网络
hi i have created a custom module in magento. now i need to fetch the order data with user requirement.such as when user enter the from and end date th开发者_如何转开发e only those order id will appea

hi i have created a custom module in magento. now i need to fetch the order data with user requirement.such as when user enter the from and end date th开发者_如何转开发e only those order id will appear. so i want to run a query in magento which gives me the only those order id. can any one have any idea about this. or please give some suggestion for this


It is very simple...

// 1. Create order collection object
$collection = Mage::getModel('sales/order')->getCollection();
// 2. Apply your date filter
$collection->addFieldToFilter(
     'created_at', 
     array('from' => '2010-01-01', 'to' => '2010-01-01')
);
// 3. Iterate it for displaying results
foreach ($collection as $order) {
    //...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消