6

I have recently installed Magento 1.9.1 and trying to make use of the category thumbnails (as well as the main image).

However, I have gone to Admin >> Catalog >> Manage Categories and it seems to have disappeared, I can't add a category thumbnail.

I have checked the release notes and there is no mention of this, I have disabled a few modules, Reviews, PayPal, etc.

I have enabled Flat Categories as well but I have tried enabled/disabled everything but it seems to remain gone :(

2
  • In fact I have just noticed that with a fresh install of 1.9.1 the category thumbnail field isn't present. Anyway to get this back? Dec 11, 2014 at 15:10
  • Open /app/etc/modules/Mage_XmlConnect.xml, change false to true, then clear cache. That's it. Credits to Vova Yatsyuk for the answer below. :)
    – jehzlau
    Sep 9, 2016 at 8:46

3 Answers 3

6

Important notes before starting:

  1. For this solution I'll call our PackageName "MyProject" and our ModuleName "Catalog". If you're familiar with Magento extension development you can change these names as you like, otherwise just follow these steps as is and you should have yourself your missing thumbnail field.
  2. If caching is turned off, it is probably important that no HTTP requests hit the site between step 2 and step 3. I believe if this were to happen Magento may attempt to look for the version 1.0.0 installation script, and despite not being found, mark the extension as "installed" in the core_resource table, causing the installation script in step 3 to never run. An easy solution to avoid this is to make sure the "Configuration" cache type is enabled prior to following these instructions.
  3. For steps 2 and 3, create any necessary directories for these files. Paths are important here so pay close attention to directory names as well as file names. File & directory names are also case sensitive.
  4. At the end of this I explain how to add even more additional image fields if desired. If you're looking to do this, make sure to add all your configuration (covered in step 3) to the installer script before it runs. Once it runs, Magento will not run the installer script again. If this happens you'll have to read up on how to run "upgrade" installer scripts by incrementing your extension's version number and creating appropriately named upgrade scripts.

Step 1: Create the file app/etc/modules/MyProject_Catalog.xml with the following contents:

<?xml version="1.0"?>
<config>
    <modules>
        <MyProject_Catalog>
            <active>true</active>
            <codePool>local</codePool>
        </MyProject_Catalog>
    </modules>
</config>

Step 2: Create the file app/code/local/MyProject/Catalog/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <MyProject_Catalog>
            <version>1.0.0</version>
        </MyProject_Catalog>
    </modules>
    <global>
        <resources>
            <myproject_catalog_setup>
                <setup>
                    <module>MyProject_Catalog</module>
                    <class>Mage_Catalog_Model_Resource_Setup</class>
                </setup>
            </myproject_catalog_setup>
        </resources>
    </global>
</config>

Step 3: Create the file

    app/code/local/MyProject/Catalog/sql/myproject_catalog_setup/mysql4-install-1.0.0.php

with the following contents:

<?php
/**
 * Adds Thumbnail Image back to category entities
 */

$this->startSetup();

$attributes = array(
    'thumbnail' => array(
        'type'       => 'varchar',
        'label'      => 'Thumbnail Image',
        'input'      => 'image',
        'backend'    => 'catalog/category_attribute_backend_image',
        'required'   => false,
        'sort_order' => 5,
        'global'     => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'group'      => 'General Information',
    ),
);

foreach ($attributes as $code => $data) {
    $this->addAttribute(Mage_Catalog_Model_Category::ENTITY, $code, $data);
}

$this->endSetup();

Step 4: Refresh the the "Configuration" cache type if it is enabled, or if it was not enabled from the start, simply make a HTTP request to the site. The first HTTP request to the site (without cached configuration XML files) should cause Magento to find your extension, run the installer script, and then mark the extension as installed in the core_resource table.

Explanation of each step:

  1. This file tells Magento that our extension exists, is active, and where (based off it's name and code pool) to look for it's configuration file
  2. This file is our extension's primary configuration file. For this extension, we simply give it a version number (necessary for the installation script to run) and specify that it has setup resources.
  3. This is our extension's installer script. It is what adds the thumbnail image back into Magento. I've supplied configuration values to put it right back where we expected it to be in the past, next to "Image" on the "General Information" tab.
  4. Self explanatory...

Final Notes:

  1. Examining our installer script in Step 3, one can see that it would be rather easy to add any number of additional image fields to categories by specifying additional arrays to the $attributes variable. The $attributes variable is a key=>value pair of 'attribute_code' => $config_array values.
  2. If you desire additional image fields, it would be required to update at least the 'attribute_code' for each. Preferably, the label & position should be updated as well. Lastly, one may also want to change the 'group' if desired. Out of the box, Magento comes with "General Information", "Display Settings", "Custom Design", and "Category Products" groups for Category entities. However, if you were to supply a group name that does not exist, the installer script will know to create that group for you and add your new category attribute to the new group. The tab will automatically appear for you in the admin.
1
  • @TheRabbitFactory Your welcome. Jan 14, 2015 at 14:00
8

This issue occurs on fresh Magento 1.9.1 installations only.

The problem is that thumbnail attribute is created by Mage_XmlConnect module, which became inactive since 1.9.1.

So you can either fix this by enabling the Mage_XmlConnect module:

  1. Open /app/etc/modules/Mage_XmlConnect.xml
  2. Find the <active>false</active> line and replace it with <active>true</active>
  3. Navigate to Cache Management page and flush cache storage.
2
  • This should be the accepted answer. While Meogi's solution will technically work, the real underlying issue was just that the Mage_XmlConnect module needed to be enabled to create this attribute. It's worth noting that you can disable the module again after the attribute has been created by the install script. Aug 18, 2016 at 15:46
  • I agree. This should be the correct answer. Fastest and easiest way to return the thumbnail attribute for categories in Magento 1.9.1 and above. :)
    – jehzlau
    Sep 9, 2016 at 8:45
1

Replace <active>false</active> with <active>true</active> in "/app/etc/modules/Mage_XmlConnect.xml"

The above changes works perfectly in Magento 1.9.2.4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.