Question

I'm trying to make local module to add 1 field to my category admin. I checked 7 times and everyghing looks good. I don't know why but module installer is not starting. I used This Tutorial

My file path: app/etc/modules/Bottom_Name.xml

  <?xml version="1.0" encoding="UTF-8"?>
 <config>
<modules>
    <Bottom_Name>
        <active>true</active>
        <codePool>local</codePool>
    </Bottom_Name>
</modules>

Insie file app/code/local/Bottom_Name/etc/config.xml

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Bottom_Name>
            <!-- Make sure that the version number matches the filename on your install script! -->
            <version>0.1.0</version>
        </Bottom_Name>
    </modules>
    <global>
        <resources>
            <bottom_name_setup>
                <setup>
                    <module>Bottom_Name</module>
                    <!-- This next line is absolutely critical so that we call the appropriate setup class -->
                    <class>Mage_Catalog_Model_Resource_Setup</class>
                    <connection>
                        <use>core_setup</use>
                    </connection>
                </setup>
            </bottom_name_setup>
            <bottom_name_setup_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </bottom_name_setup_write>
            <bottom_name_setup_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </bottom_name_setup_read>
        </resources>
    </global>
</config>

And app/code/local/Bottom_Name/sql/bottom_name_setup/mysql4-install-0.1.0.php

<?php
Mage::log('Custom Name install start');
$installer = $this;
$installer->startSetup();

/**
 * This is an entity associated with catalog_category
 * @var  integer
 */
$entityTypeId     = $installer->getEntityTypeId('catalog_category');

/**
 * Use the default attribute set for catalog_category -- this refers to the table `eav_attribute_set`
 * In my case, it's 3, but this function should automatically get that for you.
 * @var integer
 */
$attributeSetId   = $installer->getDefaultAttributeSetId($entityTypeId);

/**
 * This determines what group (tab) that the field will be placed. "General Information"
 * is the default tab, and I'm okay with this, but see `eav_attribute_group` for other
 * groups
 * @var integer
 */
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);

/**
 * Let's set up our attribute, customize the type as needed (e.g. int, varchar, decimal)
 * Note where I've used `internal_title` and change to your variable.
 */
$installer->addAttribute('catalog_category', 'internal_title',  array(
    'type'     => 'varchar', /* Type - see eav_entity_* for the different types */
    'label'    => 'Nazwa Na stronie (prezentowana w dolnych kafelkach)', /* Your label */
    'input'    => 'text', /* This refers to the type of form field should display*/
    'global'   => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
    'visible'           => TRUE,
    'required'          => FALSE,
    'user_defined'      => FALSE,
    'default'           => ''
));

/**
 * Now, add the attribute to the proper attribute group - again, replace the variable title
 * with yours.
 */
$installer->addAttributeToGroup(
    $entityTypeId,
    $attributeSetId,
    $attributeGroupId,
    'internal_title',
    '2' /* Refers to the sort order of fields - see `eav_entity_attribute` for reference on the location of other fields.  I want this right below the active field, so 2 works for me.*/
);

$installer->endSetup();

And My core_resource table

|adminnotification_setup|1.6.0.0|1.6.0.0
|admin_setup|1.6.1.1|1.6.1.1
|api2_setup|1.0.0.0|1.0.0.0
|api_setup|1.6.0.1|1.6.0.1
|backup_setup|1.6.0.0|1.6.0.0
|bundle_setup|1.6.0.0.1|1.6.0.0.1
|captcha_setup|1.7.0.0.0|1.7.0.0.0
|catalogindex_setup|1.6.0.0|1.6.0.0
|cataloginventory_setup|1.6.0.0.2|1.6.0.0.2
|catalogrule_setup|1.6.0.3|1.6.0.3
|catalogsearch_setup|1.8.2.0|1.8.2.0
|catalog_setup|1.6.0.0.19|1.6.0.0.19
|checkout_setup|1.6.0.0|1.6.0.0
|cms_setup|1.6.0.0.2|1.6.0.0.2
|compiler_setup|1.6.0.0|1.6.0.0
|contacts_setup|1.6.0.0|1.6.0.0
|core_setup|1.6.0.6|1.6.0.6
|cron_setup|1.6.0.0|1.6.0.0
|customer_setup|1.6.2.0.3|1.6.2.0.3
|dataflow_setup|1.6.0.0|1.6.0.0
|directory_setup|1.6.0.2|1.6.0.2
|downloadable_setup|1.6.0.0.2|1.6.0.0.2
|eav_setup|1.6.0.1|1.6.0.1
|giftmessage_setup|1.6.0.0|1.6.0.0
|googleanalytics_setup|1.6.0.0|1.6.0.0
|importexport_setup|1.6.0.2|1.6.0.2
|index_setup|1.6.0.0|1.6.0.0
|iwdall_setup|2.0.4|2.0.4
|log_setup|1.6.1.0|1.6.1.0
|moneybookers_setup|1.6.0.0|1.6.0.0
|newsletter_setup|1.6.0.2|1.6.0.2
|oauth_setup|1.0.0.0|1.0.0.0
|opc_setup|4.0.8|4.0.8
|paygate_setup|1.6.0.0|1.6.0.0
|payment_setup|1.6.0.0|1.6.0.0
|paypaluk_setup|1.6.0.0|1.6.0.0
|paypal_setup|1.6.0.6|1.6.0.6
|persistent_setup|1.0.0.0|1.0.0.0
|poll_setup|1.6.0.0|1.6.0.0
|productalert_setup|1.6.0.0|1.6.0.0
|rating_setup|1.6.0.0|1.6.0.0
|reports_setup|1.6.0.0.1|1.6.0.0.1
|review_setup|1.6.0.0|1.6.0.0
|salesrule_setup|1.6.0.3|1.6.0.3
|sales_setup|1.6.0.8|1.6.0.8
|sendfriend_setup|1.6.0.0|1.6.0.0
|shipping_setup|1.6.0.0|1.6.0.0
|sitemap_setup|1.6.0.0|1.6.0.0
|tag_setup|1.6.0.0|1.6.0.0
|tax_setup|1.6.0.4|1.6.0.4
|usa_setup|1.6.0.3|1.6.0.3
|weee_setup|1.6.0.0|1.6.0.0
|widget_setup|1.6.0.0|1.6.0.0
|wishlist_setup|1.6.0.0|1.6.0.0
Was it helpful?

Solution

The main culprits of an install script not running:

  1. Typo or something incorrect in XML config.
  2. Install script was added sometime after module was installed and it never runs because core_resource already has an entry for the module.
  3. You're not emptying <webroot>/var/cache
  4. Incorrect file/directory names.

Your path of app/code/local/Bottom_Name should be app/code/local/Bottom/Name

OTHER TIPS

I realise it wasn't the solution in your case (and that your issue was resolved over 5 years ago!) but I found this question when having the same problem, and the issue for me was something slightly different, so I thought I'd share in case it's of any use to anyone:

The resource name and the SQL directory name must match.

I had this in my XML (names altered to match the question, to avoid confusion)...

<global>
    <resources>
        <bottom_name_setup>

...but the directory was Bottom/Name/sql/name_setup. Point 4 in the answer given by @pspahn set me in the right direction, and after renaming this to Bottom/Name/sql/bottom_name_setup (and removing the corresponding entry from core_resource, and clearing the cache) it worked.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top