We have a problem after upgrading to 1.9.1 EE of magento. On a custom script we used to make a join with another table by this way, and it always worked fine.
$collection->joinTable('sales_flat_order_item','order_id=entity_id', array('sku', 'qty_ordered', 'qty_invoiced', 'udropship_vendor') , 'sales_flat_order_item.udropship_vendor="'.$this->vendorid.'"', 'right');
$collection->groupByAttribute(array('entity_id'));
But after the upgrade we've got the error message: Fatal error: Call to undefined method Mage_Sales_Model_Mysql4_Order_Collection::joinTable().
Does anyone know what to do?
Order Collection now is represented by a flat table. Thus you can add filters via standard Varien_Db_Select property of this collection:
$select = $collection->getSelect();
$select->join(
array('o_item' => 'sales_flat_order_item'),
'o_item.order_id = main_table.entity_id AND o_item.udropship_vendor = "' . $this->vendorid . '"',
array('sku', 'qty_ordered', 'qty_invoiced', 'udropship_vendor')
)
->group('main_table.entity_id');
It is the answer to this question.
However, additionally I should point to some issues in the code snippet, you gave in the question:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With