本文整理汇总了PHP中TaxRulesGroup::getTaxes方法的典型用法代码示例。如果您正苦于以下问题:PHP TaxRulesGroup::getTaxes方法的具体用法?PHP TaxRulesGroup::getTaxes怎么用?PHP TaxRulesGroup::getTaxes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaxRulesGroup
的用法示例。
在下文中一共展示了TaxRulesGroup::getTaxes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTaxesRate
/**
* @deprecated since 1.5
*/
public static function getTaxesRate($id_tax_rules_group, $id_country, $id_state, $zipcode)
{
Tools::displayAsDeprecated();
$rate = 0;
foreach (TaxRulesGroup::getTaxes($id_tax_rules_group, $id_country, $id_state, $zipcode) as $tax) {
$rate += (double) $tax->rate;
}
return $rate;
}
示例2: getTaxesRate
public static function getTaxesRate($id_tax_rules_group, $id_country, $id_state, $id_county)
{
$rate = 0;
foreach (TaxRulesGroup::getTaxes($id_tax_rules_group, $id_country, $id_state, $id_county) as $tax) {
$rate += (double) $tax->rate;
}
return $rate;
}
示例3: invoice
//.........这里部分代码省略.........
if (self::$orderSlip) {
$pdf->Cell(0, 6, self::l('SLIP #') . ' ' . sprintf('%06d', self::$orderSlip->id) . ' ' . self::l('from') . ' ' . Tools::displayDate(self::$orderSlip->date_upd, self::$order->id_lang), 1, 2, 'L', 1);
} elseif (self::$delivery) {
$pdf->Cell(0, 6, self::l('DELIVERY SLIP #') . Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_DELIVERY_PREFIX', (int) $cookie->id_lang)) . sprintf('%06d', self::$delivery) . ' ' . self::l('from') . ' ' . Tools::displayDate(self::$order->delivery_date, self::$order->id_lang), 1, 2, 'L', 1);
} elseif ((int) self::$order->invoice_date) {
$pdf->Cell(0, 6, self::l('INVOICE #') . ' ' . Tools::iconv('utf-8', self::encoding(), Configuration::get('PS_INVOICE_PREFIX', (int) $cookie->id_lang)) . sprintf('%06d', self::$order->invoice_number) . ' ' . self::l('from') . ' ' . Tools::displayDate(self::$order->invoice_date, self::$order->id_lang), 1, 2, 'L', 1);
} else {
$pdf->Cell(0, 6, self::l('Invoice draft'), 1, 2, 'L', 1);
}
$pdf->Cell(55, 6, self::l('Order #') . ' ' . sprintf('%06d', self::$order->id), 'L', 0);
$pdf->Cell(70, 6, self::l('Carrier:') . ($order->gift ? ' ' . Tools::iconv('utf-8', self::encoding(), $carrier->name) : ''), 'L');
$pdf->Cell(0, 6, self::l('Payment method:'), 'LR');
$pdf->Ln(5);
$pdf->Cell(55, 6, isset($shipping_date) ? self::l('Shipping date:') . ' ' . Tools::displayDate($shipping_date, self::$order->id_lang) : ' ', 'LB', 0);
$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);
}
示例4: getTaxesRate
public static function getTaxesRate($id_tax_rules_group, $id_country, $id_state, $id_county)
{
if (!Configuration::get('PS_TAX')) {
return 0;
}
$state = new State((int) $id_state);
/* Case 1: We need to multiply the taxes (example: Canadian law) */
if (Country::getIsoById((int) $id_country) == self::$canada_iso && in_array($state->iso_code, self::$canada_states_iso)) {
$rate = 1;
foreach (TaxRulesGroup::getTaxes($id_tax_rules_group, $id_country, $id_state, $id_county) as $tax) {
$rate *= 1 + (double) $tax->rate * 0.01;
}
$rate *= 100;
$rate -= 100;
} else {
$rate = 0;
foreach (TaxRulesGroup::getTaxes($id_tax_rules_group, $id_country, $id_state, $id_county) as $tax) {
$rate += (double) $tax->rate;
}
}
return $rate;
}
示例5: validateOrder
//.........这里部分代码省略.........
$query = 'INSERT INTO `' . _DB_PREFIX_ . 'order_detail`
(`id_order`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_in_stock`, `product_price`, `reduction_percent`, `reduction_amount`, `group_reduction`, `product_quantity_discount`, `product_ean13`, `product_upc`, `product_reference`, `product_supplier_reference`, `product_weight`, `tax_name`, `tax_rate`, `ecotax`, `ecotax_tax_rate`, `discount_quantity_applied`, `download_deadline`, `download_hash`)
VALUES ';
$customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
Product::addCustomizationPrice($products, $customizedDatas);
$outOfStock = false;
$store_all_taxes = array();
foreach ($products as $key => $product) {
$productQuantity = (int) Product::getQuantity((int) $product['id_product'], $product['id_product_attribute'] ? (int) $product['id_product_attribute'] : NULL);
$quantityInStock = $productQuantity - (int) $product['cart_quantity'] < 0 ? $productQuantity : (int) $product['cart_quantity'];
if ($id_order_state != Configuration::get('PS_OS_CANCELED') and $id_order_state != Configuration::get('PS_OS_ERROR')) {
if (Product::updateQuantity($product, (int) $order->id)) {
$product['stock_quantity'] -= $product['cart_quantity'];
}
if ($product['stock_quantity'] < 0 && Configuration::get('PS_STOCK_MANAGEMENT')) {
$outOfStock = true;
}
Product::updateDefaultAttribute($product['id_product']);
}
$price = Product::getPriceStatic((int) $product['id_product'], false, $product['id_product_attribute'] ? (int) $product['id_product_attribute'] : NULL, 6, NULL, false, true, $product['cart_quantity'], false, (int) $order->id_customer, (int) $order->id_cart, (int) $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$price_wt = Product::getPriceStatic((int) $product['id_product'], true, $product['id_product_attribute'] ? (int) $product['id_product_attribute'] : NULL, 2, NULL, false, true, $product['cart_quantity'], false, (int) $order->id_customer, (int) $order->id_cart, (int) $order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
/* Store tax info */
$id_country = (int) Country::getDefaultCountryId();
$id_state = 0;
$id_county = 0;
$rate = 0;
$id_address = $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
$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']);
}
$allTaxes = TaxRulesGroup::getTaxes((int) Product::getIdTaxRulesGroupByIdProduct((int) $product['id_product']), $id_country, $id_state, $id_county);
// If its a freeOrder, there will be no calculation
if ($order->total_products > 0) {
// remove order discount quotepart on product price in order to obtain the real tax
$ratio = $price / $order->total_products;
$order_reduction_amount = (double) abs($cart->getOrderTotal(false, Cart::ONLY_DISCOUNTS)) * $ratio;
$tmp_price = $price - $order_reduction_amount;
foreach ($allTaxes as $res) {
if (!isset($store_all_taxes[$res->id])) {
$store_all_taxes[$res->id] = array();
$store_all_taxes[$res->id]['amount'] = 0;
}
$store_all_taxes[$res->id]['name'] = $res->name[(int) $order->id_lang];
$store_all_taxes[$res->id]['rate'] = $res->rate;
$unit_tax_amount = $tmp_price * ($res->rate * 0.01);
$tmp_price = $tmp_price + $unit_tax_amount;
$store_all_taxes[$res->id]['amount'] += $unit_tax_amount * $product['cart_quantity'];
}
}
/* End */
// Add some informations for virtual products
$deadline = '0000-00-00 00:00:00';
$download_hash = null;
if ($id_product_download = ProductDownload::getIdFromIdProduct((int) $product['id_product'])) {
$productDownload = new ProductDownload((int) $id_product_download);
$deadline = $productDownload->getDeadLine();
$download_hash = $productDownload->getHash();
}
// Exclude VAT
if (!_PS_TAX_) {
$product['tax'] = 0;
$product['rate'] = 0;
$tax_rate = 0;
示例6: getTaxesRate
public static function getTaxesRate($id_tax_rules_group, $id_country, $id_state, $id_county)
{
$state = new State((int) $id_state);
if (Country::getIsoById((int) $id_country) == self::$canada_iso && in_array($state->iso_code, self::$canada_states_iso)) {
$rate = 1;
foreach (TaxRulesGroup::getTaxes($id_tax_rules_group, $id_country, $id_state, $id_county) as $tax) {
$rate *= 1 + (double) $tax->rate * 0.01;
}
$rate *= 100;
$rate -= 100;
} else {
$rate = 0;
foreach (TaxRulesGroup::getTaxes($id_tax_rules_group, $id_country, $id_state, $id_county) as $tax) {
$rate += (double) $tax->rate;
}
}
return $rate;
}