I have a bunch of feeds importing commerce products with CSV files provided by the client. I use tamper to turn the real-world 99.99 dollars-and-cents values into the 9999 cents prices that commerce expects. The client's most recent file for some reason double-quote-delimits all the prices over $999.99. (No idea why: they don't use a comma delimiter.)

What tamper does with this is quite problematic: the $field value passed to feeds_tamper_math_callback() is a string in the format "1,119.94" (perhaps formatted by commerce first? I haven't investigated). PHP implicitly casts this to a float val of 1 when the multiplication happens, meaning all prices over $999.99 are imported as $1.00.

Could feeds tamper please throw an error or display a message if (!empty($field) && !is_numeric($field)) when trying to do math on $field?

Comments

  • twistor committed ad0a33b on 7.x-1.x
    Issue #2432789: Math plugin fails to test for numeric data
    

  • twistor committed e6bc4f8 on 7.x-1.x
    Issue #2432789: Add more info to log message.
    
twistor’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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