本文整理汇总了PHP中Country::getIdZone方法的典型用法代码示例。如果您正苦于以下问题:PHP Country::getIdZone方法的具体用法?PHP Country::getIdZone怎么用?PHP Country::getIdZone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Country
的用法示例。
在下文中一共展示了Country::getIdZone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->init();
$this->preProcess();
if (Tools::getValue('ajax') == 'true') {
if (Tools::getIsset('summary')) {
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) {
if (self::$cookie->id_customer) {
$customer = new Customer((int) self::$cookie->id_customer);
$groups = $customer->getGroups();
} else {
$groups = array(1);
}
if ((int) self::$cart->id_address_delivery) {
$deliveryAddress = new Address((int) self::$cart->id_address_delivery);
}
$result = array('carriers' => Carrier::getCarriersForOrder((int) Country::getIdZone((isset($deliveryAddress) and (int) $deliveryAddress->id) ? (int) $deliveryAddress->id_country : (int) Configuration::get('PS_COUNTRY_DEFAULT')), $groups));
}
$result['summary'] = self::$cart->getSummaryDetails();
$result['customizedDatas'] = Product::getAllCustomizedDatas((int) self::$cart->id);
$result['HOOK_SHOPPING_CART'] = Module::hookExec('shoppingCart', $result['summary']);
$result['HOOK_SHOPPING_CART_EXTRA'] = Module::hookExec('shoppingCartExtra', $result['summary']);
die(Tools::jsonEncode($result));
} else {
$this->includeCartModule();
}
} else {
$this->setMedia();
$this->displayHeader();
$this->process();
$this->displayContent();
$this->displayFooter();
}
}
示例2: _assignCarrier
protected function _assignCarrier()
{
if (!$this->isLogged) {
$carriers = Carrier::getCarriersForOrder(Country::getIdZone((int) Configuration::get('PS_COUNTRY_DEFAULT')));
self::$smarty->assign(array('checked' => $this->_setDefaultCarrierSelection($carriers), 'carriers' => $carriers, 'default_carrier' => (int) Configuration::get('PS_CARRIER_DEFAULT'), 'HOOK_EXTRACARRIER' => NULL, 'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers))));
} else {
parent::_assignCarrier();
}
}
示例3: getOrderShippingCostExternal
public function getOrderShippingCostExternal($cart)
{
if (!$this->soapClientExists() || !$this->checkModuleAvailability()) {
return false;
}
$disabled_countries_ids = DpdPolandCountry::getDisabledCountriesIDs();
$id_country = (int) Tools::getValue('id_country');
if (!$id_country) {
$country = Address::getCountryAndState((int) $cart->id_address_delivery);
$id_country = $country['id_country'];
}
if (!($id_method = self::getMethodIdByCarrierId($this->id_carrier))) {
self::$carriers[$this->id_carrier] = false;
return false;
}
if (!$id_country || in_array($id_country, $disabled_countries_ids) && $id_method == _DPDPOLAND_CLASSIC_ID_) {
return false;
}
if ($id_country) {
$zone = Country::getIdZone($id_country);
} else {
return false;
}
if (!$this->id_carrier) {
return false;
}
if ($id_country == Country::getByIso(self::POLAND_ISO_CODE) && $id_method == _DPDPOLAND_CLASSIC_ID_ || $id_country != Country::getByIso(self::POLAND_ISO_CODE) && $id_method == _DPDPOLAND_STANDARD_COD_ID_ || $id_country != Country::getByIso(self::POLAND_ISO_CODE) && $id_method == _DPDPOLAND_STANDARD_ID_) {
return false;
}
if (isset(self::$carriers[$this->id_carrier])) {
return self::$carriers[$this->id_carrier];
}
$total_weight = self::convertWeight($cart->getTotalWeight());
if (Configuration::get(DpdPolandConfiguration::PRICE_CALCULATION_TYPE) == DpdPolandConfiguration::PRICE_CALCULATION_PRESTASHOP) {
$carrier = new Carrier($this->id_carrier);
$price = $carrier->getDeliveryPriceByWeight($total_weight, $zone);
self::$carriers[$this->id_carrier] = $price;
return self::$carriers[$this->id_carrier];
}
$price = DpdPolandCSV::getPrice($total_weight, $id_method, $cart);
if ($price === false) {
return false;
}
$id_currency_pl = Currency::getIdByIsoCode(_DPDPOLAND_CURRENCY_ISO_, (int) $this->context->shop->id);
$currency_from = new Currency((int) $id_currency_pl);
$currency_to = $this->context->currency;
self::$carriers[$this->id_carrier] = Tools::convertPriceFull($price, $currency_from, $currency_to);
return self::$carriers[$this->id_carrier];
}
示例4: _processCarrier
protected function _processCarrier()
{
self::$cart->recyclable = (int) Tools::getValue('recyclable');
self::$cart->gift = (int) Tools::getValue('gift');
if ((int) Tools::getValue('gift')) {
if (!Validate::isMessage($_POST['gift_message'])) {
$this->errors[] = Tools::displayError('Invalid gift message');
} else {
self::$cart->gift_message = strip_tags($_POST['gift_message']);
}
}
if (isset(self::$cookie->id_customer) and self::$cookie->id_customer) {
$address = new Address((int) self::$cart->id_address_delivery);
if (!($id_zone = Address::getZoneById($address->id))) {
$this->errors[] = Tools::displayError('No zone match with your address');
}
} else {
$id_zone = Country::getIdZone((int) Configuration::get('PS_COUNTRY_DEFAULT'));
}
if (Validate::isInt(Tools::getValue('id_carrier')) and sizeof(Carrier::checkCarrierZone((int) Tools::getValue('id_carrier'), (int) $id_zone))) {
self::$cart->id_carrier = (int) Tools::getValue('id_carrier');
} elseif (!self::$cart->isVirtualCart() and (int) Tools::getValue('id_carrier') != 0) {
$this->errors[] = Tools::displayError('Invalid carrier or no carrier selected');
}
Module::hookExec('processCarrier', array('cart' => self::$cart));
return self::$cart->update();
}
示例5: getCarriersListByIdZone
public function getCarriersListByIdZone($id_country, $id_state = 0, $zipcode = 0)
{
global $cart, $smarty, $cookie;
// cookie saving/updating
$cookie->id_country = $id_country;
if ($id_state != 0) {
$cookie->id_state = $id_state;
}
if ($zipcode != 0) {
$cookie->postcode = $zipcode;
}
$id_zone = 0;
if ($id_state != 0) {
$id_zone = State::getIdZone($id_state);
}
if (!$id_zone) {
$id_zone = Country::getIdZone($id_country);
}
$carriers = Carrier::getCarriersForOrder((int) $id_zone);
return sizeof($carriers) ? $carriers : array();
}
示例6: createDejalaCarrier
/**
* creates of a dejala carrier corresponding to $dejalaProduct
*/
public static function createDejalaCarrier($dejalaConfig)
{
// MFR091130 - get id zone from the country used in the module (if the store zones were customized) - default is 1 (Europe)
$id_zone = 1;
$moduleCountryIsoCode = strtoupper($dejalaConfig->country);
$countryID = Country::getByIso($moduleCountryIsoCode);
if ((int) $countryID) {
$id_zone = Country::getIdZone($countryID);
}
//TODO Will have to review this and apply proper code.
$trg_id = 1;
/*$vatRate = "19.6";
// MFR091130 - get or create the tax & attach it to our zone if needed
$id_tax = Tax::getTaxIdByRate((float)$vatRate);
$trg_id = 0;
if (!$id_tax)
{
$tax = new Tax();
$tax->rate = $vatRate;
$defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
$tax->name[$defaultLanguage] = $tax->rate . '%';
$tax->add();
$id_tax = $tax->id;
$trg = new TaxRulesGroup();
$trg->name = 'Dejala '.$tax->name[$defaultLanguage];
$trg->active = 1;
if ($trg->save())
{
$trg_id = $trg->id;
$tr = new TaxRule();
$tr->id_tax_rules_group = $trg_id;
$tr->id_country = (int) $countryID;
$tr->id_state = 0;
$tr->id_tax = (int)$tax->id;
$tr->state_behavior = 0;
$tr->save();
}
}*/
$carrier = new Carrier();
$carrier->name = 'dejala';
$carrier->id_tax_rules_group = (int) $trg_id;
$carrier->url = 'http://tracking.dejala.' . $dejalaConfig->country . '/tracker/@';
$carrier->active = true;
$carrier->deleted = 0;
$carrier->shipping_handling = false;
$carrier->range_behavior = 0;
$carrier->is_module = 1;
$carrier->external_module_name = 'dejala';
$carrier->shipping_external = 1;
$carrier->need_range = 0;
$languages = Language::getLanguages(true);
foreach ($languages as $language) {
$carrier->delay[$language['id_lang']] = 'Dejala';
}
$carrier->add();
$carrier->addZone((int) $id_zone);
/*$sql = 'INSERT INTO `'._DB_PREFIX_.'carrier_zone` (`id_carrier` , `id_zone`) VALUES ('.(int)($carrier->id).', ' . (int)($id_zone) . ')';
Db::getInstance()->Execute($sql);
$rangeW = new RangeWeight();
$rangeW->id_carrier = $carrier->id;
$rangeW->delimiter1 = 0;
$rangeW->delimiter2 = $dejalaProduct['max_weight'];
$rangeW->add();
$vat_factor = (1+ ($dejalaProduct['vat'] / 100));
$priceTTC = round(($dejalaProduct['price']*$vat_factor) + $dejalaProduct['margin'], 2);
$priceHT = round($priceTTC/$vat_factor, 2);
$priceList = '(NULL'.','.$rangeW->id.','.$carrier->id.','.$id_zone.','.$priceHT.')';
$carrier->addDeliveryPrice($priceList);*/
return true;
}
示例7: getApplicableTax
public static function getApplicableTax($id_tax, $productTax, $id_address_delivery = NULL)
{
global $cart, $cookie, $defaultCountry;
if (!$id_address_delivery) {
$id_address_delivery = intval((Validate::isLoadedObject($cart) and $cart->id_address_delivery) ? $cart->id_address_delivery : (isset($cookie->id_address_delivery) ? $cookie->id_address_delivery : 0));
}
/* If customer has an address (implies that he is registered and logged) */
if ($id_address_delivery and $address_ids = Address::getCountryAndState($id_address_delivery)) {
$id_zone_country = Country::getIdZone(intval($address_ids['id_country']));
/* If customer's invoice address is inside a state */
if ($address_ids['id_state']) {
$state = new State(intval($address_ids['id_state']));
if (!Validate::isLoadedObject($state)) {
die(Tools::displayError());
}
/* Return tax value depending to the tax behavior */
$tax_behavior = intval($state->tax_behavior);
if ($tax_behavior == PS_PRODUCT_TAX) {
return $productTax * Tax::zoneHasTax(intval($id_tax), intval($id_zone_country));
}
if ($tax_behavior == PS_STATE_TAX) {
return Tax::getRateByState(intval($address_ids['id_state']));
}
if ($tax_behavior == PS_BOTH_TAX) {
return $productTax * Tax::zoneHasTax(intval($id_tax), intval($id_zone_country)) + Tax::getRateByState(intval($address_ids['id_state']));
}
/* Unknown behavior */
die(Tools::displayError('Unknown tax behavior!'));
}
/* Else getting country zone tax */
if (!($id_zone = Address::getZoneById($id_address_delivery))) {
die(Tools::displayError());
}
return $productTax * Tax::zoneHasTax(intval($id_tax), intval($id_zone));
}
/* Default tax application */
if (!Validate::isLoadedObject($defaultCountry)) {
die(Tools::displayError());
}
return $productTax * Tax::zoneHasTax(intval($id_tax), intval($defaultCountry->id_zone));
}
示例8: getOrderShippingCostExternal
public function getOrderShippingCostExternal($cart, $products = array())
{
if (!$this->id_carrier || !$cart instanceof Cart) {
return false;
}
$cache_key = $this->getCacheKey($cart, $products);
if (isset(self::$carriers[$this->id_carrier][$cache_key])) {
return self::$carriers[$this->id_carrier][$cache_key];
}
$id_address_delivery = empty($products) ? (int) $cart->id_address_delivery : (int) $this->getIdAddressDeliveryByProducts($products);
$id_customer_country = (int) Tools::getValue('id_country');
if (!$id_customer_country) {
$customer_country = Address::getCountryAndState((int) $id_address_delivery);
$id_customer_country = (int) $customer_country['id_country'];
}
$zone = $id_customer_country ? Country::getIdZone((int) $id_customer_country) : Address::getZoneById((int) $id_address_delivery);
if (!($id_method = self::getMethodIdByCarrierId($this->id_carrier))) {
self::$carriers[$this->id_carrier][$cache_key] = false;
return false;
}
$carrier = new Carrier((int) $this->id_carrier);
if (!Validate::isLoadedObject($carrier)) {
return false;
}
$configuration = new DpdGroupConfiguration();
$is_cod_method = $this->isCODCarrier((int) $this->id_carrier);
if ($is_cod_method && !$this->isCODCarrierAvailable($cart, $configuration, (int) $id_customer_country)) {
self::$carriers[$this->id_carrier][$cache_key] = false;
return false;
}
$carrier_shipping_method = $carrier->getShippingMethod();
$order_total_price = empty($products) ? $cart->getOrderTotal(false, Cart::BOTH_WITHOUT_SHIPPING) : $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, $products, $this->id_carrier);
$total_weight = empty($products) ? $cart->getTotalWeight() : $cart->getTotalWeight($products);
$cart_total = $carrier_shipping_method == Carrier::SHIPPING_METHOD_WEIGHT ? DpdGroupShipment::convertWeight($total_weight) : $order_total_price;
$price_rule = DpdGroupShipment::getPriceRule($cart_total, $id_method, $id_address_delivery, $is_cod_method);
$additional_shipping_cost = $this->calculateAdditionalShippingCost($cart, $products);
$additional_shipping_cost = Tools::convertPrice($additional_shipping_cost);
$handling_charges = $carrier->shipping_handling ? Configuration::get('PS_SHIPPING_HANDLING') : 0;
$handling_charges = Tools::convertPrice($handling_charges);
$price = false;
switch ($configuration->price_calculation_method) {
case DpdGroupConfiguration::PRICE_CALCULATION_PRESTASHOP:
$price = $this->getPriceByPrestaShopCalculationType($carrier_shipping_method, $carrier, $total_weight, $zone, $additional_shipping_cost, $handling_charges, $is_cod_method, $order_total_price, $configuration, $price_rule);
break;
case DpdGroupConfiguration::PRICE_CALCULATION_WEB_SERVICES:
$price = $this->getPriceByWebServicesCalculationType($cart, $is_cod_method, $order_total_price, $id_method, $id_address_delivery, $additional_shipping_cost, $handling_charges, $configuration, $price_rule, $products);
break;
case DpdGroupConfiguration::PRICE_CALCULATION_CSV:
$price = $this->getPriceByCSVCalculationType($price_rule, $order_total_price, $additional_shipping_cost, $handling_charges, $is_cod_method, $configuration);
break;
}
self::$carriers[$this->id_carrier][$cache_key] = $price;
return self::$carriers[$this->id_carrier][$cache_key];
}
示例9: getZoneByStateOrCountry
function getZoneByStateOrCountry($id_country, $id_state)
{
global $defaultCountry;
if (!isset($id_country) or intval($id_country) <= 0) {
$id_country = $defaultCountry->id;
}
$id_zone = 0;
if (isset($id_state) and intval($id_state) > 0) {
$result = Db::getInstance()->getRow('
SELECT `id_zone`
FROM `' . _DB_PREFIX_ . 'state`
WHERE `id_state` = ' . intval($id_state));
$id_zone = $result['id_zone'];
}
if (!isset($id_zone) or intval($id_zone) <= 0) {
$id_zone = Country::getIdZone($id_country);
}
return $id_zone;
}
示例10: carrierExists
/**
* Checks if a Dejala carrier already exists
*/
public static function carrierExists($dejalaConfig)
{
global $cookie;
$id_zone = 1;
$moduleCountryIsoCode = strtoupper($dejalaConfig->country);
$countryID = Country::getByIso($moduleCountryIsoCode);
if (intval($countryID)) {
$id_zone = Country::getIdZone($countryID);
}
$allCarriers = DejalaCarrierUtils::getCarriers(intval($cookie->id_lang), true, false, $id_zone, true);
foreach ($allCarriers as $carrier) {
if ($carrier['name'] == 'dejala' && $carrier['is_module'] == true) {
return true;
}
}
return false;
}
示例11: getDejalaCarrier
/**
* gets of a dejala carrier corresponding to $dejalaProduct
*/
public static function getDejalaCarrier($dejalaConfig, $dejalaProduct)
{
global $cookie;
$electedCarrier = NULL;
$totalCartWeight = floatval($dejalaProduct['max_weight']);
if ($totalCartWeight <= 0) {
$totalCartWeight = 3.99;
} else {
$totalCartWeight -= 0.01;
}
/** MFR090828 - compare to HT price (since DejalaCarrier has a tax_id) */
$vat_factor = 1 + $dejalaProduct['vat'] / 100;
$priceTTC = round($dejalaProduct['price'] * $vat_factor + $dejalaProduct['margin'], 2);
$priceHT = round($priceTTC / $vat_factor, 2);
$productPrice = $priceHT;
// MFR091130 - get id zone from the country used in the module (if the store zones were customized)
// default (Europe)
$id_zone = 1;
$moduleCountryIsoCode = strtoupper($dejalaConfig->country);
$countryID = Country::getByIso($moduleCountryIsoCode);
if (intval($countryID)) {
$id_zone = Country::getIdZone($countryID);
}
$allCarriers = DejalaCarrierUtils::getCarriers(intval($cookie->id_lang), true, false, $id_zone, true);
$electedCarrier = NULL;
foreach ($allCarriers as $carrier) {
if ($carrier['name'] == 'dejala' && $carrier['range_behavior'] && Configuration::get('PS_SHIPPING_METHOD') && Carrier::checkDeliveryPriceByWeight($carrier['id_carrier'], $totalCartWeight, $id_zone)) {
$mCarrier = new Carrier($carrier['id_carrier']);
if ($productPrice == $mCarrier->getDeliveryPriceByWeight($totalCartWeight, $id_zone)) {
if ($electedCarrier == NULL) {
$electedCarrier = $mCarrier;
} else {
if ($mCarrier->id < $electedCarrier->id) {
$electedCarrier = $mCarrier;
}
}
}
}
}
return $electedCarrier;
}
示例12: shippingCostRetrieveRequest
/**
* @param $iso_country_code
* @return null|string
*/
public function shippingCostRetrieveRequest($iso_country_code)
{
if ($iso_country_code) {
$cart = new Cart($this->id_cart);
if ($id_country = Country::getByIso($iso_country_code)) {
if ($id_zone = Country::getIdZone($id_country)) {
$carriers = Carrier::getCarriersForOrder($id_zone);
$currency = Currency::getCurrency($cart->id_currency);
if ($carriers) {
$carrier_list = array();
foreach ($carriers as $carrier) {
$c = new Carrier((int) $carrier['id_carrier']);
$shipping_method = $c->getShippingMethod();
$price = $shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $cart->getOrderShippingCost((int) $carrier['id_carrier']);
$price_tax_exc = $shipping_method == Carrier::SHIPPING_METHOD_FREE ? 0 : $cart->getOrderShippingCost((int) $carrier['id_carrier'], false);
$carrier_list[]['ShippingCost'] = array('Type' => $carrier['name'] . ' (' . $carrier['id_carrier'] . ')', 'CountryCode' => Tools::strtoupper($iso_country_code), 'Price' => array('Gross' => $this->toAmount($price), 'Net' => $this->toAmount($price_tax_exc), 'Tax' => $this->toAmount($price) - $this->toAmount($price_tax_exc), 'CurrencyCode' => Tools::strtoupper($currency['iso_code'])));
}
$shipping_cost = array('CountryCode' => Tools::strtoupper($iso_country_code), 'ShipToOtherCountry' => 'true', 'ShippingCostList' => $carrier_list);
$xml = OpenPayU::buildShippingCostRetrieveResponse($shipping_cost, $this->id_request, $iso_country_code);
return $xml;
} else {
Logger::addLog('carrier by id_zone is undefined');
}
}
}
}
return null;
}
示例13: startImport
public function startImport()
{
global $cookie;
@ini_set('max_execution_time', 0);
ini_set('memory_limit', '256M');
self::$_exportStartTime = time();
$this->_header = self::$_serviceData['header'] == 1;
self::$_sef = (int) Configuration::get('PS_REWRITING_SETTINGS');
self::$_exportStore = (int) self::$_serviceData['id_store'];
self::$_exportShop = (int) self::$_serviceData['id_shop'];
self::$_exportGroup = (int) self::$_serviceData['id_group'];
self::$_exportLanguage = (int) self::$_serviceData['id_lang'];
self::$_carrierId = (int) self::$_serviceData['id_carrier'];
self::$_carrierTax = self::getShippingTax(self::$_carrierId);
$carrier = new Carrier((int) self::$_carrierId);
self::$_carrierMethod = $carrier->getShippingMethod();
self::$_exportCountry = (int) self::$_serviceData['id_country'];
self::$_exportCurrency = (int) self::getCurrencyByCountry(self::$_exportCountry);
self::$_exportState = (int) self::$_serviceData['id_state'];
self::$_exportCondition = self::$_serviceData['condition'];
self::$_zone = Country::getIdZone(self::$_exportCountry);
self::$_billingMode = (int) Configuration::get('PS_SHIPPING_METHOD');
self::$_shippingCarrierData = self::getCarrierShippingRanges();
self::$_existingPictures = self::getExistingPictures();
self::$_existingCategories = self::getExistingCategories(self::$_exportLanguage);
self::$_specificPrices = self::getSpecificPrices(self::$_exportShop);
self::$_productPriorities = self::getProductsPriorities();
self::$_taxRates = self::getTaxes();
self::$_exportCategories = MoussiqFreeService::getCategories($this->service_id);
self::$_productCategories = self::getProductCategories();
self::$_exportLanguageObj = new Language(self::$_exportLanguage);
if (self::$_exportCurrency == 0) {
self::$_exportCurrency = (int) Configuration::get('PS_CURRENCY_DEFAULT');
}
if (sizeof(self::$_productCategories)) {
$chunk_size = 3000;
$current_size = 0;
$this->beforeImport(self::$_serviceData['template'], array());
do {
$products = self::getProducts(self::$_exportLanguage, $current_size, $chunk_size, 'date_add', 'ASC', false, self::$_serviceData['export_inactive'] == true ? false : true, self::$_exportCountry, self::$_exportShop, self::$_exportCondition);
$current_size += $chunk_size;
$fileName = $this->filename;
$fileDir = dirname(__FILE__) . '/../export/';
if (!self::checkDir($fileDir)) {
$this->_errors[] = Tools::displayError('The directory is not writeable');
return false;
}
foreach ($products as $product) {
if (array_key_exists($product['id_product'], self::$_productCategories)) {
$product['categories'] = self::$_productCategories[$product['id_product']];
$product['reduction'] = self::getProductSpecificPrice($product['id_product'], self::$_exportStore, Configuration::get('PS_CURRENCY_DEFAULT'), self::$_exportCountry, self::$_exportGroup);
$product['quantity'] = (int) StockAvailable::getQuantityAvailableByProduct($product['id_product'], null, self::$_exportShop);
//to fix, get cover id_image
$product['id_image'] = self::getProductCoverWs($product['id_product']);
$product['id_product_image'] = $product['id_product'];
$features = self::collectFeatures(self::$_exportLanguage, $product['id_product']);
if (is_array($features)) {
foreach ($features as $id_feature => $feature) {
$product['ft' . $id_feature] = trim($feature);
}
}
$this->addProductLine($product, self::$_serviceData['template']);
}
}
} while ($chunk_size == count($products));
$this->postProcess();
return $this->saveFile();
}
}
示例14: getCarriersOpc
/**
* @param int $id_country
* @param array $groups
* @return Array carriers list
* @deprecated
*/
public static function getCarriersOpc($id_country, $groups = null)
{
Tools::displayAsDeprecated();
return self::getCarriersForOrder((int) Country::getIdZone((int) $id_country), $groups);
}
示例15: getCarriersListByIdZone
public function getCarriersListByIdZone($id_country, $id_state = 0, $zipcode = 0)
{
// cookie saving/updating
$this->context->cookie->id_country = $id_country;
if ($id_state != 0) {
$this->context->cookie->id_state = $id_state;
}
if ($zipcode != 0) {
$this->context->cookie->postcode = $zipcode;
}
$id_zone = 0;
if ($id_state != 0) {
$id_zone = State::getIdZone($id_state);
}
if (!$id_zone) {
$id_zone = Country::getIdZone($id_country);
}
// Need to set the infos for carrier module !
$this->context->cookie->id_country = $id_country;
$this->context->cookie->id_state = $id_state;
$this->context->cookie->postcode = $zipcode;
$carriers = Carrier::getCarriersForOrder((int) $id_zone);
return sizeof($carriers) ? $carriers : array();
}