cancel
Showing results for 
Search instead for 
Did you mean: 

Category 'image' attribute type implementation to work with any attribute code

0 Kudos

Category 'image' attribute type implementation to work with any attribute code

Feature request from allanpaiste, posted on GitHub Aug 04, 2016

Currently it's not possible to create an 'image' EAV attribute for category as the code in many places has been hardcoded to talk only with attribute that is explicitly been named 'image'.

This PR addresses that problem by steering the code towards more generic approach to the whole situation by detecting all matching attributes via backendModel check.

Related issue: https://github.com/magento/magento2/issues/5438

8 Comments
apiuser
New Member

Comment from ashishjob0424, posted on GitHub Aug 12, 2016

Great job allanpaiste, vkorotun thanks for the update.

apiuser
New Member

Comment from aeno, posted on GitHub Aug 16, 2016

@allanpaiste, how could I apply this patch in an existing Magento 2.1 install?

apiuser
New Member

Comment from allanpaiste, posted on GitHub Aug 16, 2016

add this to your composer json:

{

    "require": {
        "cweagans/composer-patches": "~1.4.0",
    },

    "extra": {
        "patches": {
            "magento/module-catalog": {
                "Fix: https://github.com/magento/magento2/issues/5438": "patches/Patch-Magento_Catalog-M2.1.0-image-attribute-backend-model-hardcoded-attribute-code-removal.patch"
            },
            "magento/module-ui": {
                "Fix: https://github.com/magento/magento2/issues/5438": "patches/Patch-Magento_Ui-M2.1.0-allow-backend-to-know-the-origin-input-of-the-upload-request.patch"
            },
        }
    }

}

And add these ...

  1. https://github.com/allanpaiste/magento2-patches/blob/master/Patch-Magento_Catalog-M2.1.0-image-attri...
  2. https://github.com/allanpaiste/magento2-patches/blob/master/Patch-Magento_Ui-M2.1.0-allow-backend-to...

... to your /patches folder

apiuser
New Member

Comment from aeno, posted on GitHub Aug 16, 2016

Thanks, that worked. :+1:

apiuser
New Member

Comment from malviyaharishankar, posted on GitHub Aug 17, 2016

@allanpaiste Can you please tell me the steps to apply the patches or can provide reference from where i can implement it on my setup.

apiuser
New Member

Comment from allanpaiste, posted on GitHub Aug 17, 2016

The patches have been created to be used for composer M2 projects.

So if you have used steps described at http://devdocs.magento.com/guides/v2.0/install-gde/prereq/integrator_install.html, you should have a M2 project that has composer.json at it's core that dicrates which packages are installed.

  1. In project root folder: composer require cweagans/composer-patches=~1.4.0
  2. Copy the patches you want to use under /patches
  3. the project composer.json should also already have an "extra" key defined. if you add new sub-key there called "patches" (see above), then the next time you do "composer update", the modules that have patches defined will be re-installed and patches applied. Patches have file-target paths that are relative to composer packages which means that the context defined in composer.json is pretty important and patches are not directly appliable in context on magento/magento2 repository, but they're ripe to be used for composer project.
apiuser
New Member

Comment from ashishjob0424, posted on GitHub Aug 18, 2016

@allanpaiste Patch works for me also, only changes i need to make in my composer is

"extra": {
        "patches": {
            "magento/module-catalog": {
                "Fix: https://github.com/magento/magento2/issues/5438": "patches/Patch-Magento_Catalog-M2.1.0-image-attribute-backend-model-hardcoded-attribute-code-removal.patch"
            },
            "magento/module-ui": {
                "Fix: https://github.com/magento/magento2/issues/5438": "patches/Patch-Magento_Ui-M2.1.0-allow-backend-to-know-the-origin-input-of-the-upload-request.patch"
            }
        },
    }

Position of "," is changed as compared to your code.

topspotsupport
Senior Member

Hello,

 

I was able to apply the patches successfully but the issue still remains.  I'm stil getting "The file was not uploaded." Screenshot 2016-09-05 00.12.59.png

 

I also following all the instructions on how to add the module here: http://magento.stackexchange.com/questions/129883/magento-2-1-custom-category-image-attribute-is-not...