Magento - How to use JoinTable in EE 1.9

We have a problem after upgrading to 1.9.1 EE Magenta. In the user script, we used a connection to another table for this, 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 update, we got an error message: Fatal error: calling the undefined method Mage_Sales_Model_Mysql4_Order_Collection :: joinTable ().

Does anyone know what to do?

+5
source share
1 answer

The collection of orders is now presented in a flat table. Thus, you can add filters through the 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');

This is the answer to this question.

, , , :

  • . , .
  • "right" EAV . , , " ". , , " ". ? " " ?
  • "sku", "qty_ordered", "qty_invoiced" . , ( ), 'udropship' .
  • , '$ this- > vendorid', . int, . .
+3

All Articles