0

So i'm really new to magento and all. So i need to implement feature like -> when user buys specific item the user is automaticly moved to another group. As i searched web i saw that i can make custom module for that.

I created a directory in /public_html/app/code/local/ named GroupSwitcher and with subdirectory Switch and as the tutorial mentioned i needed etc and Model

so i have 3 files My GroupSwitcher_Switch.xml contains

        <!-- Whether our module is active: true or false -->
        <active>true</active>

        <!-- Which code pool to use: core, community or local -->
        <codePool>local</codePool>

    </GroupSwitcher_Switch>
</modules>

my config.xml contains

<?xml version="1.0" encoding="UTF-8"?>

<!-- 
    The module's node contains basic 
    information about each Magento module
-->
<modules>

    <!--
        This must exactly match the namespace and module's folder
        names, with directory separators replaced by underscores
    -->
    <GroupSwitcher_Switch>

        <!-- The version of our module, starting at 0.0.1 -->
        <version>1.0.0</version>

    </GroupSwitcher_Switch>

</modules>

<global>

    <models>

        <!--
            Unique identifier in the model's node.
            By convention, we put the module's name in lowercase.
        -->
        <groupswitcher_switch>

            <!--
                The path to our models directory, with directory
                separators replaced by underscores
            -->
            <class>GroupSwitcher_Switch_Model</class>

        </groupswitcher_switch>

    </models>

    <!-- Defining an event observer -->
    <events>
        <sales_order_place_after>
            <observers>
                <groupswitcher_switch>
                    <class>sroupSwitcher_switch/observer</class>
                    <method>moveToGroup</method>
                    <type>singleton</type>
                </groupswitcher_switch>
            </observers>
        </sales_order_place_after>
    </events>
</global>

and Observe.php contains

    <?php

class GroupSwitcher_Switch_Model_Observer
{   
    public function moveToGroup(Varien_Event_Observer $observer)
    {

         var_dump($observer);
         die();
    }
}

So the problem is it wont fire when user finishes checkout... Could you please pint me in the right direction?

4

1 回答 1

1

只是我的第一个猜测,但有一个错字:

<class>groupswitcher_switch/observer</class>

代替

<class>sroupSwitcher_switch/observer</class>
于 2013-09-16T13:35:03.890 回答