Esempio n. 1
0
 public function beforeDelete()
 {
     // if there are orders for this campaign, do not allow deletion
     if ($this->getCountOrders()) {
         return false;
     }
     // No orders are present for this camp.  delete any and all associated camp values
     // upsell products
     $campUpsells = new Upsells('Upsell');
     $campUpsells->loadUpsellsByCampaignId($this->campaign_id);
     $campUpsells->deleteUpsellsFromDb();
     unset($campUpsells);
     // camp products
     $campProducts = new CampaignProducts('CampaignProduct');
     $campProducts->load($this->campaign_id);
     $campProducts->deleteCampaignProductsFromDb();
     unset($campProducts);
     // camp shipping
     $campShip = new CampaignShippings('CampaignShipping');
     $campShip->load($this->campaign_id);
     $campShip->deleteCampaignShippingsFromDb();
     unset($campShip);
     // attach
     $campAttach = new CampaignAttachs('CampaignAttach');
     $campAttach->load($this->campaign_id);
     $campAttach->deleteCampaignAttachsFromDb();
     unset($campAttach);
     // combo
     $campCombos = new CCombos('CCombo');
     $campCombos->load($this->campaign_id);
     $campCombos->deleteCampaignCombosFromDb();
     unset($campCombos);
     // emails
     $campEmail = new CampaignEmails('CampaignEmail');
     $campEmail->load($this->campaign_id);
     $campEmail->deleteCampaignEmailsFromDb();
     unset($campEmail);
     // pixels
     $campPixels = new Pixels('Pixel');
     $campPixels->load($this->campaign_id);
     $campPixels->deleteCampaignPixelsFromDb();
     unset($campPixels);
     // pixel rates
     $sql = "DELETE FROM pixel_rates WHERE campaign_id = ?i";
     self::$_msql->query($sql, $this->campaign_id);
     /*$campPixelRates = new PixelRates('PixelRate');
     		$campPixelRates->load($this->campaign_id);
     		$campPixelRates->deleteCampaignPixelRatesFromDb();
     		unset($campPixelRates);*/
     return TRUE;
 }