Example #1
0
 /**
  * Update records in grid table
  *
  * @param array|int $ids
  * @return Mage_Sales_Model_Resource_Order_Abstract
  */
 public function updateGridRecords($ids)
 {
     if ($this->_grid) {
         if (!is_array($ids)) {
             $ids = array($ids);
         }
         if ($this->_eventPrefix && $this->_eventObject) {
             $proxy = new Varien_Object();
             $proxy->setIds($ids)->setData($this->_eventObject, $this);
             Mage::dispatchEvent($this->_eventPrefix . '_update_grid_records', array('proxy' => $proxy));
             $ids = $proxy->getIds();
         }
         if (empty($ids)) {
             // If nothing to update
             return $this;
         }
         $columnsToSelect = array();
         $table = $this->getGridTable();
         $select = $this->getUpdateGridRecordsSelect($ids, $columnsToSelect);
         $this->_getWriteAdapter()->query($select->insertFromSelect($table, $columnsToSelect, true));
     }
     return $this;
 }