私はオーバーライドする必要があるstockAction()
でAddController.php
のcode/core/Mage/ProductAlert/controllers
。だから私はどのように進めるかを見るためにたくさん検索し、これを手に入れました:
/etc/modules/Totem_ProductAlert.xml
<?xml version="1.0"?>
<config>
<modules>
<Totem_ProductAlert>
<active>true</active>
<codepool>local</codepool>
</Totem_ProductAlert>
</modules>
</config>
/code/local/Totem/ProductAlert/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Totem_ProductAlert>
<version>0.0.1</version>
</Totem_ProductAlert>
</modules>
<frontend>
<routers>
<productalert>
<args>
<modules>
<Totem_ProductAlert before="Mage_ProductAlert">Totem_ProductAlert</Totem_ProductAlert>
</modules>
</args>
</productalert>
</routers>
</frontend>
</config>
/code/local/Totem/ProductAlert/controllers/AddController.php
class Totem_ProductAlert_AddController extends Mage_ProductAlert_AddController
{
public function stockAction()
{
Mage::log('test', null, 'Test.log');
}
ただし、アクションはオーバーライドされず、Test.logは作成されていません。
誰かが私がどこでめちゃくちゃになったか知っていますか?
ありがとう。
コードに問題があります:
syntax issue
でTotem_ProductAlert.xml。<codepool>
する必要があります<codePool>
.Pは大文字でなければなりません。<?xml version="1.0"?>
<config>
<modules>
<Totem_ProductAlert>
<active>true</active>
<codePool>local</codePool>
<depends>Mage_ProductAlert</depends>
</Totem_ProductAlert>
</modules>
</config>
Totem_ProductAlert_AddController
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of AddController
*
* @author work
*/
require_once Mage::getModuleDir('controllers', 'Mage_ProductAlert').DS.'AddController.php';
class Totem_ProductAlert_AddController extends Mage_ProductAlert_AddController
{
public function stockAction()
{
Mage::log('test', null, 'Test.log',true);
}
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加