当前位置: 首页>>代码示例>>PHP>>正文


PHP Address::getZoneById方法代码示例

本文整理汇总了PHP中Address::getZoneById方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::getZoneById方法的具体用法?PHP Address::getZoneById怎么用?PHP Address::getZoneById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Address的用法示例。


在下文中一共展示了Address::getZoneById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $this->init();
     $this->preProcess();
     if (Tools::getValue('ajax') == 'true') {
         if (Tools::getIsset('summary')) {
             $result = array();
             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);
                     $id_zone = Address::getZoneById((int) $deliveryAddress->id);
                 }
                 if (!isset($id_zone)) {
                     $id_zone = (int) Country::getIdZone(isset($deliveryAddress) && (int) $deliveryAddress->id ? (int) $deliveryAddress->id_country : (int) _PS_COUNTRY_DEFAULT_);
                 }
                 $result['carriers'] = Carrier::getCarriersForOrder($id_zone, $groups);
                 $result['checked'] = Carrier::getDefaultCarrierSelection($result['carriers'], (int) self::$cart->id_carrier);
                 $result['HOOK_EXTRACARRIER'] = Module::hookExec('extraCarrier', array('address' => isset($deliveryAddress) && (int) $deliveryAddress->id ? $deliveryAddress : null));
             }
             $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();
     }
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:41,代码来源:CartController.php

示例2: cartToOrder

 private function cartToOrder($items, $foreignKey)
 {
     $this->alterTable('order');
     foreach ($items as $item) {
         $order = new Order();
         $order->id_carrier = (int) $item['id_carrier'];
         $order->id_customer = (int) $foreignKey['id_customer'][$item['id_customer']];
         $order->id_address_invoice = (int) $foreignKey['id_address_invoice'][$item['id_address_invoice']];
         $order->id_address_delivery = (int) $foreignKey['id_address_delivery'][$item['id_address_delivery']];
         $vat_address = new Address((int) $foreignKey['id_address_delivery'][$item['id_address_delivery']]);
         $id_zone = Address::getZoneById((int) $vat_address->id);
         $order->id_currency = (int) $item['id_currency'];
         $order->id_lang = (int) $item['id_lang'];
         $order->id_cart = (int) $foreignKey['id_cart'][$item['id_cart']];
         $customer = new Customer((int) $order->id_customer);
         $order->secure_key = pSQL($customer->secure_key);
         $order->payment = Tools::substr($item['payment'], 0, 32);
         if (isset($this->name)) {
             $order->module = $this->name;
         }
         $currency = new Currency($order->id_currency);
         $order->conversion_rate = $currency->conversion_rate;
         $order->total_products = (double) $item['total_products'];
         $order->total_products_wt = (double) $item['total_products_wt'];
         $order->total_discounts = (double) $item['total_discounts'];
         $order->total_shipping = (double) $item['total_shipping'];
         $order->carrier_tax_rate = (double) Tax::getCarrierTaxRate((int) $item['id_carrier'], (int) $item[Configuration::get('PS_TAX_ADDRESS_TYPE')]);
         $order->total_wrapping = (double) $item['total_wrapping'];
         $order->total_paid = (double) $item['total_paid'];
         $order->total_paid_real = (double) $item['total_paid_real'];
         $order->invoice_date = '0000-00-00 00:00:00';
         $order->delivery_date = '0000-00-00 00:00:00';
         $order->add();
         $this->saveMatchId('order', (int) $order->id, (int) $item['id_cart']);
     }
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:36,代码来源:shopimporter.php

示例3: cartToOrder

 private function cartToOrder($items, $foreignKey)
 {
     $this->alterTable('order');
     foreach ($items as $item) {
         $order = new Order();
         $order->id_carrier = (int) $item['id_carrier'];
         $order->id_customer = (int) $foreignKey['id_customer'][$item['id_customer']];
         $order->id_address_invoice = (int) $foreignKey['id_address_invoice'][$item['id_address_invoice']];
         $order->id_address_delivery = (int) $foreignKey['id_address_delivery'][$item['id_address_delivery']];
         $vat_address = new Address((int) $foreignKey['id_address_delivery'][$item['id_address_delivery']]);
         $id_zone = Address::getZoneById((int) $vat_address->id);
         $order->id_currency = (int) $item['id_currency'];
         $order->id_lang = (int) $item['id_lang'];
         $order->id_cart = (int) $foreignKey['id_cart'][$item['id_cart']];
         $customer = new Customer((int) $order->id_customer);
         $order->secure_key = pSQL($customer->secure_key);
         if (!strlen(trim($item['payment']))) {
             $order->payment = 'payment' . Tools::getValue('moduleName');
         } else {
             $order->payment = utf8_encode(html_entity_decode(strip_tags(Tools::substr($item['payment'], 0, 32))));
         }
         if (isset($this->name)) {
             $order->module = $this->name;
         }
         $carrier = new Carrier((int) $item['id_carrier']);
         $currency = new Currency($order->id_currency);
         $order->conversion_rate = !empty($currency->conversion_rate) ? $currency->conversion_rate : 1;
         $order->total_products = (double) $item['total_products'];
         $order->total_products_wt = (double) $item['total_products_wt'];
         $order->total_discounts = (double) $item['total_discounts'];
         $order->total_shipping = (double) $item['total_shipping'];
         $order->carrier_tax_rate = (double) $carrier->getTaxesRate(new Address((int) $item[Configuration::get('PS_TAX_ADDRESS_TYPE')]));
         $order->total_wrapping = (double) $item['total_wrapping'];
         $order->total_paid = (double) $item['total_paid'];
         $order->total_paid_real = (double) $item['total_paid_real'];
         $order->invoice_date = '0000-00-00 00:00:00';
         $order->delivery_date = '0000-00-00 00:00:00';
         if (array_key_exists('date_add', $item)) {
             $order->date_add = $item['date_add'];
         }
         if (array_key_exists('date_upd', $item)) {
             $order->date_upd = $item['date_upd'];
         }
         //test valid paid
         if ($item['total_paid'] == $item['total_paid_real']) {
             $order->valid = 1;
         } else {
             $order->valid = 0;
         }
         $order->save(false, false);
         $this->saveMatchId('order', (int) $order->id, (int) $item['id_cart']);
     }
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:53,代码来源:shopimporter.php

示例4: hookExtraCarrier

 public function hookExtraCarrier($params)
 {
     // TODO : Makes it work with multi-shipping
     if (!MondialRelay::isAccountSet()) {
         return '';
     }
     $id_carrier = false;
     $preSelectedRelay = $this->getRelayPointSelected($this->context->cart->id);
     $carriersList = MondialRelay::_getCarriers();
     $address = new Address($this->context->cart->id_address_delivery);
     $id_zone = Address::getZoneById((int) $address->id);
     // Check if the defined carrier are ok
     foreach ($carriersList as $k => $row) {
         // For now works only with single shipping (>= 1.5 compatibility)
         if (method_exists($this->context->cart, 'carrierIsSelected')) {
             if ($this->context->cart->carrierIsSelected($row['id_carrier'], $params['address']->id)) {
                 $id_carrier = $row['id_carrier'];
             }
         }
         // Temporary carrier for some test
         $carrier = new Carrier((int) $row['id_carrier']);
         if (Configuration::get('PS_SHIPPING_METHOD') && $carrier->getMaxDeliveryPriceByWeight($id_zone) === false || !Configuration::get('PS_SHIPPING_METHOD') && $carrier->getMaxDeliveryPriceByPrice($id_zone) === false) {
             unset($carriersList[$k]);
         } else {
             if ($row['range_behavior']) {
                 // Get id zone
                 $id_zone = isset($this->context->cart->id_address_delivery) && $this->context->cart->id_address_delivery ? Address::getZoneById((int) $this->context->cart->id_address_delivery) : (int) $this->context->country->id_zone;
                 if (Configuration::get('PS_SHIPPING_METHOD') && !Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $this->context->cart->getTotalWeight(), $id_zone) || !Configuration::get('PS_SHIPPING_METHOD') && (!Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $this->context->cart->getOrderTotal(true, MondialRelay::BOTH_WITHOUT_SHIPPING), $id_zone, $this->context->cart->id_currency) || !Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $this->context->cart->getOrderTotal(true, MondialRelay::BOTH_WITHOUT_SHIPPING), $id_zone, $this->context->cart->id_currency))) {
                     unset($carriersList[$k]);
                 }
             }
         }
     }
     $carrier = NULL;
     if (_PS_VERSION_ >= '1.5') {
         $id_carrier = (int) $this->context->cart->id_carrier;
     }
     if ($id_carrier && ($method = MondialRelay::getMethodByIdCarrier($id_carrier))) {
         $carrier = new Carrier((int) $id_carrier);
         // Add dynamically a new field
         $carrier->id_mr_method = $method['id_mr_method'];
         $carrier->mr_dlv_mode = $method['dlv_mode'];
     }
     $this->context->smarty->assign(array('MR_Data' => MRTools::jsonEncode(array('carrier_list' => $carriersList, 'carrier' => $carrier, 'PS_VERSION' => _PS_VERSION_, 'pre_selected_relay' => isset($preSelectedRelay['MR_selected_num']) ? $preSelectedRelay['MR_selected_num'] : 0))));
     return $this->fetchTemplate('/tpl/', 'checkout_process');
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:46,代码来源:mondialrelay.php

示例5: _assignCarrier

 protected function _assignCarrier()
 {
     $address = new Address($this->context->cart->id_address_delivery);
     $id_zone = Address::getZoneById($address->id);
     $carriers = $this->context->cart->simulateCarriersOutput(null, true);
     $checked = $this->context->cart->simulateCarrierSelectedOutput(false);
     $delivery_option_list = $this->context->cart->getDeliveryOptionList();
     $this->setDefaultCarrierSelection($delivery_option_list);
     $this->context->smarty->assign(array('address_collection' => $this->context->cart->getAddressCollection(), 'delivery_option_list' => $delivery_option_list, 'carriers' => $carriers, 'checked' => $checked, 'delivery_option' => $this->context->cart->getDeliveryOption(null, false)));
     $vars = array('HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array('carriers' => $carriers, 'checked' => $checked, 'delivery_option_list' => $delivery_option_list, 'delivery_option' => $this->context->cart->getDeliveryOption(null, false))));
     Cart::addExtraCarriers($vars);
     $this->context->smarty->assign($vars);
 }
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:13,代码来源:ParentOrderController.php

示例6: 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));
 }
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:41,代码来源:Tax.php

示例7: checkSoCarrierAvailable

 private function checkSoCarrierAvailable($id_carrier)
 {
     global $cart, $defaultCountry;
     $carrier = new Carrier((int) $id_carrier);
     $address = new Address((int) $cart->id_address_delivery);
     $id_zone = Address::getZoneById((int) $address->id);
     // Get only carriers that are compliant with shipping method
     if (Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByWeight($id_zone) === false or !Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByPrice($id_zone) === false) {
         return false;
     }
     // If out-of-range behavior carrier is set on "Desactivate carrier"
     if ($carrier->range_behavior) {
         // Get id zone
         if (isset($cart->id_address_delivery) and $cart->id_address_delivery) {
             $id_zone = Address::getZoneById((int) $cart->id_address_delivery);
         } else {
             $id_zone = (int) $defaultCountry->id_zone;
         }
         // Get only carriers that have a range compatible with cart
         if (Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByWeight((int) $carrier->id, $cart->getTotalWeight(), $id_zone) or !Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByPrice((int) $carrier->id, $cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING), $id_zone, $cart->id_currency)) {
             return false;
         }
     }
     return true;
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:25,代码来源:socolissimo.php

示例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];
 }
开发者ID:remixaz,项目名称:dpdgroup,代码行数:54,代码来源:dpdgroup.php

示例9: _assignCarrier

 protected function _assignCarrier()
 {
     $address = new Address($this->context->cart->id_address_delivery);
     $id_zone = Address::getZoneById($address->id);
     if (!Address::isCountryActiveById((int) $this->context->cart->id_address_delivery) || !Address::isCountryActiveById((int) $this->context->cart->id_address_invoice)) {
         Tools::redirect('index.php?controller=order&step=1');
     }
     $carriers = $this->context->cart->simulateCarriersOutput();
     $checked = $this->context->cart->simulateCarrierSelectedOutput();
     $delivery_option_list = $this->context->cart->getDeliveryOptionList();
     $this->setDefaultCarrierSelection($delivery_option_list);
     $this->context->smarty->assign(array('address_collection' => $this->context->cart->getAddressCollection(), 'delivery_option_list' => $delivery_option_list, 'carriers' => $carriers, 'checked' => $checked, 'delivery_option' => $this->context->cart->getDeliveryOption(null, false)));
     $vars = array('HOOK_BEFORECARRIER' => Hook::exec('displayBeforeCarrier', array('carriers' => $carriers, 'checked' => $checked, 'delivery_option_list' => $delivery_option_list, 'delivery_option' => $this->context->cart->getDeliveryOption(null, false))));
     Cart::addExtraCarriers($vars);
     $this->context->smarty->assign($vars);
 }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:16,代码来源:ParentOrderController.php

示例10: getCarriers

 public function getCarriers()
 {
     global $cookie, $cart;
     // code taken from ParentOrderController::_assignCarrier()
     $customer = new Customer((int) $cookie->id_customer);
     $address = new Address((int) $cart->id_address_delivery);
     $id_zone = Address::getZoneById((int) $address->id);
     $carriers = Carrier::getCarriersForOrder($id_zone, $customer->getGroups());
     return $carriers;
 }
开发者ID:madeny,项目名称:cartapi-plugin-prestashop,代码行数:10,代码来源:Order.php

示例11: TaxTab

 /**
  * Tax table
  */
 public function TaxTab()
 {
     if (!($id_zone = Address::getZoneById(intval(self::$order->id_address_invoice)))) {
         die(Tools::displayError());
     }
     if (self::$order->total_paid == '0.00' or !intval(Configuration::get('PS_TAX'))) {
         return;
     }
     // Setting products tax
     if (isset(self::$order->products) and sizeof(self::$order->products)) {
         $products = self::$order->products;
     } else {
         $products = self::$order->getProducts();
     }
     $totalWithTax = array();
     $totalWithoutTax = array();
     $amountWithoutTax = 0;
     $taxes = array();
     /* Firstly calculate all prices */
     foreach ($products as &$product) {
         if (!isset($totalWithTax[$product['tax_rate']])) {
             $totalWithTax[$product['tax_rate']] = 0;
         }
         if (!isset($totalWithoutTax[$product['tax_rate']])) {
             $totalWithoutTax[$product['tax_rate']] = 0;
         }
         if (!isset($taxes[$product['tax_rate']])) {
             $taxes[$product['tax_rate']] = 0;
         }
         /* Without tax */
         $product['priceWithoutTax'] = floatval($product['product_price']) * intval($product['product_quantity']);
         $amountWithoutTax += $product['priceWithoutTax'];
         /* With tax */
         $product['priceWithTax'] = $product['priceWithoutTax'] * (1 + floatval($product['tax_rate']) / 100);
     }
     $tmp = 0;
     $product =& $tmp;
     /* And secondly assign to each tax its own reduction part */
     $discountAmount = floatval(self::$order->total_discounts);
     foreach ($products as $product) {
         $ratio = $amountWithoutTax == 0 ? 0 : $product['priceWithoutTax'] / $amountWithoutTax;
         $priceWithTaxAndReduction = $product['priceWithTax'] - $discountAmount * $ratio;
         $vat = $priceWithTaxAndReduction - $priceWithTaxAndReduction / (floatval($product['tax_rate']) / 100 + 1);
         $taxes[$product['tax_rate']] += $vat;
         $totalWithTax[$product['tax_rate']] += $priceWithTaxAndReduction;
         $totalWithoutTax[$product['tax_rate']] += $priceWithTaxAndReduction - $vat;
     }
     $carrier = new Carrier(self::$order->id_carrier);
     $carrierTax = new Tax($carrier->id_tax);
     if ($totalWithoutTax == $totalWithTax and (!$carrierTax->rate or $carrierTax->rate == '0.00') and (!self::$order->total_wrapping or self::$order->total_wrapping == '0.00')) {
         return;
     }
     // Displaying header tax
     $header = array(self::l('Tax detail'), self::l('Tax %'), self::l('Pre-Tax Total'), self::l('Total Tax'), self::l('Total with Tax'));
     $w = array(60, 30, 40, 30, 30);
     $this->SetFont(self::fontname(), 'B', 8);
     for ($i = 0; $i < sizeof($header); $i++) {
         $this->Cell($w[$i], 5, $header[$i], 0, 0, 'R');
     }
     $this->Ln();
     $this->SetFont(self::fontname(), '', 7);
     $nb_tax = 0;
     // Display product tax
     if (intval(Configuration::get('PS_TAX')) and self::$order->total_paid != '0.00') {
         foreach ($taxes as $tax_rate => $vat) {
             if ($tax_rate == '0.00' or $totalWithTax[$tax_rate] == '0.00') {
                 continue;
             }
             $nb_tax++;
             $before = $this->GetY();
             $lineSize = $this->GetY() - $before;
             $this->SetXY($this->GetX(), $this->GetY() - $lineSize + 3);
             $this->Cell($w[0], $lineSize, self::l('Products'), 0, 0, 'R');
             $this->Cell($w[1], $lineSize, number_format($tax_rate, 2, ',', ' '), 0, 0, 'R');
             $this->Cell($w[2], $lineSize, self::convertSign(Tools::displayPrice($totalWithoutTax[$tax_rate], self::$currency, true, false)), 0, 0, 'R');
             $this->Cell($w[3], $lineSize, self::convertSign(Tools::displayPrice($vat, self::$currency, true, false)), 0, 0, 'R');
             $this->Cell($w[4], $lineSize, self::convertSign(Tools::displayPrice($totalWithTax[$tax_rate], self::$currency, true, false)), 0, 0, 'R');
             $this->Ln();
         }
     }
     // Display carrier tax
     if ($carrierTax->rate and $carrierTax->rate != '0.00' and self::$order->total_shipping != '0.00' and Tax::zoneHasTax(intval($carrier->id_tax), intval($id_zone))) {
         $nb_tax++;
         $total_shipping_wt = self::$order->total_shipping / (1 + $carrierTax->rate / 100);
         $before = $this->GetY();
         $lineSize = $this->GetY() - $before;
         $this->SetXY($this->GetX(), $this->GetY() - $lineSize + 3);
         $this->Cell($w[0], $lineSize, self::l('Carrier'), 0, 0, 'R');
         $this->Cell($w[1], $lineSize, number_format($carrierTax->rate, 2, ',', ' '), 0, 0, 'R');
         $this->Cell($w[2], $lineSize, self::convertSign(Tools::displayPrice($total_shipping_wt, self::$currency, true, false)), 0, 0, 'R');
         $this->Cell($w[3], $lineSize, self::convertSign(Tools::displayPrice(self::$order->total_shipping - $total_shipping_wt, self::$currency, true, false)), 0, 0, 'R');
         $this->Cell($w[4], $lineSize, self::convertSign(Tools::displayPrice(self::$order->total_shipping, self::$currency, true, false)), 0, 0, 'R');
         $this->Ln();
     }
     // Display wrapping tax
     if (self::$order->total_wrapping and self::$order->total_wrapping != '0.00') {
         $nb_tax++;
//.........这里部分代码省略.........
开发者ID:sealence,项目名称:local,代码行数:101,代码来源:PDF.php

示例12: _assignCarrier

 protected function _assignCarrier()
 {
     $customer = new Customer((int) self::$cookie->id_customer);
     $address = new Address((int) self::$cart->id_address_delivery);
     $id_zone = Address::getZoneById((int) $address->id);
     $carriers = Carrier::getCarriersForOrder($id_zone, $customer->getGroups());
     self::$smarty->assign(array('checked' => $this->_setDefaultCarrierSelection($carriers), 'carriers' => $carriers, 'default_carrier' => (int) Configuration::get('PS_CARRIER_DEFAULT'), 'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address)), 'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers))));
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:8,代码来源:ParentOrderController.php

示例13: displayCarrier

function displayCarrier()
{
    global $smarty, $cart, $cookie, $defaultCountry, $link;
    $address = new Address(intval($cart->id_address_delivery));
    $id_zone = Address::getZoneById(intval($address->id));
    if (isset($cookie->id_customer)) {
        $customer = new Customer(intval($cookie->id_customer));
    } else {
        die(Tools::displayError($this->l('Fatal error: No customer')));
    }
    $result = Carrier::getCarriers(intval($cookie->id_lang), true, false, intval($id_zone), $customer->getGroups());
    if (!$result) {
        $result = Carrier::getCarriers(intval($cookie->id_lang), true, false, intval($id_zone));
    }
    $resultsArray = array();
    foreach ($result as $k => $row) {
        $carrier = new Carrier(intval($row['id_carrier']));
        // Get only carriers that are compliant with shipping method
        if (Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByWeight($id_zone) === false or !Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByPrice($id_zone) === false) {
            unset($result[$k]);
            continue;
        }
        // If out-of-range behavior carrier is set on "Desactivate carrier"
        if ($row['range_behavior']) {
            // Get id zone
            if (isset($cart->id_address_delivery) and $cart->id_address_delivery) {
                $id_zone = Address::getZoneById(intval($cart->id_address_delivery));
            } else {
                $id_zone = intval($defaultCountry->id_zone);
            }
            // Get only carriers that have a range compatible with cart
            if (Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $cart->getTotalWeight(), $id_zone) or !Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $cart->getOrderTotal(true, 4), $id_zone)) {
                unset($result[$k]);
                continue;
            }
        }
        $row['name'] = strval($row['name']) != '0' ? $row['name'] : Configuration::get('PS_SHOP_NAME');
        $row['price'] = $cart->getOrderShippingCost(intval($row['id_carrier']));
        $row['price_tax_exc'] = $cart->getOrderShippingCost(intval($row['id_carrier']), false);
        $row['img'] = file_exists(_PS_SHIP_IMG_DIR_ . intval($row['id_carrier']) . '.jpg') ? _THEME_SHIP_DIR_ . intval($row['id_carrier']) . '.jpg' : '';
        $resultsArray[] = $row;
    }
    // Wrapping fees
    $wrapping_fees = floatval(Configuration::get('PS_GIFT_WRAPPING_PRICE'));
    $wrapping_fees_tax = new Tax(intval(Configuration::get('PS_GIFT_WRAPPING_TAX')));
    $wrapping_fees_tax_inc = $wrapping_fees * (1 + floatval($wrapping_fees_tax->rate) / 100);
    if (Validate::isUnsignedInt($cart->id_carrier) and $cart->id_carrier) {
        $carrier = new Carrier(intval($cart->id_carrier));
        if ($carrier->active and !$carrier->deleted) {
            $checked = intval($cart->id_carrier);
        }
    }
    $cms = new CMS(3, intval($cookie->id_lang));
    $link_conditions = $link->getCMSLink($cms, $cms->link_rewrite);
    if (!strpos($link_conditions, '?')) {
        $link_conditions .= '?content_only=1&TB_iframe=true&width=450&height=500&thickbox=true';
    } else {
        $link_conditions .= '&content_only=1&TB_iframe=true&width=450&height=500&thickbox=true';
    }
    if (!isset($checked) or intval($checked) == 0) {
        $checked = intval(Configuration::get('PS_CARRIER_DEFAULT'));
    }
    $smarty->assign(array('checkedTOS' => intval($cookie->checkedTOS), 'recyclablePackAllowed' => intval(Configuration::get('PS_RECYCLABLE_PACK')), 'giftAllowed' => intval(Configuration::get('PS_GIFT_WRAPPING')), 'conditions' => intval(Configuration::get('PS_CONDITIONS')), 'link_conditions' => $link_conditions, 'recyclable' => intval($cart->recyclable), 'gift_wrapping_price' => floatval(Configuration::get('PS_GIFT_WRAPPING_PRICE')), 'carriers' => $resultsArray, 'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address)), 'checked' => intval($checked), 'total_wrapping' => Tools::convertPrice($wrapping_fees_tax_inc, new Currency(intval($cookie->id_currency))), 'total_wrapping_tax_exc' => Tools::convertPrice($wrapping_fees, new Currency(intval($cookie->id_currency)))));
    Tools::safePostVars();
    $css_files = array(__PS_BASE_URI__ . 'css/thickbox.css' => 'all');
    $js_files = array(__PS_BASE_URI__ . 'js/jquery/thickbox-modified.js');
    include_once dirname(__FILE__) . '/header.php';
    $smarty->display(_PS_THEME_DIR_ . 'order-carrier.tpl');
}
开发者ID:vincent,项目名称:theinvertebrates,代码行数:69,代码来源:order.php

示例14: hookextraCarrier

 public function hookextraCarrier($params)
 {
     global $smarty, $cart, $cookie, $defaultCountry, $nbcarriers;
     if (Configuration::get('MR_ENSEIGNE_WEBSERVICE') == '' || Configuration::get('MR_CODE_MARQUE') == '' || Configuration::get('MR_KEY_WEBSERVICE') == '' || Configuration::get('MR_LANGUAGE') == '') {
         return '';
     }
     $address = new Address((int) $cart->id_address_delivery);
     $id_zone = Address::getZoneById((int) $address->id);
     $carriersList = self::_getCarriers();
     // Check if the defined carrier are ok
     foreach ($carriersList as $k => $row) {
         $carrier = new Carrier((int) $row['id_carrier']);
         if ((Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByWeight($id_zone) === false) || (!Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByPrice($id_zone) === false)) {
             unset($carriersList[$k]);
         } else {
             if ($row['range_behavior']) {
                 // Get id zone
                 $id_zone = (isset($cart->id_address_delivery) and $cart->id_address_delivery) ? Address::getZoneById((int) $cart->id_address_delivery) : (int) $defaultCountry->id_zone;
                 if (Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $cart->getTotalWeight(), $id_zone) or !Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $cart->getOrderTotal(true, self::BOTH_WITHOUT_SHIPPING), $id_zone, $cart->id_currency)) {
                     unset($carriersList[$k]);
                 }
             }
         }
     }
     $preSelectedRelay = $this->getRelayPointSelected($params['cart']->id);
     $smarty->assign(array('one_page_checkout' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0, 'new_base_dir' => self::$moduleURL, 'MRToken' => self::$MRFrontToken, 'carriersextra' => $carriersList, 'preSelectedRelay' => isset($preSelectedRelay['MR_selected_num']) ? $preSelectedRelay['MR_selected_num'] : '', 'jQueryOverload' => self::getJqueryCompatibility(false)));
     return $this->display(__FILE__, 'mondialrelay.tpl');
 }
开发者ID:ricardo-rdfs,项目名称:Portal-BIP,代码行数:28,代码来源:mondialrelay.php

示例15: hookextraCarrier

 public function hookextraCarrier($params)
 {
     global $smarty, $cart, $cookie, $defaultCountry, $nbcarriers;
     if (Configuration::get('MR_ENSEIGNE_WEBSERVICE') == '' or Configuration::get('MR_CODE_MARQUE') == '' or Configuration::get('MR_KEY_WEBSERVICE') == '' or Configuration::get('MR_LANGUAGE') == '') {
         return '';
     }
     $totalweight = Configuration::get('MR_WEIGHT_COEF') * $cart->getTotalWeight();
     if (Validate::isUnsignedInt($cart->id_carrier)) {
         $carrier = new Carrier((int) $cart->id_carrier);
         if ($carrier->active and !$carrier->deleted) {
             $checked = (int) $cart->id_carrier;
         }
     }
     if (!isset($checked) or $checked == 0) {
         $checked = (int) Configuration::get('PS_CARRIER_DEFAULT');
     }
     $address = new Address((int) $cart->id_address_delivery);
     $id_zone = Address::getZoneById((int) $address->id);
     $country = new Country((int) $address->id_country);
     $query = self::getmrth((int) $cookie->id_lang, true, (int) $country->id_zone, $country->iso_code);
     $resultsArray = array();
     $i = 0;
     foreach ($query as $k => $row) {
         $carrier = new Carrier((int) $row['id_carrier']);
         if (Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByWeight($id_zone) === false or !Configuration::get('PS_SHIPPING_METHOD') and $carrier->getMaxDeliveryPriceByPrice($id_zone) === false) {
             unset($result[$k]);
             continue;
         }
         if ($row['range_behavior']) {
             // Get id zone
             if (isset($cart->id_address_delivery) and $cart->id_address_delivery) {
                 $id_zone = Address::getZoneById((int) $cart->id_address_delivery);
             } else {
                 $id_zone = (int) $defaultCountry->id_zone;
             }
             if (Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $cart->getTotalWeight(), $id_zone) or !Configuration::get('PS_SHIPPING_METHOD') and !Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $cart->getOrderTotal(true, self::BOTH_WITHOUT_SHIPPING), $id_zone, $cart->id_currency)) {
                 unset($result[$k]);
                 continue;
             }
         }
         $settings = Db::getInstance()->ExecuteS('SELECT * FROM `' . _DB_PREFIX_ . 'mr_method` WHERE `id_carrier` = ' . (int) $row['id_carrier']);
         $row['name'] = $settings[0]['mr_Name'];
         $row['col'] = $settings[0]['mr_ModeCol'];
         $row['liv'] = $settings[0]['mr_ModeLiv'];
         $row['ass'] = $settings[0]['mr_ModeAss'];
         $row['price'] = $cart->getOrderShippingCost((int) $row['id_carrier']);
         $row['img'] = file_exists(_PS_SHIP_IMG_DIR_ . (int) $row['id_carrier'] . '.jpg') ? _THEME_SHIP_DIR_ . (int) $row['id_carrier'] . '.jpg' : '';
         $resultsArray[] = $row;
         $i++;
     }
     if ($i > 0) {
         include_once _PS_MODULE_DIR_ . 'mondialrelay/page_iso.php';
         $smarty->assign(array('address_map' => $address->address1 . ', ' . $address->postcode . ', ' . ote_accent($address->city) . ', ' . $country->iso_code, 'input_cp' => $address->postcode, 'input_ville' => ote_accent($address->city), 'input_pays' => $country->iso_code, 'input_poids' => Configuration::get('MR_WEIGHT_COEF') * $cart->getTotalWeight(), 'nbcarriers' => $nbcarriers, 'checked' => (int) $checked, 'google_api_key' => Configuration::get('MR_GOOGLE_MAP'), 'one_page_checkout' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0, 'new_base_dir' => self::$moduleURL, 'carriersextra' => $resultsArray));
         $nbcarriers = $nbcarriers + $i;
         return $this->display(__FILE__, 'mondialrelay.tpl');
     }
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:57,代码来源:mondialrelay.php


注:本文中的Address::getZoneById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。