所以我对magento和所有人都很陌生。所以我需要实现像 - >这样的功能当用户购买特定项目时,用户自动移动到另一个组。当我搜索网页时,我看到我可以为此制作自定义模块。
我在/public_html/app/code/local/
中创建了一个名为GroupSwitcher
且子目录为Switch
的目录,正如我所说的教程我需要etc
和Model
所以我有3个文件
我的GroupSwitcher_Switch.xml
包含
<!-- 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>
我的config.xml
包含
<?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>
和Observe.php
包含
<?php
class GroupSwitcher_Switch_Model_Observer
{
public function moveToGroup(Varien_Event_Observer $observer)
{
var_dump($observer);
die();
}
}
所以问题是当用户完成结账时它不会触发......你能不能向我指出正确的方向?
答案 0 :(得分:1)
只有我的第一次猜测,但有一个错字:
<class>groupswitcher_switch/observer</class>
而不是
<class>sroupSwitcher_switch/observer</class>