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


PHP Carrier::getIdTaxRulesGroupByIdCarrier方法代码示例

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


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

示例1: getCarrierTaxRate

 /**
  * Returns the carrier tax rate
  *
  * @param id_address
  * @return float $tax_rate
  */
 public static function getCarrierTaxRate($id_carrier, $id_address = null)
 {
     $address = Address::initialize($id_address);
     $id_tax_rules = (int) Carrier::getIdTaxRulesGroupByIdCarrier((int) $id_carrier);
     $tax_manager = TaxManagerFactory::getManager($address, $id_tax_rules);
     $tax_calculator = $tax_manager->getTaxCalculator();
     return $tax_calculator->getTotalRate();
 }
开发者ID:IngenioContenidoDigital,项目名称:americana,代码行数:14,代码来源:Tax.php

示例2: getIdTaxRulesGroup

 /**
  * Get TaxRulesGroup ID for this Carrier
  *
  * @param Context|null $context Context
  *
  * @return false|null|string TaxrulesGroup ID
  *                           false if not found
  */
 public function getIdTaxRulesGroup(Context $context = null)
 {
     return Carrier::getIdTaxRulesGroupByIdCarrier((int) $this->id, $context);
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:12,代码来源:Carrier.php

示例3: getStepThreeFieldsValues

 public function getStepThreeFieldsValues($carrier)
 {
     $id_tax_rules_group = is_object($this->object) && !$this->object->id ? Carrier::getIdTaxRulesGroupMostUsed() : Carrier::getIdTaxRulesGroupByIdCarrier($this->object->id);
     $shipping_handling = is_object($this->object) && !$this->object->id ? 0 : $this->getFieldValue($carrier, 'shipping_handling');
     return array('is_free' => $this->getFieldValue($carrier, 'is_free'), 'id_tax_rules_group' => (int) $id_tax_rules_group, 'shipping_handling' => $shipping_handling, 'shipping_method' => $this->getFieldValue($carrier, 'shipping_method'), 'range_behavior' => $this->getFieldValue($carrier, 'range_behavior'), 'zones' => $this->getFieldValue($carrier, 'zones'));
 }
开发者ID:M03G,项目名称:PrestaShop,代码行数:6,代码来源:AdminCarrierWizardController.php

示例4: invoice


//.........这里部分代码省略.........
     $pdf->Cell(70, 6, $order->gift ? self::l('Gift-wrapped order') : Tools::iconv('utf-8', self::encoding(), $carrier->name), 'LRB');
     $pdf->Cell(0, 6, Tools::iconv('utf-8', self::encoding(), $order->payment), 'LRB');
     $pdf->Ln(15);
     $pdf->ProdTab(self::$delivery ? true : '');
     if (!self::$delivery) {
         $priceBreakDown = array();
         $pdf->priceBreakDownCalculation($priceBreakDown);
     }
     /* Canada */
     $taxable_address = new Address((int) self::$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
     if (!self::$delivery && strtoupper(Country::getIsoById((int) $taxable_address->id_country)) == 'CA') {
         $pdf->Ln(15);
         if (self::$orderSlip) {
             $id_country = (int) $taxable_address->id_country;
             $id_state = (int) $taxable_address->id_state;
             $id_county = 0;
             // fetch taxes for product
             $products = self::$orderSlip->getOrdersSlipProducts(self::$orderSlip->id, self::$order);
             foreach ($products as $product) {
                 $allTaxes = TaxRulesGroup::getTaxes((int) Product::getIdTaxRulesGroupByIdProduct((int) $product['product_id']), $id_country, $id_state, $id_county);
                 foreach ($allTaxes as $tax) {
                     if (!isset($store_all_taxes[$tax->id])) {
                         $store_all_taxes[$tax->id] = array();
                         $store_all_taxes[$tax->id]['amount'] = 0;
                     }
                     $store_all_taxes[$tax->id]['name'] = $tax->name[(int) self::$order->id_lang];
                     $store_all_taxes[$tax->id]['rate'] = $tax->rate;
                     $unit_tax_amount = $product['product_price'] * ($tax->rate * 0.01);
                     $store_all_taxes[$tax->id]['amount'] += $unit_tax_amount * $product['product_quantity'];
                 }
             }
             if (self::$orderSlip->shipping_cost) {
                 // fetch taxes for carrier
                 $allTaxes = TaxRulesGroup::getTaxes((int) Carrier::getIdTaxRulesGroupByIdCarrier((int) self::$order->id_carrier), $id_country, $id_state, $id_county);
                 $nTax = 0;
                 foreach ($allTaxes as $tax) {
                     if (!isset($tax->id)) {
                         continue;
                     }
                     if (!isset($store_all_taxes[$tax->id])) {
                         $store_all_taxes[$tax->id] = array();
                     }
                     if (!isset($store_all_taxes[$tax->id]['amount'])) {
                         $store_all_taxes[$tax->id]['amount'] = 0;
                     }
                     $store_all_taxes[$tax->id]['name'] = $tax->name[(int) self::$order->id_lang];
                     $store_all_taxes[$tax->id]['rate'] = $tax->rate;
                     if (!$nTax++) {
                         $store_all_taxes[$tax->id]['amount'] += $priceBreakDown['shippingCostWithoutTax'] * (1 + $tax->rate * 0.01) - $priceBreakDown['shippingCostWithoutTax'];
                     } else {
                         $store_all_taxes[$tax->id]['amount'] += self::$order->total_shipping - self::$order->total_shipping / (1 + $tax->rate * 0.01);
                     }
                 }
             }
             foreach ($store_all_taxes as $tax) {
                 $pdf->Cell(0, 6, utf8_decode($tax['name']) . ' (' . number_format($tax['rate'], 2, '.', '') . '%)      ' . self::convertSign(Tools::displayPrice($tax['amount'], self::$currency, true)), 0, 0, 'R');
                 $pdf->Ln(5);
             }
         } else {
             $taxes = Db::getInstance()->ExecuteS('SELECT * FROM ' . _DB_PREFIX_ . 'order_tax WHERE id_order = ' . (int) self::$order->id);
             foreach ($taxes as $tax) {
                 $pdf->Cell(0, 6, utf8_decode($tax['tax_name']) . ' (' . number_format($tax['tax_rate'], 2, '.', '') . '%)      ' . self::convertSign(Tools::displayPrice($tax['amount'], self::$currency, true)), 0, 0, 'R');
                 $pdf->Ln(5);
             }
         }
     }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:67,代码来源:PDF.php

示例5: getCarrierTaxRate

 public static function getCarrierTaxRate($id_carrier, $id_address = null)
 {
     global $cookie, $defaultCountry;
     $id_country = (int) Country::getDefaultCountryId();
     if ($id_country == _PS_COUNTRY_DEFAULT_ && isset($cookie->id_country) && $cookie->id_country != (int) _PS_COUNTRY_DEFAULT_) {
         $country = new Country((int) $cookie->id_country, $cookie->id_lang);
         if (ValidaTe::isLoadedObject($country) && $country->active) {
             $id_country = (int) $country->id;
             $defaultCountry = $country;
         }
     }
     $id_state = 0;
     $id_county = 0;
     if (!empty($id_address)) {
         $address_infos = Address::getCountryAndState($id_address);
         if ($address_infos['id_country']) {
             $id_country = (int) $address_infos['id_country'];
             $id_state = (int) $address_infos['id_state'];
             $id_county = (int) County::getIdCountyByZipCode($address_infos['id_state'], $address_infos['postcode']);
         }
         if (!empty($address_infos['vat_number']) && $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY') && Configuration::get('VATNUMBER_MANAGEMENT')) {
             return 0;
         }
     }
     return TaxRulesGroup::getTaxesRate((int) Carrier::getIdTaxRulesGroupByIdCarrier((int) $id_carrier), (int) $id_country, (int) $id_state, (int) $id_county);
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:26,代码来源:Tax.php

示例6: validateOrder


//.........这里部分代码省略.........
                                    $customizationText .= $text['name'] . ':' . ' ' . $text['value'] . '<br />';
                                }
                            }
                            if (isset($customization['datas'][_CUSTOMIZE_FILE_])) {
                                $customizationText .= count($customization['datas'][_CUSTOMIZE_FILE_]) . ' ' . Tools::displayError('image(s)') . '<br />';
                            }
                            $customizationText .= '---<br />';
                        }
                        $customizationText = rtrim($customizationText, '---<br />');
                        $customizationQuantity = (int) $product['customizationQuantityTotal'];
                        $productsList .= '<tr style="background-color: ' . ($key % 2 ? '#DDE2E6' : '#EBECEE') . ';">
							<td style="padding: 0.6em 0.4em;">' . (isset($product['reference']) && !empty($product['reference']) ? $product['reference'] : '&nbsp;') . '</td>
							<td style="padding: 0.6em 0.4em;"><strong>' . $product['name'] . (isset($product['attributes']) ? ' - ' . $product['attributes'] : '') . ' - ' . $this->l('Customized') . (!empty($customizationText) ? ' - ' . $customizationText : '') . '</strong></td>
							<td style="padding: 0.6em 0.4em; text-align: right;">' . Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt, $currency, false) . '</td>
							<td style="padding: 0.6em 0.4em; text-align: center;">' . $customizationQuantity . '</td>
							<td style="padding: 0.6em 0.4em; text-align: right;">' . Tools::displayPrice($customizationQuantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt), $currency, false) . '</td>
						</tr>';
                    }
                    if (!$customizationQuantity or (int) $product['cart_quantity'] > $customizationQuantity) {
                        $productsList .= '<tr style="background-color: ' . ($key % 2 ? '#DDE2E6' : '#EBECEE') . ';">
							<td style="padding: 0.6em 0.4em;">' . (isset($product['reference']) && !empty($product['reference']) ? $product['reference'] : '&nbsp;') . '</td>
							<td style="padding: 0.6em 0.4em;"><strong>' . $product['name'] . (isset($product['attributes']) ? ' - ' . $product['attributes'] : '') . '</strong></td>
							<td style="padding: 0.6em 0.4em; text-align: right;">' . Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt, $currency, false) . '</td>
							<td style="padding: 0.6em 0.4em; text-align: center;">' . ((int) $product['cart_quantity'] - $customizationQuantity) . '</td>
							<td style="padding: 0.6em 0.4em; text-align: right;">' . Tools::displayPrice(((int) $product['cart_quantity'] - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt), $currency, false) . '</td>
						</tr>';
                    }
                }
                // end foreach ($products)
                $query = rtrim($query, ',');
                $result = $db->Execute($query);
                /* Add carrier tax */
                $shippingCostTaxExcl = $cart->getOrderShippingCost((int) $order->id_carrier, false);
                $allTaxes = TaxRulesGroup::getTaxes((int) Carrier::getIdTaxRulesGroupByIdCarrier((int) $order->id_carrier), $id_country, $id_state, $id_county);
                $nTax = 0;
                foreach ($allTaxes as $tax) {
                    if (!isset($tax->id)) {
                        continue;
                    }
                    if (!isset($store_all_taxes[$tax->id])) {
                        $store_all_taxes[$tax->id] = array();
                    }
                    if (!isset($store_all_taxes[$tax->id]['amount'])) {
                        $store_all_taxes[$tax->id]['amount'] = 0;
                    }
                    $store_all_taxes[$tax->id]['name'] = $tax->name[(int) $order->id_lang];
                    $store_all_taxes[$tax->id]['rate'] = $tax->rate;
                    if (!$nTax++) {
                        $store_all_taxes[$tax->id]['amount'] += $shippingCostTaxExcl * (1 + $tax->rate * 0.01) - $shippingCostTaxExcl;
                    } else {
                        $store_all_taxes[$tax->id]['amount'] += $order->total_shipping - $order->total_shipping / (1 + $tax->rate * 0.01);
                    }
                }
                /* Store taxes */
                foreach ($store_all_taxes as $tax) {
                    Db::getInstance()->Execute('
					INSERT INTO `' . _DB_PREFIX_ . 'order_tax` (`id_order`, `tax_name`, `tax_rate`, `amount`)
					VALUES (' . (int) $order->id . ', \'' . pSQL($tax['name']) . '\', ' . (double) $tax['rate'] . ', ' . (double) $tax['amount'] . ')');
                }
                // Insert discounts from cart into order_discount table
                $discounts = $cart->getDiscounts();
                $discountsList = '';
                $total_discount_value = 0;
                $shrunk = false;
                foreach ($discounts as $discount) {
                    $objDiscount = new Discount((int) $discount['id_discount']);
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:67,代码来源:PaymentModule.php

示例7: getCarrierTaxRate

 public static function getCarrierTaxRate($id_carrier, $id_address = NULL)
 {
     $id_country = (int) Country::getDefaultCountryId();
     $id_state = 0;
     $id_county = 0;
     if (!empty($id_address)) {
         $address_infos = Address::getCountryAndState($id_address);
         if ($address_infos['id_country']) {
             $id_country = (int) $address_infos['id_country'];
             $id_state = (int) $address_infos['id_state'];
             $id_county = (int) County::getIdCountyByZipCode($address_infos['id_state'], $address_infos['postcode']);
         }
         if (!empty($address_infos['vat_number']) and $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY') and Configuration::get('VATNUMBER_MANAGEMENT')) {
             return 0;
         }
     }
     return TaxRulesGroup::getTaxesRate((int) Carrier::getIdTaxRulesGroupByIdCarrier((int) $id_carrier), (int) $id_country, (int) $id_state, (int) $id_county);
 }
开发者ID:greench,项目名称:prestashop,代码行数:18,代码来源:Tax.php


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