0

Updated Config

in my config I have now (and it seems to see the script but then once I run it it gives me only a echo "Creating new column ......" then stop and does nothing):

<?xml version="1.0"?>
<config>
<modules>
    <EDPA_Adpan>
        <version>0.0.1</version>
    </EDPA_Adpan>
</modules>
<global>
    <blocks>
        <edpa_adpan>
            <class>EDPA_Adpan_Block</class>
        </edpa_adpan>
    </blocks>
    <helpers>
        <edpa_adpan>
            <class>EDPA_Adpan_Helper</class>
        </edpa_adpan>
    </helpers>
    <resources>
        <adpan_setup>
            <setup>
                <module>EDPA_Adpan</module>
                <class>Mage_Core_Model_Resource_Setup</class>
            </setup>
        </adpan_setup>
    </resources>
</global>
<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <EDPA_Adpan before="Mage_Adminhtml">EDPA_Adpan_Adminhtml</EDPA_Adpan>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
<adminhtml>
    <layout>
        <updates>
            <edpa_adpan>
                <file>edpa/adpan.xml</file>
            </edpa_adpan>
        </updates>
    </layout>
</adminhtml>

then in mysql4-upgrade-0.0.4-0.0.5

echo 'Creating new column ......';
/* @var $this Mage_Eav_Model_Entity_Setup */ 
// Add an extra column to the eav/catalog_products table:
$installer = $this;
$connection = $installer->getConnection();
$installer->startSetup();
$installer->getConnection()->addColumn($installer-
getTable('eav/catalog_product_entity '),
'lo',
array(
    'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
    'nullable' => false,
    'default' => '0',
    'comment' => 'Price reduction lo level (%)'
));
$installer->getConnection()
->addColumn($installer->getTable('eav/catalog_product_entity '),
'hi',
array(
    'type' => Varien_Db_Ddl_Table::TYPE_VARCHAR,
    'nullable' => false,
    'default' => '100',
    'comment' => 'Price reduction hi level (%)'
));$installer->endSetup();

expecting it will stop because there is die(); in a code but it doesn't It also updating record in core_resource to the new version but table is not altered, can anyone explain me why ? or maybe the table name is wrong ? These new columns should appear in catalog_products_entity. I managed to remove all the errors but it still won't create additional columns in database.

3
  • Can you give me detail config file Commented Sep 5, 2016 at 2:56
  • try installing magento again with your codebase and a clean db. Sometimes these setup files are cached but flushing the cache doesn't help.
    – CCK1979
    Commented Sep 5, 2016 at 6:15
  • Hello guys, Martuza - update: above is my complete config.
    – Rob D. A.
    Commented Sep 5, 2016 at 6:44

2 Answers 2

1

Hi you have an extra space in your installer table name. Please remove space from all shown in below example

From

getTable('eav/catalog_product_entity '),

To

getTable('eav/catalog_product_entity'),

and also from here

from ->addColumn($installer->getTable('eav/catalog_product_entity ')

To

->addColumn($installer->getTable('eav/catalog_product_entity')

you have this issue because magento won't find Table name for in that case

and also update your version to 0.0.5 in cofig.xml file like below

<modules>
  <EDPA_Adpan>
    <version>0.0.5</version>
  </EDPA_Adpan>
</modules>
4
  • already removed, still won't work ;(
    – Rob D. A.
    Commented Sep 5, 2016 at 11:30
  • See My updated answer Commented Sep 5, 2016 at 11:33
  • Any Update for this ??? Commented Sep 5, 2016 at 18:12
  • Not yet, just came back home. Will update soon:)
    – Rob D. A.
    Commented Sep 5, 2016 at 20:31
1

Apart from removing spaces in table's name -

getTable('eav/catalog_product_entity')

You have written wrong version in your config.xml, use below mentioned one -

<modules>
  <EDPA_Adpan>
    <version>0.0.5</version>
  </EDPA_Adpan>
</modules>

Also in your database table "core_resources", search for module version entry "adpan_setup" and delete that. After that browse your website. It will execute upgrade script.

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.