avstudnitz / AvS_FastSimpleImport

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

Product: country_of_manufacture value #157

Closed pquerner closed 10 years ago

pquerner commented 10 years ago

When importing Products with a "country_of_manufacture" value, I get this result:

:::: Invalid value for 'country_of_manufacture'. Possible options are: afghanistan, Ägypten, alandinseln, albanien, algerien, amerikanische jungferninseln, amerikanisch-ozeanien, amerikanisch-samoa, andorra, angola, anguilla, antarktis, antigua und barbuda, Äquatorialguinea, argentinien, armenien, aruba, aserbaidschan, Äthiopien, australien, bahamas, bahrain, bangladesch, barbados, belarus, belgien, belize, benin, bermuda, bhutan, bolivien, bosnien und herzegowina, botsuana, bouvetinsel, brasilien, britische jungferninseln, britisches territorium im indischen ozean, brunei darussalam, bulgarien, burkina faso, burundi, chile, china, cookinseln, costa rica, côte d’ivoire, dänemark, demokratische republik kongo, demokratische volksrepublik korea, deutschland, dominica, dominikanische republik, dschibuti, ecuador, el salvador, eritrea, estland, falklandinseln, färöer, fidschi, finnland, frankreich, französische süd- und antarktisgebiete, französisch-guayana, französisch-polynesien, gabun, gambia, georgien, ghana, gibraltar, grenada, griechenland, grönland, guadeloupe, guam, guatemala, guernsey, guinea, guinea-bissau, guyana, haiti, heard- und mcdonald-inseln, honduras, indien, indonesien, irak, iran, irland, island, isle of man, israel, italien, jamaika, japan, jemen, jersey, jordanien, kaimaninseln, kambodscha, kamerun, kanada, kap verde, kasachstan, katar, kenia, kirgisistan, kiribati, kokosinseln, kolumbien, komoren, kongo, kroatien, kuba, kuwait, laos, lesotho, lettland, libanon, liberia, libyen, liechtenstein, litauen, luxemburg, madagaskar, malawi, malaysia, malediven, mali, malta, marokko, marshallinseln, martinique, mauretanien, mauritius, mayotte, mazedonien, mexiko, mikronesien, monaco, mongolei, montenegro, montserrat, mosambik, myanmar, namibia, nauru, nepal, neukaledonien, neuseeland, nicaragua, niederlande, niederländische antillen, niger, nigeria, niue, nördliche marianen, norfolkinsel, norwegen, oman, Österreich, osttimor, pakistan, palästinensische gebiete, palau, panama, papua-neuguinea, paraguay, peru, philippinen, pitcairn, polen, portugal, puerto rico, republik korea, republik moldau, réunion, ruanda, rumänien, russische föderation, salomonen, sambia, samoa, san marino, são tomé und príncipe, saudi-arabien, schweden, schweiz, senegal, serbien, seychellen, sierra leone, simbabwe, singapur, slowakei, slowenien, somalia, sonderverwaltungszone hongkong, sonderverwaltungszone macao, spanien, sri lanka, st. barthélemy, st. helena, st. kitts und nevis, st. lucia, st. martin, st. pierre und miquelon, st. vincent und die grenadinen, südafrika, sudan, südgeorgien und die südlichen sandwichinseln, suriname, svalbard und jan mayen, swasiland, syrien, tadschikistan, taiwan, tansania, thailand, togo, tokelau, tonga, trinidad und tobago, tschad, tschechische republik, tunesien, türkei, turkmenistan, turks- und caicosinseln, tuvalu, uganda, ukraine, ungarn, uruguay, usbekistan, vanuatu, vatikanstadt, venezuela, vereinigte arabische emirate, vereinigtes königreich, vereinigte staaten, vietnam, wallis und futuna, weihnachtsinsel, westsahara, zentralafrikanische republik, zypern. Your input: AT ::::

I also tried "Austria" as value.

PHP Array:

array(24) {
...
  'country_of_manufacture' =>
  string(2) "AT"
...
}

Using Magento v1.9.0.1

In "Settings > General > General > Frontend > Allowed Countries" everything is selected.

I see theres "Österreich" in there (which is Austria in German) but I dont think thats quite the correct way that we have to that that country name in our main tongue?! (Maybe AvSSimpleImport reads the wrong country table this time?)

paales commented 10 years ago

This isn't a known bug. All input should be translated properly. Have you set the localization of your shop correctly?

pquerner commented 10 years ago

I dont get what this import stuff has to do with localized country names. Why does this not work like customers country (where you have to give the country code, not the localized country name). Even if I have a german or english magento installation, I should be able to use the manufacturers country just like the customer country - per country code. Which doesnt care about localized country names, dont you agree ?

paales commented 10 years ago

Agreed, I think there is a special case build in for the customer country codes: https://github.com/OpenMage/magento-mirror/blob/5345da52778cc6f5f31938ffd21fccfdd353435c/app/code/core/Mage/ImportExport/Model/Import/Entity/Customer/Address.php#L113

There should be a similar option for the country_of_manufacture field.

paales commented 10 years ago

@pquerner Interested in building this functionality and creating a pull-request?

pquerner commented 10 years ago

@paales I'm afraid I am fairly new to the magento world and therefore got no real talent developing on such things, but I might give it a shot when I got some space. Is there any direction you could point me to, perhaps?

paales commented 10 years ago

Could you try and simply add it to:

protected $_indexValueAttributes = array('country_of_manufacture');
pquerner commented 10 years ago

@paales So this is per se not an issue of this Modul but of Magento itself?

paales commented 10 years ago

This is indeed a problem in the import functionality of Magento its self. The importer module is probably the most buggy code in Magento, so that's the reason this module exists (besides having the array option).

pquerner commented 10 years ago

I see. I have created an magento issue ticket regarding that problem. http://www.magentocommerce.com/bug-tracking/issue/index/id/316

paales commented 10 years ago

@pquerner Yeah, I give you a low chance of that ever getting fixed, but I guess it's good that you created it anyways. :smile:

pquerner commented 10 years ago

Well I know this wont get a high priority on their part. ;) I still might try to find out if thats an easy fix and apply the patch myself. But we'll see.

paales commented 10 years ago

@pquerner Fixed in https://github.com/avstudnitz/AvS_FastSimpleImport/commit/cec4b1bee76fb78fe07f8c6814af3e01629c1fe3

pquerner commented 9 years ago

@paales Can you explain this to me like I'm 5? Why did you just have to add the attribute to this array (and make it a local variable) to be able to use an "id" (in this case a country code as the id) in the import process?

paales commented 9 years ago

@pquerner The $_indexValueAttributes is originally defined in it's parent class and used somewhere in the code to use the index values, does that make sense?

pquerner commented 9 years ago

I think I got it:

src/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php

public function getAttributeOptions(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $indexValAttrs = array())

Defines what options to consider for an attribute. If that one attribute is in that array _indexValueAttributes the importer will look in the options "value" key. If its not in that array the importer will look in the options "label" key.