avstudnitz / AvS_FastSimpleImport

Wrapper for Magento ImportExport functionality, which imports products and customers from arrays
306 stars 146 forks source link

Ability to manipulate variable $_indexValueAttributes from outside #255

Open pquerner opened 9 years ago

pquerner commented 9 years ago

As seen in this commit https://github.com/avstudnitz/AvS_FastSimpleImport/commit/cec4b1bee76fb78fe07f8c6814af3e01629c1fe3 (issue https://github.com/avstudnitz/AvS_FastSimpleImport/issues/157)

we had to mock the variable $_indexValueAttributes to have "our value" (country_of_manufacture ) allowed to be imported by country_code (eg "AT" for austria) (rather than by full localized name (= 'Österreich' in german)) (I dont really get why it works that way, but okay. That must not be discussed here)

My question now is, would it be okay-ish if we had a method which would let us manipulate this variable from the outside?

Why? Because:

Eg if I have a product which has an custom attribute but it currently only takes "the localized value" (same issue as above) in the import but for easier implemention we'd like to import this attribute by its value id.

For example I must import my custom attribute "custom_attribute" with value "Standard: Standard" but I'd rather just to "custom_attribute" with value "1" because 1 equals to "Standard: Standard".

Or may I ask how any of you would solve this problem without actually patching this import module?

Might do a draft for this problem in a PR later on which can be discussed further.

pquerner commented 9 years ago

Or it might be just clever to extend the class AvS_FastSimpleImport_Model_Import_Entity_Product to manipulate the $_indexValueAttributes class variable.

avstudnitz commented 9 years ago

As long as it doesn't affect backwards compatibility, I am fine with adding additional possible values as we have already done it with the category ids. If you'd create a pull request, I don't see a reason not to merge it.

pquerner commented 9 years ago

I tried some hours to extend your classes and have the importer take mine instead. That worked to some extend, until the "real" importer did start. I managed to have the importer take all my variables but somewhere in process its still not wokring. Therefore I paused the project of "extending your classes".

Backwards compability: yea, that might be a huge thing, not so sure but once I get some more time on my hand I'll try it.