Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm kind of new in drupal, so if anybody can help, how to add a tax line in commerce invoice receipt template. Which variable do I need to print?
Comment | File | Size | Author |
---|---|---|---|
question.png | 84 KB | TomNET d.o.o. |
Comments
Comment #1
buddatry dumping out the $info array to see what options you have.
print_r($info);
Comment #2
TomNET d.o.o. CreditAttribution: TomNET d.o.o. commentedI try, that, thanx for the idea, bt it didn'twork, i've got a array, ut there is no shipping , no billing address , no subtotal, no total no lie item, no nothing available, all i've got is a mail, nuber od an order, and nomber of the account. I' mean , the printed variablres for the line items and a total are ther, but there is nothing printed what s ever...any ideas...?
thanx, in advanced, for you time, and answer...
If you want, i van upload a photo of what i have to get, and what i've got now...
Comment #3
PJnes CreditAttribution: PJnes commentedTry
That should contain all the information for the current order.
Comment #4
TomNET d.o.o. CreditAttribution: TomNET d.o.o. commentedThanx PJnes, I've got something with
print_r($order);
, but in the commerce-order-invoice-view.tpl, there allready areprint $info['line_items'];
and there are no line irems printed out, and
print $info['order_total']
olso, no total ammount, that was example.... Am I doing something wrong? Should I upluad a pic of what I've get after
print_r($order);
, or the pic of wha the invoice should look a like, so you can give me advice of what to do?Thanx so much for the advice and time in advance...
Comment #5
PJnes CreditAttribution: PJnes commentedI just checked on the invoice I have set up and
$info['line_items'];
contains a table of all the products in an order. That just worked, never had to change anything in the code.Can you paste the output of
so I can get an idea of what's happening?
Comment #6
BrianLP CreditAttribution: BrianLP commentedI'm also missing tax and shipping in the invoice. The output of
<?php print_r($order); ?>
works fine. It outputs basically what I already have (order number, date, adddresses...).
For the $info part I get this:
stdClass Object ( [order_number] => 245 [revision_id] => 1271 [revision_uid] => 1 [mail] => x@y.com [status] => completed [log] => [revision_timestamp] => 1338799490 [revision_hostname] => xxx.yyy.zzz [data] => Array ( [payment_method] => paypal_wps|commerce_payment_paypal_wps [payment_redirect_key] => 8ixvBB7R9UdPkjgjfgfgxyz [commerce_payment_order_paid_in_full_invoked] => 1 ) [order_id] => 245 [type] => commerce_order [uid] => 1 [created] => 1337207168 [changed] => 1338799490 [hostname] => 46.223.55.139 [commerce_line_items] => Array ( [und] => Array ( [0] => Array ( [line_item_id] => 445 ) [1] => Array ( [line_item_id] => 506 ) ) ) [commerce_order_total] => Array ( [und] => Array ( [0] => Array ( [amount] => 1164 [currency_code] => EUR [data] => Array ( [components] => Array ( [0] => Array ( [name] => base_price [price] => Array ( [amount] => 1084 [currency_code] => EUR [data] => Array ( ) ) [included] => 1 ) [1] => Array ( [name] => discount [price] => Array ( [amount] => -434 [currency_code] => EUR [data] => Array ( ) ) [included] => 1 ) [2] => Array ( [name] => tax|mehrwertsteuer [price] => Array ( [amount] => 123.5 [currency_code] => EUR [data] => Array ( [tax_rate] => Array ( [name] => mehrwertsteuer [display_title] => Mehrwertsteuer 19% (VAT) [description] => Mehrwertsteuer [rate] => .19 [type] => vat [rules_component] => commerce_tax_rate_mehrwertsteuer [default_rules_component] => 1 [price_component] => tax|mehrwertsteuer [calculation_callback] => commerce_tax_rate_calculate [module] => commerce_tax_ui [title] => Mehrwertsteuer [admin_list] => 1 ) ) ) [included] => 1 ) [3] => Array ( [name] => flat_rate_deutschland_paeckchen [price] => Array ( [amount] => 390 [currency_code] => EUR [data] => Array ( ) ) [included] => 1 ) ) ) ) ) ) [commerce_customer_billing] => Array ( [und] => Array ( [0] => Array ( [profile_id] => 159 ) ) ) [commerce_customer_shipping] => Array ( [und] => Array ( [0] => Array ( [profile_id] => 160 ) ) ) [field_invoice_mwst] => Array ( ) [rdf_mapping] => Array ( ) [entity_view_prepared] => 1 )
It looks like there is tax and shipping data available, but I need some help how to get this to display.
Comment #7
stevieb CreditAttribution: stevieb commentedgo to "/admin/commerce/config/order/display/invoice" under the field "Order Total" choose Formatted amount with components
you'll then get the subtotal, taxes & shipping
Comment #8
Daglees