Comment 13 for bug 1054059

Revision history for this message
Erik Miers (p949b) wrote :

Ok, I solved this Mapping Error.

The problem is, that the field "base_row_total_incl_tax" is null (None) for all order-items which I have imported from Amazon to my Magento store. But this field is required for the particular ma mapping-function for the "price" field on Sale Order Line

Which is this:

result=[
('price_unit_tax_included', (float(resource['base_row_total_incl_tax']))/float(resource['qty_ordered'])),
('price_unit_tax_excluded', (float(resource['base_row_total']))/float(resource['qty_ordered'])),
('tax_rate', float(resource['base_row_total']) and (float(resource['base_row_total_incl_tax'])/float(resource['base_row_total'])-1)),
]

So two approaches to solve this:

First:
 Change the mapping function to don't use "base_row_total_incl_tax" like this:

result=[
('price_unit_tax_included', float(resource['price_incl_tax'])),
('price_unit_tax_excluded', (float(resource['base_row_total']))/float(resource['qty_ordered'])),
('tax_rate', float(resource['base_row_total']) and ((float(resource['price_incl_tax'])*float(resource['qty_ordered']))/float(resource['base_row_total'])-1)),
]

I don't know if this is save for all use-cases, so someone should have a look at it.

Second:
 Change Magento code to automatically calculate base_row_total_incl_tax on every order (from Amazon) created.
But I haven't looked into the code, yet. So I don't know where to actually do this.
And you would also have to change all previously created orders in the database.

Hope this helps anyone.