Skip to content
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

Array support for attribute set import #241

Open
Morgy93 opened this issue Apr 3, 2020 · 2 comments
Open

Array support for attribute set import #241

Morgy93 opened this issue Apr 3, 2020 · 2 comments

Comments

@Morgy93
Copy link

Morgy93 commented Apr 3, 2020

It would be awesome to have array support for the attribute set import.
Currently:

for any additional Attribute Group a new row has to be added
https://docs.m2if.com/38/file-structure/attributes-set-and-group-import/attribute-groups

But instead of

attribute_set_name based_on entity_type_code sort_order attribute_group_name attribute_group_code attribute_group_tab_group_code attribute_group_sort_order default_id
Bag   catalog_product 2 Product Details product-details basic 10 1
        Content content

I'd love to see something like the multiple-field-delimiter and multiple-value-delimiter which exists for product import https://docs.m2if.com/38/file-structure/product-import/additional-attributes

For example:

attribute_set_name based_on entity_type_code sort_order attribute_group attribute_group_tab_group_code attribute_group_sort_order default_id
Bag   catalog_product 2 name="Product Details"|code="product-details",name="Content"|code="content"|tab_group_code="advanced" basic 10 1
@wagnert
Copy link
Member

wagnert commented Apr 4, 2020

@Morgy93 I'll check this, but in general, it's much more complicated for most of our users/customers to create CSV files using that more or less complex data format you're requesting. For most of them, it's much easier to create a CSV file with additional columns or rows. But I'll check it and see if there is any possibility, therefore.

@wagnert wagnert self-assigned this Apr 4, 2020
@Morgy93
Copy link
Author

Morgy93 commented Apr 7, 2020

Really? For me that has always been some pretty weird practice.
For PHP and especially with Magento (collections and so on) I think it's rather stressful to have to build csv data like this.

Easy:

foreach ($products as $product) {
    fputcsv($handle, [
        $product->getSku(),
        $product->getName(),
        implode('|', $product->getCategoryIds()),
        ...
    ]);
}

Just one weird example which should at least show that it can get pretty complicated real quick 😁 :

foreach ($products as $product) {
    $categories = $product->getCategoryIds();
    fputcsv($handle, [
        $product->getSku(),
        $product->getName(),
        $categories[0],
        ...
    ]);
    if (count($categories) > 1) {
        foreach ($categories as $category) {
            fputcsv($handle, [
                '',
                '',
                $category,
                ...
            ]);
        }
    }
}

(After writing this I found out that it wouldn't even work like this with multiple array data .. but that should just make it even clearer 🤷‍♂ )

Just my two cents~

@wagnert wagnert removed their assignment Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants