Question

I have custom module which is OneStepCheckout, in that I have added 2 fields to existing table. But it's not installed in core_resource and tables also fields are not installed.

my code is:

magento\app\etc\modules\Easylife_OnestepCheckout.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_OnestepCheckout>
            <active>true</active>
            <codePool>local</codePool>
        </Easylife_OnestepCheckout>
    </modules>
</config>

magento\app\code\local\Easylife\OnestepCheckout\etc\config.xml

<?xml version="1.0" encoding="utf-8"?>
<config>
    <modules>
        <Easylife_OnestepCheckout>
            <version>0.1.0</version>
        </Easylife_OnestepCheckout>
    </modules>

    <global>
        <models>
            <onestepcheckout>
                <class>Easylife_OnestepCheckout_Model</class>
            </onestepcheckout>
            <onestepcheckout_adminhtml>
                <class>Easylife_OnestepCheckout_Adminhtml_Model</class>
            </onestepcheckout_adminhtml>
        </models>
        <blocks>
            <checkout>
                <rewrite>
                    <links>Easylife_OnestepCheckout_Block_Links</links>
                </rewrite>
            </checkout>
            <onestepcheckout>
                <class>Easylife_OnestepCheckout_Block</class>
            </onestepcheckout>
        </blocks>
        <helpers>
            <checkout>
                <rewrite>
                    <url>Easylife_OnestepCheckout_Helper_Url</url>
                </rewrite>
            </checkout>
            <onestepcheckout>
                <class>Easylife_OnestepCheckout_Helper</class>
            </onestepcheckout>
        </helpers>
    </global>    
</config>

magento\app\code\local\Easylife\OnestepCheckout\sql\onestepcheckout_setup\install-0.1.0.php

<?php  

$installer = $this;
$installer->startSetup();

$installer->addAttribute(
    'sales_flat_order',
    'giftwrap',
    array(
        'type' => 'int',
        'grid' => false,
        'required' => false,
    )
);

$installer->addAttribute(
    'sales_flat_order',
    'giftwrap_price',
    array(
        'type' => 'decimal',
        'grid' => false,
        'required' => false,
    )
);

$installer->endSetup();

Can I know where I went wrong?

thanks.

Was it helpful?

Solution

In your config xml is missing resource definition in <global> node

   <resources>
        <onestepcheckout_setup>
            <setup>
                <module>Easylife_OnestepCheckout</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </onestepcheckout_setup>
    </resources>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top