_init('pap/pap', 'transid'); } // the base getTable() may tack on an unwanted prefix. Kill it here. public function getTable($name) { $ret = parent::getTable($name); $tablePrefix = (string)Mage::getConfig()->getTablePrefix(); $ret = preg_replace('~^'.preg_quote($tablePrefix).'~', '', $ret); return $ret; } public function SetOrderStatus($order, $status) { $select = $this->_getReadAdapter()->select()->from($this->getTable('pap/pap')) ->where("orderid like CONCAT(? ,'%')", $order->getIncrementId()); $orders = $this->_getReadAdapter()->fetchAll($select); foreach ($orders as $order) { $this->internal_SetOrderStatus($order, $status); } } protected function internal_SetOrderStatus($order, $status) { if ($status == $order['rstatus']) { return; // nothing to change } $data = array( 'dateapproved' => $order['dateapproved'] ? $order['dateapproved'] : now(), 'rstatus' => $status ); $condition = $this->_getWriteAdapter()->quoteInto('transid=?', $order['transid']); $this->_getWriteAdapter()->update($this->getTable('pap/pap'), $data, $condition); // $condition = $this->_getWriteAdapter()->quoteInto('transid=?', $order['transid']); // $this->_getWriteAdapter()->update($this->getTable('pap/pap'), $data, $condition); } } ?>