1
votes

I try to upgrade my custom Magento module but for some reason it's not working.

My module config:

<?xml version="1.0"?>
<config>
    <modules>
        <MVE_CategoryAttribute>
            <version>0.1.1</version>
        </MVE_CategoryAttribute>
    </modules>
    <global>
            <resources>
                <categoryattribute_setup>
                  <setup>
                    <module>MVE_CategoryAttribute</module>
                    <class>Mage_Eav_Model_Entity_Setup</class>
                  </setup>
                  <connection>
                    <use>default_setup</use>
                  </connection>
                </categoryattribute_setup>
            </resources>
    </global>
</config>

The installation script (mysql4-install-0.1.0.php):

<?php

$this->startSetup();

$this->addAttribute('catalog_category', 'imagetext', array(
    'group'         => 'General Information',
    'input'         => 'textarea',
    'type'          => 'varchar',
    'label'         => 'Tekst op afbeelding',
    'backend'       => '',
    'visible'       => 1,
    'required'      => 0,
    'user_defined' => 1,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));

$this->endSetup();

?>

The upgrade script (mysql4-upgrade-0.1.0-0.1.1.php):

<?php   
$this->startSetup();     
$this->updateAttribute('catalog_category', 'imagetext', 'global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE);  
$this->endSetup();  
?>
3
try renaming file mysql4-data-upgrade-0.1.0-0.1.1.php and tryKalpesh
put some Mage log to check whether the file is been called or notKalpesh

3 Answers

6
votes

Check the version number in core_resource for your module. If it still 0.1.0, then clear your xml cache and restart the page, it should run. If it is already 0.1.1 and you know the database changes haven't been applied, change the value back to 0.1.0, clear your xml cache and refresh page.

2
votes

Try this:

<?php
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->updateAttribute('catalog_category', 'imagetext', 'is_global', Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE);
$installer->endSetup();
1
votes

Make sure 3 Conditions are met:

  1. Your modules version no. is not present in core_resource table.
  2. You have a version no. defined in your module's etc/config.xml file.
  3. You have defined a global resource for your module's setup/upgrade using a tag name of yourmodule_setup