Jump to content

add order details to $template_vars


Daniel_WM

Recommended Posts

You can get the order summary like this

$summary = $this->context->cart->getSummaryDetails();
//Or
$summary = Context::getContext()->cart->getSummaryDetails();

then you can add this summary to the $template_vars

The summary will contain this array

array(
	'delivery' => $delivery,
	'delivery_state' => State::getNameById($delivery->id_state),
	'invoice' => $invoice,
	'invoice_state' => State::getNameById($invoice->id_state),
	'formattedAddresses' => $formatted_addresses,
	'products' => array_values($products),
	'gift_products' => $gift_products,
	'discounts' => array_values($cart_rules),
	'is_virtual_cart' => (int)$this->isVirtualCart(),
	'total_discounts' => $total_discounts,
	'total_discounts_tax_exc' => $total_discounts_tax_exc,
	'total_wrapping' => $this->getOrderTotal(true, Cart::ONLY_WRAPPING),
	'total_wrapping_tax_exc' => $this->getOrderTotal(false, Cart::ONLY_WRAPPING),
	'total_shipping' => $total_shipping,
	'total_shipping_tax_exc' => $total_shipping_tax_exc,
	'total_products_wt' => $total_products_wt,
	'total_products' => $total_products,
	'total_price' => $base_total_tax_inc,
	'total_tax' => $total_tax,
	'total_price_without_tax' => $base_total_tax_exc,
	'is_multi_address_delivery' => $this->isMultiAddressDelivery() || ((int)Tools::getValue('multi-shipping') == 1),
	'free_ship' => $total_shipping ? 0 : 1,
	'carrier' => new Carrier($this->id_carrier, $id_lang),
)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...