/** * Updates the csu discount table. Removes existing records pertaining to * the csu and product option ids first and then updates accordingly. * * @param int $managerCsuId * @param array $productOptions * @param int $optionId */ public function updateCsuDiscounts($managerCsuId, $productOptions, $optionId) { // first split the array values into csu and prod opt id. $csuOpts = $this->splitCsusAndOptions($productOptions); $csuDisc = new Datasource_Core_Discount_CsuDiscount(); foreach ($csuOpts as $csuid => $options) { // Delete existing policy opts for this products $this->clearCsuDiscount($optionId, $csuid); // Add in new policy opts $csuDisc->setDiscount($csuid, $managerCsuId, $options); } }
/** * Updates the CSUs product option availability for a given CSU * * @param int $csuid * @param int $supervisorId * @param array $productOptDiscIds */ public function updateProductDiscountOptions($csuID, $supervisorID, $productOptDiscIds) { $csuDiscDatasource = new Datasource_Core_Discount_CsuDiscount(); $csuDiscDatasource->setDiscount($csuID, $supervisorID, $productOptDiscIds); }