AvS_FastSimpleImport icon indicating copy to clipboard operation
AvS_FastSimpleImport copied to clipboard

Ability to manipulate variable $_indexValueAttributes from outside

Open pquerner opened this issue 8 years ago • 3 comments

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 avatar Sep 23 '15 13:09 pquerner

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

pquerner avatar Sep 23 '15 14:09 pquerner

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.

avstudnitz avatar Sep 25 '15 06:09 avstudnitz

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.

pquerner avatar Sep 26 '15 14:09 pquerner