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?

CommentFileSizeAuthor
question.png84 KBTomNET d.o.o.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

budda’s picture

try dumping out the $info array to see what options you have.

print_r($info);

TomNET d.o.o.’s picture

I 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...

PJnes’s picture

Try

  print_r($order);

That should contain all the information for the current order.

TomNET d.o.o.’s picture

Thanx PJnes, I've got something with print_r($order);, but in the commerce-order-invoice-view.tpl, there allready are

print $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...

PJnes’s picture

I 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

print_r($info);
print_r($order);

so I can get an idea of what's happening?

BrianLP’s picture

I'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.

stevieb’s picture

go 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

Daglees’s picture

Status: Active » Closed (works as designed)