#69 Can't set Text attribute to empty string in update mode 'create'

v1.0_(example)
open
nobody
None
5
2013-08-27
2013-08-27
Andreas Nilsson
No

http://sourceforge.net/apps/mediawiki/magmi/index.php?title=Magmi_command_line#Parameters states that when running in CREATE mode, existing products should be updated. But this doesn't work for varchar attributes (type Text in Magento).

I use mode CREATE so that I can create and update in one go.

The culprit is in magmi_defaultattributehandler.php:

public function handleVarcharAttribute($pid,&$item,$storeid,$attrcode,$attrdesc,$ivalue)
{
if($storeid!==0 && empty($ivalue) && $this->getImportMode()=="create")
{
return false;
}
...

My arguments:
- store id is "0"
- ivalue is empty
- mode is 'create'

What happens is that storeId is provided as a string ("0") and the comparison is made as $storeId !== 0, so the expression will evaluate to true even though it should evaluate to false.

I fixed it by changing the comparison to:
if($storeid != 0 && empty($ivalue) && $this->getImportMode()=="create")

Further investigation should be done if the comparison should be done at all. Should the statement return false if storeid is not 0?

Discussion