Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Other option inspired in Mondane Answer is:</p> <ul> <li>copy /app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Image.php to /app/code/local/Mage/Catalog/Model/Category/Attribute/Backend/Image.php </li> <li>(if you don't have the path CREATE IT)</li> </ul> <p>after that edit the file you have created</p> <p>replace afterSave function with this code</p> <pre><code>public function afterSave($object) { $value = $object-&gt;getData($this-&gt;getAttribute()-&gt;getName()); if (is_array($value) &amp;&amp; !empty($value['delete'])) { $object-&gt;setData($this-&gt;getAttribute()-&gt;getName(), ''); $this-&gt;getAttribute()-&gt;getEntity() -&gt;saveAttribute($object, $this-&gt;getAttribute()-&gt;getName()); return; } /* Workaround to avoid exception '$_FILES array is empty' when assiging * products to a category or creating a category with the API. * Inspired by http://www.magentocommerce.com/bug-tracking/issue/?issue=11597 */ if (!isset($_FILES) || count($_FILES) == 0) { return; } $path = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'category' . DS; try { $uploader = new Mage_Core_Model_File_Uploader($this-&gt;getAttribute()-&gt;getName()); $uploader-&gt;setAllowedExtensions(array('jpg','jpeg','gif','png')); $uploader-&gt;setAllowRenameFiles(true); $result = $uploader-&gt;save($path); $object-&gt;setData($this-&gt;getAttribute()-&gt;getName(), $result['file']); $this-&gt;getAttribute()-&gt;getEntity()-&gt;saveAttribute($object, $this-&gt;getAttribute()-&gt;getName()); } catch (Exception $e) { if ($e-&gt;getCode() != Mage_Core_Model_File_Uploader::TMP_NAME_EMPTY) { Mage::logException($e); } /** @TODO ??? */ return; } } } </code></pre> <p>by doing this, you'll replace magento code without getting involved in core files, beacause magento will take this file automatically before taking the original file</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload