/** * Save batche - product relations * @access public * @param Ultimate_ordersBatches_Model_Batche $batche * @param array $data * @return Ultimate_ordersBatches_Model_Resource_Batche_Product * @author Ultimate Module Creator */ public function saveBatcheRelation($batche, $data) { if (!is_array($data)) { $data = array(); } $deleteCondition = $this->_getWriteAdapter()->quoteInto('batche_id=?', $batche->getId()); $this->_getWriteAdapter()->delete($this->getMainTable(), $deleteCondition); foreach ($data as $productId => $info) { $this->_getWriteAdapter()->insert($this->getMainTable(), array('batche_id' => $batche->getId(), 'product_id' => $productId, 'position' => @$info['position'])); } return $this; }