开发者

Custom module doesnt work on live

I 开发者_运维知识库have written a custom module using catalog_product_save_after hook to save attributes programmatically in each products. Though it works on my localhost(wamp with windows) but it doesn’t work on live. I am using community edition of Magento ver. 1.4.1.1

Inside app\etc\modules, the xml file is as following ,

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

And inside app\code\local\VP\CustomOptions\etc, the config.xml is as following

     <?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <config>
    <modules>
    <VP_CustomOptions>
    <version>0.0.1</version>
    </VP_CustomOptions>
    </modules>
    <global>
    <events>
    <catalog_product_save_after>
    <observers>
    <custom_options>
    <type>singleton</type>
    <class>VP_CustomOptions_Model_Observer</class>
    <method>Add_CustomOptions_Automatically</method>
    </custom_options>
    </observers>
    </catalog_product_save_after>
    </events>
    </global>
    </config> 


I have solved the issue. It was due to the name of the model directory. I used small case on Windows as

/app/code/local/VP/CustomOptions/model

And when I changed the model folder to capital on linux, it works. I have changed the model folder name as following

/app/code/local/VP/CustomOptions/Model


Someone else will probably be able to weigh in on exactly why, but module names should have one capital letter for each part (separated by _). Try renaming your module to Vp_Customoptions. (Part of the reason is because Magento uses the names to automatically find classes). Also rename your directories to Vp/Customoptions etc.

Windows is case insensitive to file and directory names so it works fine there, but Linux and others are case sensitive. Hence it fails.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜