本文整理汇总了PHP中OrderDetail::getTaxListStatic方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderDetail::getTaxListStatic方法的具体用法?PHP OrderDetail::getTaxListStatic怎么用?PHP OrderDetail::getTaxListStatic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderDetail
的用法示例。
在下文中一共展示了OrderDetail::getTaxListStatic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
/**
* Returns the template's HTML content
*
* @return string HTML content
*/
public function getContent()
{
$invoiceAddressPatternRules = Tools::jsonDecode(Configuration::get('PS_INVCE_INVOICE_ADDR_RULES'), true);
$deliveryAddressPatternRules = Tools::jsonDecode(Configuration::get('PS_INVCE_DELIVERY_ADDR_RULES'), true);
$invoice_address = new Address((int) $this->order->id_address_invoice);
$country = new Country((int) $invoice_address->id_country);
if ($this->order_invoice->invoice_address) {
$formatted_invoice_address = $this->order_invoice->invoice_address;
} else {
$formatted_invoice_address = AddressFormat::generateAddress($invoice_address, $invoiceAddressPatternRules, '<br />', ' ');
}
$delivery_address = null;
$formatted_delivery_address = '';
if (isset($this->order->id_address_delivery) && $this->order->id_address_delivery) {
if ($this->order_invoice->delivery_address) {
$formatted_delivery_address = $this->order_invoice->delivery_address;
} else {
$delivery_address = new Address((int) $this->order->id_address_delivery);
$formatted_delivery_address = AddressFormat::generateAddress($delivery_address, $deliveryAddressPatternRules, '<br />', ' ');
}
}
$customer = new Customer((int) $this->order->id_customer);
$order_details = $this->order_invoice->getProducts();
$has_discount = false;
foreach ($order_details as $id => &$order_detail) {
// Find out if column 'price before discount' is required
if ($order_detail['reduction_amount_tax_excl'] > 0) {
$has_discount = true;
$order_detail['unit_price_tax_excl_before_specific_price'] = $order_detail['unit_price_tax_excl_including_ecotax'] + $order_detail['reduction_amount_tax_excl'];
} elseif ($order_detail['reduction_percent'] > 0) {
$has_discount = true;
$order_detail['unit_price_tax_excl_before_specific_price'] = 100 * $order_detail['unit_price_tax_excl_including_ecotax'] / (100 - $order_detail['reduction_percent']);
}
// Set tax_code
$taxes = OrderDetail::getTaxListStatic($id);
$tax_temp = array();
foreach ($taxes as $tax) {
$obj = new Tax($tax['id_tax']);
$tax_temp[] = sprintf($this->l('%1$s%2$s%%'), $obj->rate + 0, ' ');
}
$order_detail['order_detail_tax'] = $taxes;
$order_detail['order_detail_tax_label'] = implode(', ', $tax_temp);
}
unset($tax_temp);
unset($order_detail);
if (Configuration::get('PS_PDF_IMG_INVOICE')) {
foreach ($order_details as &$order_detail) {
if ($order_detail['image'] != null) {
$name = 'product_mini_' . (int) $order_detail['product_id'] . (isset($order_detail['product_attribute_id']) ? '_' . (int) $order_detail['product_attribute_id'] : '') . '.jpg';
$path = _PS_PROD_IMG_DIR_ . $order_detail['image']->getExistingImgPath() . '.jpg';
$order_detail['image_tag'] = preg_replace('/\\.*' . preg_quote(__PS_BASE_URI__, '/') . '/', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR, ImageManager::thumbnail($path, $name, 45, 'jpg', false), 1);
if (file_exists(_PS_TMP_IMG_DIR_ . $name)) {
$order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name);
} else {
$order_detail['image_size'] = false;
}
}
}
unset($order_detail);
// don't overwrite the last order_detail later
}
$cart_rules = $this->order->getCartRules($this->order_invoice->id);
$free_shipping = false;
foreach ($cart_rules as $key => $cart_rule) {
if ($cart_rule['free_shipping']) {
$free_shipping = true;
/**
* Adjust cart rule value to remove the amount of the shipping.
* We're not interested in displaying the shipping discount as it is already shown as "Free Shipping".
*/
$cart_rules[$key]['value_tax_excl'] -= $this->order_invoice->total_shipping_tax_excl;
$cart_rules[$key]['value'] -= $this->order_invoice->total_shipping_tax_incl;
/**
* Don't display cart rules that are only about free shipping and don't create
* a discount on products.
*/
if ($cart_rules[$key]['value'] == 0) {
unset($cart_rules[$key]);
}
}
}
$product_taxes = 0;
foreach ($this->order_invoice->getProductTaxesBreakdown($this->order) as $details) {
$product_taxes += $details['total_amount'];
}
$product_discounts_tax_excl = $this->order_invoice->total_discount_tax_excl;
$product_discounts_tax_incl = $this->order_invoice->total_discount_tax_incl;
if ($free_shipping) {
$product_discounts_tax_excl -= $this->order_invoice->total_shipping_tax_excl;
$product_discounts_tax_incl -= $this->order_invoice->total_shipping_tax_incl;
}
$products_after_discounts_tax_excl = $this->order_invoice->total_products - $product_discounts_tax_excl;
$products_after_discounts_tax_incl = $this->order_invoice->total_products_wt - $product_discounts_tax_incl;
$shipping_tax_excl = $free_shipping ? 0 : $this->order_invoice->total_shipping_tax_excl;
$shipping_tax_incl = $free_shipping ? 0 : $this->order_invoice->total_shipping_tax_incl;
//.........这里部分代码省略.........