3

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
  • Does your module already have an entry in the core_resource table? – pspahn May 8 '15 at 22:14
  • @pspahn I added in my post my core_resource table – woj_jas May 8 '15 at 22:33
5

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

  • 1. I'm sure that xml is correct 2. You can see that core_resource is empty of my module 3. I deleted var cache several times – woj_jas May 8 '15 at 22:51
  • I changed path of app/code/local and works like charm. Thank you my friend ! – woj_jas May 9 '15 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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