通过Shipment Code找到Order信息

Shipment是EAV模型,默认不会选出order_id信息,因此需要使用使用addAttributeToSelect方法,代码如下:

$collection = Mage::getModel(‘sales/order_shipment’)->getCollection()->addAttributeToSelect(‘order_id’)->addAttributeToFilter(‘increment_id’, ‘100000002’);
foreach($collection AS $c) {
echo ‘Order Id : ‘ . $c->getOrder()->getId();
break;
}

标签


Warning: error_log(/www/wwwroot/www.ctrol.cn/wp-content/plugins/spider-analyser/#log/log-0215.txt): failed to open stream: No such file or directory in /www/wwwroot/www.ctrol.cn/wp-content/plugins/spider-analyser/spider.class.php on line 2900