Closed ymilin closed 1 year ago
I'm running into this issue on Lightswitch fields. No way of setting true => false.
Hi, thanks for reporting! I raised a PR for this.
For the time being, if you use strings, the import should work as expected (e.g. "false"
instead of false
, "0.00"
instead of 0.00
)
Just released 5.1.4 with a fix for this! https://github.com/craftcms/feed-me/releases/tag/5.1.4
Hi, we are still experiencing the same problem running Craft Pro 3.8.13 and Feed Me 4.7.0. Is it possible to also apply this fix for this version?
Description
Due to the use of PHP empty(), the Feed Option
setEmptyValues
, when inactive, considers the the following values as empty:I think the expected behavior for this feature is to only consider a value to be empty for empty strings and null. (If this assumption is wrong, we could at least add a note that empty values are checked with PHP's emtpy() method)
This is problematic for:
Lightswitch
Fields that cannot be updated fromtrue
tofalse
Number
Fields that cannot be updated to0
or0.0
Here is where the check is made in the
Process
class:https://github.com/craftcms/feed-me/blob/b0c9c9e25bb021876b37e25556e157f57d417de1/src/services/Process.php#LL398C9-L408C10
I'll gladly make a PR when/if we agree on a solution.
Steps to reproduce
setEmptyValues = 0
craft\fields\Lightswitch
) fromtrue
tofalse
craft\feedme\services\Process
on line 403Additional info