By default, Magento got Order information such as shipping, address, but not much about product. I want to get the latest order information included product url, product thumbnail, etc. I try to join the order flat tables to get information. But I found there's only product name in the sales_flat_order_item table. So how can i get the product url and thumbnail?
I wrote a function in block to get some information about an order, newbie to magento, would you like to tell me if this is a good method to get data from magento, if not, so appriciate to tell your method.
public function getOrderCollection() { $orders = Mage::getModel('sales/order')->getCollection(); $orders->getSelect() ->join( array('addr' => Mage::getSingleton('core/resource')->getTableName('sales/order_address')), 'main_table.entity_id = addr.parent_id', array('addr.*') ) ->join( array('itemz' => Mage::getSingleton('core/resource')->getTableName('sales/order_item')), 'main_table.entity_id = itemz.order_id', array('itemz.*') ) ->join( array('product' => Mage::getSingleton('core/resource')->getTableName('catalog/product')), 'itemz.product_id = product.entity_id', array('product.*') ) ; $orders ->addAttributeToFilter('main_table.status', 'Processing') ->addAttributeToFilter('addr.address_type', 'shipping') ->addAttributeToSort('main_table.entity_id', 'asc') ; return $orders; }