Magento中的部分装运报告
我有一份报告列出了所有部分发货的订单,但数据与我在Magento生成的页面中看到的不匹配。我的代码在下面Magento中的部分装运报告,magento,report,Magento,Report,我有一份报告列出了所有部分发货的订单,但数据与我在Magento生成的页面中看到的不匹配。我的代码在下面 $collection = Mage::getModel('sales/order')->getCollection() ->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_COMPLETE)) ->addAttributeToFilter('sta
$collection = Mage::getModel('sales/order')->getCollection()
->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_COMPLETE))
->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CANCELED))
->addAttributeToFilter('state', array('neq' => Mage_Sales_Model_Order::STATE_CLOSED));
$collection->getSelect()
->joinLeft(array('sfsg' => $collection->getTable('sales/shipment')), 'main_table.increment_id = sfsg.increment_id', array('shipped'=>'sfsg.created_at'))
->where('sfsg.created_at IS NOT NULL');
$this->setCollection($collection);
return parent::_prepareCollection();
因此,第一部分定义没有选择状态为“已完成”、“已取消”或“已关闭”的订单,例如部分发货的订单,并且leftJoin位在增量\ id(订单id)上加入销售\平面\发货表。然后,这将拉出创建/发送装运时所在的创建的_
这会生成我的报告,但其中的数据与使用Magento内置工具查看报告时看到的数据不匹配
有人能告诉我哪里出了问题吗?我想一定是lefJoin不对。如果有任何人对此有任何有用的文档,我也会非常感激。如果您更换该行,上述内容将起作用
->joinLeft(array('sfsg' => $collection->getTable('sales/shipment')), 'main_table.increment_id = sfsg.increment_id', array('shipped'=>'sfsg.created_at'))
与
奇怪的是,Magento决定命名与两个表entity_id和order_id匹配的列
对此的任何解释都将不胜感激
->joinLeft(array('sfsg' => $collection->getTable('sales/shipment')), 'main_table.entity_id = sfsg.order_id', array('shipped'=>'sfsg.created_at'))