0
默认情况下,Magento获得订单信息,例如发货,地址,但没有太多关于产品的信息。我想获得最新的订单信息,包括产品网址,产品缩略图等。我尝试加入订单平台以获取信息。但是我发现sales_flat_order_item表中只有产品名称。那么,我如何获得产品网址和缩略图?获取Magento最新订单的产品信息
我写了一个block的函数来获取一些关于订单的信息,newgent to magento,你想告诉我这是否是一种从magento获取数据的好方法,如果不是的话,那么告诉你的方法非常有用。
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;
}