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


PHP Carrier::getTaxesRate方法代码示例

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


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

示例1: 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

示例2: updateOrder

 private function updateOrder($neteven_order, $neteven_orders)
 {
     if ($id_order = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT `id_order` FROM `' . _DB_PREFIX_ . 'orders_gateway` WHERE `id_order_neteven` = ' . (int) $neteven_order->OrderID)) {
         $total_wt = 0;
         $total_product = 0;
         $total_product_wt = 0;
         foreach ($neteven_orders as $neteven_order_temp) {
             if (in_array($neteven_order_temp->Status, $this->getValue('t_list_order_status_retraite_order'))) {
                 continue;
             }
             if ($neteven_order_temp->OrderID == $neteven_order->OrderID) {
                 $total_product += floatval($neteven_order_temp->Price->_) - floatval($neteven_order_temp->VAT->_);
                 $total_product_wt += floatval($neteven_order_temp->Price->_);
             }
         }
         $order = new Order((int) $id_order);
         if (!$order->id_carrier) {
             $order->id_carrier = (int) Configuration::get('PS_CARRIER_DEFAULT');
         }
         $carrier = new Carrier((int) $order->id_carrier);
         $carrier_tax_rate = $carrier->getTaxesRate(new Address($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
         $total_shipping_tax_excl = $carrier_tax_rate ? $neteven_order->OrderShippingCost->_ / ($carrier_tax_rate / 100) : $neteven_order->OrderShippingCost->_;
         $total_wt = $total_product_wt + $neteven_order->OrderShippingCost->_;
         $total = $total_product + $total_shipping_tax_excl;
         $order->total_products = (double) number_format($total_product, 2, '.', '');
         $order->total_products_wt = (double) number_format($total_product_wt, 2, '.', '');
         $order->total_shipping_tax_excl = (double) number_format($total_shipping_tax_excl, 2, '.', '');
         $order->total_shipping_tax_incl = (double) number_format($neteven_order->OrderShippingCost->_, 2, '.', '');
         $order->total_shipping = (double) number_format($neteven_order->OrderShippingCost->_, 2, '.', '');
         $order->total_paid_tax_excl = (double) number_format($total, 2, '.', '');
         $order->total_paid_tax_incl = (double) number_format($total_wt, 2, '.', '');
         $order->total_paid_real = (double) number_format($total_wt, 2, '.', '');
         $order->total_paid = (double) number_format($total_wt, 2, '.', '');
         $order->carrier_tax_rate = (double) number_format($carrier_tax_rate, 2, '.', '');
         $order->save();
     }
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:37,代码来源:GatewayOrder.php

示例3: _getCarriers

 /**
  * create carriers
  *
  * @return mixed
  */
 protected function _getCarriers()
 {
     $resultsCarrier = array();
     $mobileCarrierUse = unserialize(base64_decode(Configuration::get('SG_MOBILE_CARRIER')));
     if ($this->_deliveryAddress) {
         foreach (Carrier::getCarriersForOrder(Address::getZoneById($this->_deliveryAddress->id), $this->getPlugin()->getContext()->customer->getGroups(), $this->getPlugin()->getContext()->cart) as $carrier) {
             /** @var CarrierCore $carrierItem */
             $carrierItem = new Carrier($carrier['id_carrier'], $this->getPlugin()->getContext()->language->id);
             $taxRulesGroup = new TaxRulesGroup($carrierItem->id_tax_rules_group);
             $resultCarrier = new ShopgateShippingMethod();
             /**
              * check is defined as mobile carrier
              */
             $idColumn = version_compare(_PS_VERSION_, '1.5.0.1', '>=') ? 'id_reference' : 'id_carrier';
             if (is_array($mobileCarrierUse) && empty($mobileCarrierUse[$carrier[$idColumn]])) {
                 continue;
             }
             $resultCarrier->setId($carrier['id_carrier']);
             $resultCarrier->setTitle($carrier['name']);
             $resultCarrier->setDescription($carrier['delay']);
             $resultCarrier->setSortOrder($carrier['position']);
             $resultCarrier->setAmount($carrier['price_tax_exc']);
             $resultCarrier->setAmountWithTax($carrier['price']);
             $resultCarrier->setTaxClass($taxRulesGroup->name);
             if (version_compare(_PS_VERSION_, '1.5.0', '<')) {
                 $carrierTax = Tax::getCarrierTaxRate($carrierItem->id, $this->_deliveryAddress->id);
             } else {
                 $carrierTax = $carrierItem->getTaxesRate($this->_deliveryAddress);
             }
             $resultCarrier->setTaxPercent($carrierTax);
             $resultCarrier->setInternalShippingInfo(serialize(array('carrierId' => $carrier['id_carrier'])));
             $resultsCarrier[] = $resultCarrier;
         }
     }
     return $resultsCarrier;
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:41,代码来源:Json.php

示例4: getCarriersByZoneID

 function getCarriersByZoneID($id_zone)
 {
     global $cookie, $cart;
     $id_groups = array(1);
     $islogged = _PS_VERSION_ > '1.5' ? Context::getContext()->customer->isLogged() : $cookie->isLogged();
     if ($islogged) {
         $customer = new Customer((int) $cookie->id_customer);
         $id_groups = $customer->getGroups();
     }
     $result = Carrier::getCarriers(intval($cookie->id_lang), true, false, intval($id_zone), $id_groups, Carrier::ALL_CARRIERS);
     $resultsArray = array();
     foreach ($result as $k => $row) {
         $carrier = new Carrier(intval($row['id_carrier']));
         $shipping_method = $carrier->getShippingMethod();
         if ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT and $carrier->getMaxDeliveryPriceByWeight($id_zone) === false or $shipping_method == Carrier::SHIPPING_METHOD_PRICE and $carrier->getMaxDeliveryPriceByPrice($id_zone) === false) {
             unset($result[$k]);
             continue;
         }
         if ($row['range_behavior']) {
             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, Cart::BOTH_WITHOUT_SHIPPING), $id_zone)) {
                 unset($result[$k]);
                 continue;
             }
         }
         $row['name'] = strval($row['name']) != '0' ? $row['name'] : Configuration::get('PS_SHOP_NAME');
         $method = $carrier->getShippingMethod();
         $row['price'] = 0;
         if ($method == Carrier::SHIPPING_METHOD_PRICE) {
             $row['price'] = $carrier->getDeliveryPriceByPrice($cart->getOrderTotal(Cart::BOTH_WITHOUT_SHIPPING), $id_zone);
         } else {
             if ($method == Carrier::SHIPPING_METHOD_WEIGHT) {
                 $row['price'] = $carrier->getDeliveryPriceByWeight($cart->getTotalWeight(), $id_zone);
             }
         }
         if ((int) $row['shipping_handling'] == 1) {
             $row['price'] = (double) $row['price'] + (double) Configuration::get('PS_SHIPPING_HANDLING');
         }
         if ((int) $row['is_free']) {
             $row['price'] = 0;
         }
         $row['price_tax_exc'] = $row['price'];
         $address = new Address($cart->id_address_delivery);
         $tax_rate = $carrier->getTaxesRate($address);
         $currency = new Currency($cart->id_currency);
         $row['price'] = $row['price'] * $currency->conversion_rate * (1 + (double) $tax_rate / 100);
         $row['img'] = file_exists(_PS_SHIP_IMG_DIR_ . intval($row['id_carrier']) . '.jpg') ? _THEME_SHIP_DIR_ . intval($row['id_carrier']) . '.jpg' : '';
         $resultsArray[] = $row;
     }
     return $resultsArray;
 }
开发者ID:ecssjapan,项目名称:guiding-you-afteropen,代码行数:50,代码来源:agilepaypalbase.php

示例5: createOrder

 /**
  * Creating of the PrestaShop order
  * @param $neteven_order
  * @param $neteven_orders
  * @return int
  */
 private function createOrder($neteven_order, $neteven_orders)
 {
     if (constant('_PS_VERSION_') >= 1.5) {
         include_once dirname(__FILE__) . '/OrderInvoiceOverride.php';
     }
     // Treatment of customer
     $id_customer = $this->addCustomerInBDD($neteven_order);
     if ($this->time_analyse) {
         $this->current_time_2 = time();
         Toolbox::displayDebugMessage(self::getL('Customer') . ' : ' . ((int) $this->current_time_2 - (int) $this->current_time_0) . 's');
     }
     // Treatment of addresses of the customer
     $id_address_billing = $this->addAddresseInBDD($neteven_order->OrderID, $neteven_order->BillingAddress, 'facturation', $id_customer);
     $id_address_shipping = $this->addAddresseInBDD($neteven_order->OrderID, $neteven_order->ShippingAddress, 'livraison', $id_customer);
     if ($this->time_analyse) {
         $this->current_time_0 = time();
         Toolbox::displayDebugMessage(self::getL('Address') . ' : ' . ((int) $this->current_time_0 - (int) $this->current_time_2) . 's');
     }
     // Get secure key of customer
     $secure_key_default = md5(uniqid(rand(), true));
     if ($secure_key = Db::getInstance()->getValue('SELECT `secure_key` FROM `' . _DB_PREFIX_ . 'customer` WHERE `id_customer` = ' . (int) $id_customer)) {
         $secure_key_default = $secure_key;
     } else {
         Toolbox::addLogLine(self::getL('Problem with a secure key recovery for the customer / NetEven Order Id') . ' ' . $neteven_order->OrderID);
     }
     // Treatment of order informations
     $total_wt = 0;
     $total_product = 0;
     $total_product_wt = 0;
     foreach ($neteven_orders as $neteven_order_temp) {
         if ($neteven_order_temp->OrderID == $neteven_order->OrderID) {
             if (in_array($neteven_order_temp->Status, $this->getValue('t_list_order_status'))) {
                 continue;
             }
             $total_product += floatval($neteven_order_temp->Price->_) - floatval($neteven_order_temp->VAT->_);
             $total_product_wt += floatval($neteven_order_temp->Price->_);
         }
     }
     $total_wt = $total_product_wt + $neteven_order->OrderShippingCost->_;
     $date_now = date('Y-m-d H:i:s');
     if ($this->time_analyse) {
         $this->current_time_2 = time();
         Toolbox::displayDebugMessage(self::getL('Order total') . ' : ' . ((int) $this->current_time_2 - (int) $this->current_time_0) . 's');
     }
     // Creating and add order in PrestaShop
     if (!($res = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'orders_gateway` WHERE `id_order_neteven` = ' . (int) $neteven_order->OrderID . ' AND `id_order_detail_neteven` = 0'))) {
         // Creating cart
         $cart = new Cart();
         $cart->id_address_delivery = (int) $id_address_shipping;
         $cart->id_address_invoice = (int) $id_address_billing;
         $cart->id_currency = (int) Configuration::get('PS_CURRENCY_DEFAULT');
         $cart->id_customer = (int) $id_customer;
         $cart->id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
         $cart->id_carrier = (int) Configuration::get('PS_CARRIER_DEFAULT');
         $cart->recyclable = 1;
         $cart->gift = 0;
         $cart->gift_message = '';
         $cart->date_add = $date_now;
         $cart->secure_key = $secure_key_default;
         $cart->date_upd = $date_now;
         if (!$cart->add()) {
             Toolbox::addLogLine(self::getL('Failed for cart creation / NetEven Order Id') . ' ' . (int) $neteven_order->OrderID);
         }
         if ($this->time_analyse) {
             $this->current_time_0 = time();
             Toolbox::displayDebugMessage(self::getL('Cart') . ' : ' . ((int) $this->current_time_0 - (int) $this->current_time_2) . 's');
         }
         // Creating order
         $id_order_temp = 0;
         $order = new Order();
         $order->id_carrier = Configuration::get('PS_CARRIER_DEFAULT');
         $order->id_lang = Configuration::get('PS_LANG_DEFAULT');
         $order->id_customer = $id_customer;
         $order->id_cart = $cart->id;
         $order->id_currency = Configuration::get('PS_CURRENCY_DEFAULT');
         $order->id_address_delivery = $id_address_shipping;
         $order->id_address_invoice = $id_address_billing;
         $order->secure_key = $secure_key_default;
         $order->payment = $neteven_order->PaymentMethod;
         $order->conversion_rate = 1;
         $order->module = 'nqgatewayneteven';
         $order->recyclable = 0;
         $order->gift = 0;
         $order->gift_message = '';
         $order->shipping_number = '';
         $order->reference = $neteven_order->MarketPlaceOrderId;
         $carrier = new Carrier((int) $order->id_carrier);
         $carrier_tax_rate = $carrier->getTaxesRate(new Address($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
         $total_shipping_tax_excl = $carrier_tax_rate ? $neteven_order->OrderShippingCost->_ / ($carrier_tax_rate / 100) : $neteven_order->OrderShippingCost->_;
         $total_wt = $total_product_wt + $neteven_order->OrderShippingCost->_;
         $total = $total_product + $total_shipping_tax_excl;
         $order->total_discounts_tax_excl = 0;
         $order->total_discounts_tax_incl = 0;
         $order->total_discounts = 0;
//.........这里部分代码省略.........
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:101,代码来源:GatewayOrder.php


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