订单上的Magento Observer事件没有解雇

use*_*937 1 php magento

当有人点击下订单但我没有开火时,我正试图举办活动.我知道它有效,因为我可以将事件更改为产品更新,当我更新它在日志文件中写入的产品时.我正在使用粉碎杂志教程,只是改变了事件.

我尝试过这两个事件:

  • checkout_submit_all_after
  • checkout_onepage_controller_success_action

我究竟做错了什么?

config.xml中

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <SmashingMagazine_LogProductUpdate>
            <version>0.0.1</version>
        </SmashingMagazine_LogProductUpdate>
    </modules>

    <!-- Configure our module's behavior in the global scope -->
    <global>

        <!-- Defining models -->
        <models>

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

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

            </smashingmagazine_logproductupdate>

        </models>

        <events>
            <checkout_submit_all_after>
                <observers>
                    <smashingmagazine_logproductupdate>
                        <class>smashingmagazine_logproductupdate/observer</class>
                        <method>logUpdate</method>
                        <type>singleton</type>
                    </smashingmagazine_logproductupdate >
                </observers>
            </catalog_product_save_after>
        </events>

    </global>

</config>
Run Code Online (Sandbox Code Playgroud)

Observer.php

<?php
/**
 * Our class name should follow the directory structure of
 * our Observer.php model, starting from the namespace,
 * replacing directory separators with underscores.
 * i.e. app/code/local/SmashingMagazine/
 *                     LogProductUpdate/Model/Observer.php
 */

class SmashingMagazine_LogProductUpdate_Model_Observer
{
    /**
     * Magento passes a Varien_Event_Observer object as
     * the first parameter of dispatched events.
     */
    public function logUpdate(Varien_Event_Observer $observer)
    {



        // Write a new line to var/log/product-updates.log
        $name = 'asdf';
        $sku = 'weee';
        Mage::log(
            "{$name} ({$sku}) updated",
            null, 
            'product-updates.log'
        );
    }
}
Run Code Online (Sandbox Code Playgroud)

liy*_*kat 5

只是下面的例子试图把直接观测类和语法,以及你有空间,独特的标签一样 </smashingmagazine_logproductupdate >,这应该是 </smashingmagazine_logproductupdate>

<events> 
     <checkout_submit_all_after>
          <observers>
            <smashingmagazine_logproductupdate>
                 <class>SmashingMagazine_LogProductUpdate_Model_Observer</class>
                 <method>logUpdate</method>
            </smashingmagazine_logproductupdate>
          </observers>
     </checkout_submit_all_after>
</events>      
Run Code Online (Sandbox Code Playgroud)

希望这一定会帮助您解决问题.