public function changeEnabledMultipleCountries($countries = array(), $disable = false)
 {
     foreach ($countries as $id_country) {
         if (!$this->changeEnabled((int) $id_country, $disable)) {
             self::$errors[] = sprintf($this->l('Could not change country status, ID: %s'), $id_country);
         }
     }
     if (!empty(self::$errors)) {
         $this->module_instance->outputHTML($this->module_instance->displayErrors(self::$errors));
         reset(self::$errors);
     } else {
         $page = (int) Tools::getValue('submitFilterCountries');
         if (!$page) {
             $page = 1;
         }
         $selected_pagination = (int) Tools::getValue('pagination', $this->pagination[0]);
         $order_by = Tools::getValue('CountryOrderBy', self::DEFAULT_ORDER_BY);
         $order_way = Tools::getValue('CountryOrderWay', self::DEFAULT_ORDER_WAY);
         DpdPoland::addFlashMessage($this->l('Selected countries statuses changed successfully'));
         $redirect_url = $this->module_instance->module_url;
         $redirect_url .= '&menu=country_list&pagination=' . $selected_pagination;
         $redirect_url .= '&CountryOrderBy=' . $order_by;
         $redirect_url .= '&CountryOrderWay=' . $order_way;
         $redirect_url .= '&submitFilterCountries=' . $page;
         die(Tools::redirectAdmin($redirect_url));
     }
 }
예제 #2
0
 public function deleteCSV()
 {
     if (DpdPolandCSV::deleteAllData()) {
         DpdPoland::addFlashMessage($this->l('Price rules deleted successfully'));
     } else {
         DpdPoland::addFlashError($this->l('Price rules could not be deleted'));
     }
     Tools::redirectAdmin($this->module_instance->module_url . '&menu=csv');
 }
 public function saveSettings()
 {
     if (DpdPolandConfiguration::saveConfiguration()) {
         if (!DpdPolandConfiguration::saveZonesForCarriers()) {
             DpdPoland::addFlashError($this->l('Settings saved successfully but could not assign zones for carriers'));
         } else {
             DpdPoland::addFlashMessage($this->l('Settings saved successfully'));
             Tools::redirectAdmin($this->module_instance->module_url . '&menu=configuration');
         }
     } else {
         DpdPoland::addFlashError($this->l('Could not save settings'));
     }
 }