public static function getCarriers($id_lang, $active = false, $delete = false, $id_zone = false, $ids_group = NULL, $modules_filters = 1) { global $cookie, $cart; $carriers = parent::getCarriers($id_lang, $active, $delete, $id_zone, $ids_group, $modules_filters); if (!Module::isInstalled('agilemultipleseller')) { return $carriers; } $id_seller_for_filter = AgileSellerManager::get_id_seller_for_filter(); if ((int) $id_seller_for_filter <= 0) { return $carriers; } $retCarriers = array(); foreach ($carriers as $carrier) { $id_owner = AgileSellerManager::getObjectOwnerID('carrier', $carrier['id_carrier']); if ($id_seller_for_filter == $id_owner || $id_owner == 0) { $retCarriers[] = $carrier; } } return $retCarriers; }
/** * @return mixed */ private function renderForm() { $options = array(); foreach (CarrierCore::getCarriers((int) Context::getContext()->language->id, true, false) as $carrier) { $options[] = array("id" => $carrier['id_carrier'], "name" => $carrier['name']); } // ddd(CarrierCore::getCarriers((int)Context::getContext()->language->id,true,true)); $fields_form = array('form' => array('legend' => array('title' => $this->l('Upload PinCode'), 'icon' => 'icon-cogs'), 'enctype' => 'multipart/form-data', 'input' => array(array('type' => 'select', 'label' => $this->l('Shipping method:'), 'desc' => $this->l('Choose a shipping method'), 'name' => 'SHIPPING_METHOD', 'required' => true, 'options' => array('query' => $options, 'id' => 'id', 'name' => 'name')), array('type' => 'file', 'label' => $this->l('Upload CSV'), 'name' => 'PINCODE_UPLOAD', 'required' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitShipping'))); $fields_form_1 = array('form' => array('legend' => array('title' => $this->l('Cash On Delivery'), 'icon' => 'icon-cogs'), 'description' => $this->l('Define Your COD Setting Here!') . '<br />', 'input' => array(array('type' => 'text', 'label' => $this->l('COD Minimum Amount'), 'name' => 'COD_MINIMUM_AMOUNT'), array('type' => 'text', 'label' => $this->l('COD Fee'), 'name' => 'COD_FEE')), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-default pull-right', 'name' => 'submitCOD'))); $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $lang = new Language((int) Configuration::get('PS_LANG_DEFAULT')); $helper->default_form_language = $lang->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $helper->identifier = $this->identifier; $helper->override_folder = '/'; $helper->submit_action = 'submitModule'; $helper->module = $this; $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->tpl_vars = array('currencies' => Currency::getCurrencies(), 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id); $helper->override_folder = '/'; return $helper->generateForm(array($fields_form, $fields_form_1)); }
/** * Get all carriers in a given language * * @param int $id_lang Language id * @param bool $active Returns only active carriers when true * @param bool $delete * @param bool|int $id_zone * @param null|string $ids_group * @param $modules_filters, possible values: * PS_CARRIERS_ONLY * CARRIERS_MODULE * CARRIERS_MODULE_NEED_RANGE * PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE * ALL_CARRIERS * * @return array Carriers */ public function getCarriers($id_lang, $active = false, $delete = false, $id_zone = false, $ids_group = null, $modules_filters = self::PS_CARRIERS_ONLY) { return \CarrierCore::getCarriers($id_lang, $active, $delete, $id_zone, $ids_group, $modules_filters); }