Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emptying / Deleting varchar data when missing attribute data #46

Closed
trabulium opened this issue Jun 4, 2014 · 2 comments
Closed

Emptying / Deleting varchar data when missing attribute data #46

trabulium opened this issue Jun 4, 2014 · 2 comments

Comments

@trabulium
Copy link

Hi Dweeves - We have some extra text attributes for InStore stock qtys. We were running 0.7.18 and found that when Stock Qty reached 0, it was not updating the field because I guess it read it as a null value and didn't update.

We migrated from 0.7.18 to 0.7.19_git as it seemed to resolve our issue with 0's in text fields. The problem of course is that in PHP 0 == false == null.

in 0.7.19_git, you're now handling it differently for text fields so that if the field is empty, it REMOVES the attribute, which has caused us a bit of grief, because we have Product Managers that fill in the gaps where our automation can't work due to insufficient information from the ERP system.

What's happened now is that Magmi removed that information where we sometimes filled with Magmi and sometimes left it alone for the Product Managers to fill for us. Now when we left it empty, Magmi removed these attribute options from the MultiSelect.

Line 739 of productimportengine.php has if($ovalue=="MAGMI_UNHANDLED") then sets $ovalue as false; but it seems MAGMI_UNHANDLED is not actually implemented anywhere and additionally, once we implemented it in magmi/plugins/inc/magmi_defaultattributehandler.php, then approx Line 768 if ($ovalue==null) evaluates false as null and still deletes it. So needs to be evaluated with ($ovalue===null).

I'm not clear if I've really got my head around this yet but I have a working solution at the moment where I can choose to ignore / not update, using MAGMI_UNHANDLED instead of a blank field. I will try and put it all together in a pull request.

@dweeves
Copy link
Owner

dweeves commented Jun 4, 2014

the value that will solve your issue is

MAGMI_IGNORE

when set in a value, it will force magmi not to handle this entry.

of course you can combine it with value replacer if you need to apply this to specific attribute under specific conditions.

say , on attribute description, ignoring empty values would be defined as is:

Value replacer settings :

  • replaced attribute => description
  • new value for description :
    {{ {item.description}=='' ? 'MAGMI_IGNORE':{item.description} }} 

@trabulium
Copy link
Author

@dweeves - I'm sorry to waste your time. I've been using Magmi for ~3 years and have no idea how I'd never come across this feature. How could I ever doubt you'd have this covered? Thanks for the response though, I really appreciate it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants