Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Exporting multiple select attributes with magento 1.5
 
centervanliemp1
Jr. Member
 
Total Posts:  9
Joined:  2011-02-09
 

Hi folks

The new export dont exports mutiple select values?

I expected “value1 , value2” but instead i get no value at all.

Image Attachments
Afbeelding 25.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

please can send me a csv test?

 
Magento Community Magento Community
Magento Community
Magento Community
 
centervanliemp1
Jr. Member
 
Total Posts:  9
Joined:  2011-02-09
 

here you go.

cells Z49 en Z50 should contain “din-327B , din-1835-B”

File Attachments
catalog_product.zip  (File Size: 5KB - Downloads: 99)
 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

HI again! I have good news!

I am pleased to inform you that my free extension ”AMartinez_CustomImportExport” can now export as well.

It’s the first step to future functionalities. Please try it with your multiple select attributes!

Feel free to test it and report any issue or suggestion!

 
Magento Community Magento Community
Magento Community
Magento Community
 
IngGross_de
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2009-03-18
Switzerland
 

Hi amartinez

thank you for this wonderful extension.

I was not able to install it on my system directly, as Magento Connect installed only your csv-files and nothing more. Then I used another Magento-Installation, there the install worked and I copied your php-files to my machine and it works there.

But then I imported attached csv and it failed:
Instead of importing the multiselect-field values next to SKU, it added the whole line as a new value into the attribute. Althought the values were already entered to this attribute.

Please take a look at the csv. Do I have to change something?

Thanks in advance!

Res

“sku”,"recommended_ribbon_series_new"
18416,"M71-R-4300,M71-R-6000,M71-R-4400-WT,M71-R-6900 (Colours),R-4300”

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

Hi!

For multiple-valued fields you need to use a file with .csv1 extension, e.g.: my_own_file.csv1

Then add your own fields to app/code/community/AMartinez/CustomImportExport/Model/Import/Adapter/Csv1.php

Change every line with

$this->_setValues(array('_store''visibility''_category''_associated_sku'));

and

$this->_getValues(array('_store''visibility''_category''_associated_sku'));

by adding your field name:

$this->_setValues(array('_store''visibility''_category''_associated_sku','recommended_ribbon_series_new'));

regards!

 
Magento Community Magento Community
Magento Community
Magento Community
 
IngGross_de
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2009-03-18
Switzerland
 

Hi amartinez
I have done that. But the behaviour did not change.
I first deleted the new entry in the attribut and changed that attribute manually to something else.

Then this shell-command:
[11:06]:localhost:#:>php -f app/code/community/AMartinez/CustomImportExport/shell/run.php—-i var/import/test.csv1
Start ‘replace’ action (products source file: var/import/test.csv1, raw line count: 1)
:::: New attribute option added: recommended_ribbon_series_new - M71-R-4300,M71-R-6000,M71-R-4400-WT,M71-R-6900 (Colours),R-4300 (first ocurrence in line 1) ::::
Done (processed rows count: 1)

But this added again a new attribut
M71-R-4300,M71-R-6000,M71-R-4400-WT,M71-R-6900 (Colours),R-4300
instead of adding thes multipleselect for these five:
M71-R-4300
M71-R-6000
M71-R-4400-WT
M71-R-6900 (Colours)
R-4300

What can I do?
yours
Res

this is my test.csv1 - only 2 lines:

sku,recommended_ribbon_series_new
18416,"M71-R-4300,M71-R-6000,M71-R-4400-WT,M71-R-6900 (Colours),R-4300”

a product with sku=18416 already exists.

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

please give me your actual “app/code/community/AMartinez/CustomImportExport/Model/Import/Adapter/Csv1.php”

thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
IngGross_de
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2009-03-18
Switzerland
 

Hi Toni

amartinez - 11 May 2011 01:27 PM

Hi!
Then add your own fields to app/code/community/AMartinez/CustomImportExport/Model/Import/Adapter/Csv1.php

Change every line with

$this->_setValues(array('_store''visibility''_category''_associated_sku'));

and

$this->_getValues(array('_store''visibility''_category''_associated_sku'));

by adding your field name:

$this->_setValues(array('_store''visibility''_category''_associated_sku','recommended_ribbon_series_new'));

that was my fault. I have done that only once. Now this is corrected, there are several occurances.
Would be better one does not need to change this code, but that you get the field names from the database.
Or at least from a csv-file, which has to be supplied by the user of your extension.

But still the software does not what I expected:

php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -var/import/test.csv1
Start 
'replace' action (products source file: var/import/test.csv1raw line count1)
:::: New 
attribute option addedrecommended_ribbon_series_new M71-R-4300 (first ocurrence in line 1) ::::
Done (processed rows count5)

It only adds the first item, not the other 4.
yours
Res

 
Magento Community Magento Community
Magento Community
Magento Community
 
IngGross_de
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2009-03-18
Switzerland
 
amartinez - 12 May 2011 12:27 AM

please give me your actual “app/code/community/AMartinez/CustomImportExport/Model/Import/Adapter/Csv1.php”

thanks!

here you are.

File Attachments
Csv1.php  (File Size: 6KB - Downloads: 46)
 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

can you execute now?

I add this to last line:

print_r($this->_currentRow);

analyze echoes

thanks!

File Attachments
Csv1.php  (File Size: 6KB - Downloads: 51)
 
Magento Community Magento Community
Magento Community
Magento Community
 
IngGross_de
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2009-03-18
Switzerland
 
amartinez - 12 May 2011 12:56 AM

can you execute now?

I add this to last line:

print_r($this->_currentRow);

analyze echoes

thanks!

I have done that. But since 30 minutes this is running without much feedback or coming to an end:

php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -var/import/test.csv1
Start 
'replace' action (products source file: var/import/test.csv1raw line count1)

yours
Res

 
Magento Community Magento Community
Magento Community
Magento Community
 
IngGross_de
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2009-03-18
Switzerland
 
amartinez - 12 May 2011 12:56 AM

can you execute now?

I add this to last line:

print_r($this->_currentRow);

analyze echoes

thanks!

Hi Toni
I have done it again and this time it reacted immediately. This is the outcome and it looks as if there is an error in 3rd and later Array[0]

php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -var/import/test.csv1
Start 
'replace' action (products source file: var/import/test.csv1raw line count1)
Array
(
    
[0] => 18416
    [1] 
=> M71-R-4300
)
Array
(
    
[0] => 18416
    [1] 
=> M71-R-4300
)
Array
(
    
[0] => 
    
[1] => M71-R-6000
)
Array
(
    
[0] => 
    
[1] => M71-R-4400-WT
)
Array
(
    
[0] => 
    
[1] => M71-R-6900 (Colours)
)
Array
(
    
[0] => 
    
[1] => R-4300
)
Done (processed rows count5)
 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

mmm no: that\’s ok smile

csv1 adapter convert your single-row csv to multilple new one:

18416,M71-R-4300
,M71-R-6000
,M71-R-4400-WT
,M71-R-6900 (Colours)
,
R-4300

by the way… do you test to import through .csv file? please can you make it?

and what\’s your attribute type?

I will test some other ideas too

 
Magento Community Magento Community
Magento Community
Magento Community
 
amartinez
Guru
 
Avatar
Total Posts:  347
Joined:  2008-11-14
Spain
 

I think the question is your attribute type: select? multiple or single? required? configurable?

regards!

 
Magento Community Magento Community
Magento Community
Magento Community
 
IngGross_de
Sr. Member
 
Avatar
Total Posts:  93
Joined:  2009-03-18
Switzerland
 
amartinez - 12 May 2011 01:40 AM

by the way… do you test to import through .csv file? please can you make it?

you mean by standard means: menu-import/Export-DataflowProfiles etc?
This deletes the entry in this multiple-Select field.

Manually I can successfull set several values in this attribute.

amartinez - 12 May 2011 01:40 AM

and what\’s your attribute type?

Attribute Properties
Attribute Code
recommended_ribbon_series_new 
Scope
: Global
Catalog Input Type for Store OwnerMultiple Select
Unique Value
No
Values Required
No
Input Validation 
for Store OwnerNone
Apply To
All Product Types

Frontend Properties
Use in Quick SearchNo
Use in Advanced SearchYes
Comparable on Front
-endYes
Use In Layered NavigationFilterable (with results)
Use 
In Search Results Layered NavigationNo
Use for Promo Rule ConditionsNo
Position
0
Visible on Product View Page on Front
-endYes
Used in Product Listing
Yes
Used 
for Sorting in Product ListingNo
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2