private function getSettings() { $settings_data = self::getSettingsData(); foreach ($settings_data as $name => $setting) { $this->{$setting} = $this->getSetting($name, $this->{$setting}); } $carriers_ids = Configuration::getMultiple(array(self::CARRIER_10_ID, self::CARRIER_12_ID, self::CARRIER_CLASSIC_ID, self::CARRIER_SAME_DAY_ID, self::CARRIER_B2C_ID, self::CARRIER_INTERNATIONAL_ID, self::CARRIER_BULGARIA_ID, self::CARRIER_10_COD_ID, self::CARRIER_12_COD_ID, self::CARRIER_CLASSIC_COD_ID, self::CARRIER_SAME_DAY_COD_ID, self::CARRIER_B2C_COD_ID, self::CARRIER_INTERNATIONAL_COD_ID, self::CARRIER_BULGARIA_COD_ID)); $ps_14 = version_compare(_PS_VERSION_, '1.5', '<'); $all_dpd_carriers = array(array('id_carrier' => isset($carriers_ids[self::CARRIER_10_ID]) ? $carriers_ids[self::CARRIER_10_ID] : '', 'id_service' => 'active_services_10'), array('id_carrier' => isset($carriers_ids[self::CARRIER_12_ID]) ? $carriers_ids[self::CARRIER_12_ID] : '', 'id_service' => 'active_services_12'), array('id_carrier' => isset($carriers_ids[self::CARRIER_CLASSIC_ID]) ? $carriers_ids[self::CARRIER_CLASSIC_ID] : '', 'id_service' => 'active_services_classic'), array('id_carrier' => isset($carriers_ids[self::CARRIER_SAME_DAY_ID]) ? $carriers_ids[self::CARRIER_SAME_DAY_ID] : '', 'id_service' => 'active_services_same_day'), array('id_carrier' => isset($carriers_ids[self::CARRIER_B2C_ID]) ? $carriers_ids[self::CARRIER_B2C_ID] : '', 'id_service' => 'active_services_b2c'), array('id_carrier' => isset($carriers_ids[self::CARRIER_INTERNATIONAL_ID]) ? $carriers_ids[self::CARRIER_INTERNATIONAL_ID] : '', 'id_service' => 'active_services_international'), array('id_carrier' => isset($carriers_ids[self::CARRIER_BULGARIA_ID]) ? $carriers_ids[self::CARRIER_BULGARIA_ID] : '', 'id_service' => 'active_services_bulgaria'), array('id_carrier' => isset($carriers_ids[self::CARRIER_10_COD_ID]) ? $carriers_ids[self::CARRIER_10_COD_ID] : '', 'id_service' => 'is_cod_carrier_10'), array('id_carrier' => isset($carriers_ids[self::CARRIER_12_COD_ID]) ? $carriers_ids[self::CARRIER_12_COD_ID] : '', 'id_service' => 'is_cod_carrier_12'), array('id_carrier' => isset($carriers_ids[self::CARRIER_CLASSIC_COD_ID]) ? $carriers_ids[self::CARRIER_CLASSIC_COD_ID] : '', 'id_service' => 'is_cod_carrier_classic'), array('id_carrier' => isset($carriers_ids[self::CARRIER_SAME_DAY_COD_ID]) ? $carriers_ids[self::CARRIER_SAME_DAY_COD_ID] : '', 'id_service' => 'is_cod_carrier_same_day'), array('id_carrier' => isset($carriers_ids[self::CARRIER_B2C_COD_ID]) ? $carriers_ids[self::CARRIER_B2C_COD_ID] : '', 'id_service' => 'is_cod_b2c'), array('id_carrier' => isset($carriers_ids[self::CARRIER_INTERNATIONAL_COD_ID]) ? $carriers_ids[self::CARRIER_INTERNATIONAL_COD_ID] : '', 'id_service' => 'is_cod_international'), array('id_carrier' => isset($carriers_ids[self::CARRIER_BULGARIA_COD_ID]) ? $carriers_ids[self::CARRIER_BULGARIA_COD_ID] : '', 'id_service' => 'is_cod_bulgaria')); foreach ($all_dpd_carriers as $dpd_carrier) { if ($dpd_carrier['id_carrier']) { if ($ps_14) { $id_carrier = (int) DpdGroupCarrier::getIdCarrierByReference((int) $dpd_carrier['id_carrier']); $carrier = new Carrier((int) $id_carrier); } else { $carrier = Carrier::getCarrierByReference((int) $dpd_carrier['id_carrier']); } if (Validate::isLoadedObject($carrier)) { $this->{$dpd_carrier}['id_service'] = $carrier->active && !$carrier->deleted ? 1 : 0; } else { $this->{$dpd_carrier}['id_service'] = 0; } } } }
public static function deleteCarrier($carrier_type) { $id_carrier = (int) Configuration::get($carrier_type); if (!$id_carrier) { return true; } if (version_compare(_PS_VERSION_, '1.5', '<')) { $id_carrier = (int) DpdGroupCarrier::getIdCarrierByReference((int) $id_carrier); $carrier = new Carrier((int) $id_carrier); } else { $carrier = Carrier::getCarrierByReference($id_carrier); } if (!Validate::isLoadedObject($carrier)) { return true; } if ($carrier->deleted) { return true; } $carrier->deleted = 1; return (bool) $carrier->save(); }