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.
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | interdiff-2366943-7-8.txt | 898 bytes | jsacksick |
#8 | commerce_vat-fix-line-item-rebase-2366943-8.patch | 3.78 KB | jsacksick |
#2 | commerce_vat--rebase-price.patch | 3.1 KB | vadym.kononenko |
Comments
Comment #1
AndrewsizZ CreditAttribution: AndrewsizZ commentedComment #2
vadym.kononenko CreditAttribution: vadym.kononenko commentedTry this patch. Works for me.
Comment #3
vadym.kononenko CreditAttribution: vadym.kononenko commentedComment #4
AndrewsizZ CreditAttribution: AndrewsizZ commentedworks for me very well! thanks a lot!
Comment #5
bechtold CreditAttribution: bechtold commentedThis 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.
Comment #6
AnybodyI 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?
Comment #7
jsacksick CreditAttribution: jsacksick commentedTested 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.
Comment #8
jsacksick CreditAttribution: jsacksick commentedIt 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.Comment #9
dwkitchen CreditAttribution: dwkitchen at Centarro commented