2

I've added two category attributes successfully to magento admin. However when I run an upgrade script to add another, "core_resource" takes note of my module update but doesn't install the new attribute.

Here is my upgrade-1.0.1-1.0.2.php

<?php
$this->startSetup();

$this->addAttribute('catalog_category', 'is_brand', array(
    'group'                     => 'Display Settings',
    'type'                      => 'int',
    'input'                     => 'select',
    'source'                    => '',
    'label'                     => 'Is a brand?',
    'backend'                   => '',
    'visible'                   => 1,
    'required'                  => 0,
    'user_defined'              => 999,
    'default'                   => 0,
    'global'                    => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
));

$this->endSetup();

and as mentioned I updated config.xml to <version>1.0.2</version>

Nothing is added to the admin panel, no errors, no log errors.

Any ideas?

10
  • check in core_resource table for your module version,,,or try to clear cache,,,
    – Keyur Shah
    Jul 28, 2015 at 10:36
  • Hey, as mentioned above core_resource takes note of my module update and cache is not enabled.
    – Stefkay
    Jul 28, 2015 at 10:37
  • whats your current version in core_Resource table ?
    – Keyur Shah
    Jul 28, 2015 at 10:38
  • and your upgrade script name should be mysql4-upgrade-1.0.1-1.0.2
    – Keyur Shah
    Jul 28, 2015 at 10:39
  • Current version is 1.0.2 in core_resource, also hasn't the use of mysql been deprecated?
    – Stefkay
    Jul 28, 2015 at 10:41

3 Answers 3

3

From comment your file name should be

The second script name was not correct

upgrade-1.0.1.php
    upgrade-1.0.1-1.0.2 
2
  • That is not the answer.
    – Stefkay
    Jul 28, 2015 at 10:58
  • @Stefkay i have updated my answer thanks to pointing
    – Keyur Shah
    Jul 28, 2015 at 10:59
2

i've sorted this.

Problem was I had:

install-1.0.0.php
upgrade-1.0.1.php
upgrade-1.0.1-1.0.2.php

The second script name was not correct and was breaking the chain of running scripts.

Thanks to Keyur Shah his help led me to solving the problem.

1

For me, the reason why it was not triggered is that I had different version in the table core_resource from the xml version from config.xml.

In my case, the xml version was 1.4.0 and in the databse I had 1.4.2

I posted this, so it might help others facing this issue. Thank you

Your Answer

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

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