When I run commerce_line_item_rebase_unit_price() for line item which already have some price components, I see:
Notice: Undefined index: rate in commerce_vat_commerce_line_item_rebase_unit_price() (line 535 of sites/all/modules/commerce_vat/commerce_vat.module).

I debug structure of $vat_rate in commerce_vat_commerce_line_item_rebase_unit_price function and I see that structure of $vat_rate not suitable for culculation.

[0] => Array
        (
            [title] => DE Standard
            [description] => 
            [rates] => Array
                (
                    [19_2007] => Array
                        (
                            [name] => 19_2007
                            [rate] => 0.19
                            [start] => 20070101
                        )

                )

            [country] => DE
            [rules_component] => commerce_vat_rate_de_standard
            [default_rules_component] => 1
            [price_component] => vat|de_standard
            [calculation_callback] => commerce_vat_rate_calculate
            [module] => commerce_eu_vat_de
            [eu] => 1
        )

It try to take $vat_rate['rate'] but not exists.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AndrewsizZ’s picture

Issue summary: View changes
vadym.kononenko’s picture

Try this patch. Works for me.

vadym.kononenko’s picture

Status: Active » Needs review
AndrewsizZ’s picture

Status: Needs review » Reviewed & tested by the community

works for me very well! thanks a lot!

bechtold’s picture

Version: 7.x-1.0-rc1 » 7.x-1.0-rc2

This works for me.
But i realized that on the add form you enter the net price (without taxes) and on the edit form you enter the gross price (with taxes).
This is really confusing.
Im not sure though if it is an issue of this patch.

Anybody’s picture

I can sadly not confirm that this patch works fully correct.
It fixes the problem above with the commerce_unit_price calculation but if using reverse calculation it messes up the commerce_total amount of the line item.

I am not sure on which point that happens. Any ideas?

jsacksick’s picture

Tested the patch and it works for me, here's an updated patch.
I moved the $order_date line + the entity_metadata_wrapper() call above out of the foreach loop.

jsacksick’s picture

It works only when the first price component is "base_price", adding an updated version that removes the check, this check should not be necessary because commerce_line_item_rebase_unit_price() will always contain one price component.

dwkitchen’s picture

Status: Reviewed & tested by the community » Fixed

  • dwkitchen committed 4a2bdfa on 7.x-1.x authored by jsacksick
    Issue #2366943 by jsacksick, vadym.kononenko: Notice: Undefined index:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.