-
Notifications
You must be signed in to change notification settings - Fork 146
Use php's strtolower to fix preparing attributes with unicode values #395
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
Conversation
See function getAttributeOptions inside Mage_ImportExport_Model_Import_Entity_Abstract. strtolower is used there, generating keys with wrong encoding for unicode values of attributes. They don't match the strtolower version used here, which caused the attribute to be empty on import.
Thanks for your PR! We introduced Hence, I would absolutely stick to using the helper method. BUT you may be right that we missed another place where a simple |
Thank for the detailed description! I'm unfortunately not familiar with all the importexport entities, that's why in my eyes it looked easier to change this as it's robust against changes in the Magento core code. To reproduce, simply create a dropdown attribute with the attribute code "test", enable auto-creation for it, add it to an attribution set and then try to import any product with the attribution set and with |
Just to double check: Could you reproduce this issue with the latest dev branch? I am quite sure that it does not happen there... If you can reproduce it with the latest dev branch, I am happy to look into the issue. |
ImportExport uses PHP strtolower for "getAttributeOptions": To reproduce the issue, you need to enable the import of dropdown/multiselect attribute values and the attribute-value needs to contain an Umlaut character at position 0 (e.g. Übergang). strtolower is not able to lowercase "Übergang" to "übergang". It remains at "Übergang", whereas mb_strtolower is capable of and correctly lowers it to "übergang". Edit: |
I encountered problems here as well. I had values with uppercase Ö. That does not work with strtolower. On product import, \Mage_ImportExport_Model_Import_Entity_Product_Type_Abstract::_initAttributes uses \Mage_ImportExport_Model_Import_Entity_Abstract::getAttributeOptions. In my case, it would initialize the value as hÖlscher (strtolower core behaviour), and FastSimpleImport would on assignment look for hölscher (= not found). |
Symptoms:
And option is not assigned correctly without error message. I solved it by overwriting \Mage_ImportExport_Model_Import_Entity_Abstract::getAttributeOptions using the FastSimpleImport_Helper_Data strtolower. Also, \AvS_FastSimpleImport_Model_Import_Entity_Product::isAttributeValid uses strotolower instead of the helper method as well, and needs to be changed or the option will then be declared as illegal. But that change is already included in the latest commits. |
See function
getAttributeOptions
insideMage_ImportExport_Model_Import_Entity_Abstract
.strtolower
is used there, generating keys with wrong encoding for unicode values of attributes. They don't match the keys of the own (and absolutely correct!)strtolower
used before. Thus, attributes will be set to null because i.e.straße
(generated by this plugin's strtolower) doesn't matchstra▒e
(generated by Magento).