コード例 #1
0
ファイル: Product.php プロジェクト: smitmanglam/staging
 /**
  * Save data for batche-product relation
  * @access public
  * @param  Ultimate_ordersBatches_Model_Batche $batche
  * @return Ultimate_ordersBatches_Model_Batche_Product
  * @author Ultimate Module Creator
  */
 public function saveBatcheRelation($batche)
 {
     $data = $batche->getProductsData();
     if (!is_null($data)) {
         $this->_getResource()->saveBatcheRelation($batche, $data);
     }
     return $this;
 }
コード例 #2
0
ファイル: Product.php プロジェクト: smitmanglam/staging
 /**
  * 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;
 }