当我将代码移动到服务器时,我遇到了这个问题。它在我的本地系统中工作正常。
当我搜索问题时,我发现我必须在配置文件中使用大写字母。
我已将配置文件更新为大写但仍存在问题。
请建议。
的Config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mdl_Ajaxcheckout>
<version>0.1.0</version>
<depends>
<Mage_Customer />
<Mage_Checkout />
</depends>
</Mdl_Ajaxcheckout>
</modules>
<global>
<models>
<mdlajaxcheckout>
<class>Mdl_Ajaxcheckout_Model</class>
</mdlajaxcheckout>
</models>
<events>
<checkout_cart_product_add_after>
<observers>
<mdl_ajaxcheckout_model_observer>
<class>Mdl_Ajaxcheckout_Model_Observer</class>
<method>modifyPrice</method>
</mdl_ajaxcheckout_model_observer>
</observers>
</checkout_cart_product_add_after>
</events>
<blocks>
<mdlajaxcheckout>
<class>Mdl_Ajaxcheckout_Block</class>
</mdlajaxcheckout>
</blocks>
<helpers>
<mdlajaxcheckout>
<class>Mdl_Ajaxcheckout_Helper</class>
</mdlajaxcheckout>
</helpers>
</global>
<frontend>
<layout>
<updates>
<mdlajaxcheckout>
<file>mdlajaxcheckout.xml</file>
</mdlajaxcheckout>
</updates>
</layout>
<translate>
<modules>
<Mdl_Ajaxcheckout>
<files>
<default>mdl_ajaxcheckout.csv</default>
</files>
</Mdl_Ajaxcheckout>
</modules>
</translate>
</frontend>
<frontend>
<routers>
<mdlajaxcheckout>
<use>standard</use>
<args>
<module>Mdl_Ajaxcheckout</module>
<frontName>mdlajaxcheckout</frontName>
</args>
</mdlajaxcheckout>
</routers>
</frontend>
<adminhtml>
<acl>
<resources>
<admin>
<children>
<catalog>
<children>
<mdlajaxcheckout_adminform>
<title>Configuration</title>
</mdlajaxcheckout_adminform>
</children>
</catalog>
</children>
</admin>
</resources>
</acl>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<mdlajaxcheckout>
<title>Mdl Ajax Cart</title>
</mdlajaxcheckout>
</children>
</config>
</children>
</system>
<customer>
<children>
<mdlajaxcheckout translate="title">
<title>Mdl Ajax Cart</title>
<sort_order>45</sort_order>
</mdlajaxcheckout>
</children>
</customer>
</children>
</admin>
</resources>
</acl>
</adminhtml>
<default>
<mdlajaxcheckout>
<default>
<mdl_ajax_cart_loading_size>260x50</mdl_ajax_cart_loading_size>
<mdl_ajax_cart_confirm_size>320x134</mdl_ajax_cart_confirm_size>
<mdl_ajax_cart_image_size>55x55</mdl_ajax_cart_image_size>
<mdl_ajax_cart_show_popup>1</mdl_ajax_cart_show_popup>
</default>
</mdlajaxcheckout>
</default>
<global>
</global>
</config>
Observer.php
<?php
class Mdl_Ajaxcheckout_Model_Observer
{
public function modifyPrice(Varien_Event_Observer $obs)
{
// Get the quote item
$item = $obs->getQuoteItem();
// Ensure we have the parent item, if it has one
$item = ( $item->getParentItem() ? $item->getParentItem() : $item );
//$demo=new Mdl_Ajaxcheckout_IndexController();
// Load the custom price
$price ="20";
// Set the custom price
$item->setCustomPrice($price);
$item->setOriginalCustomPrice($price);
// Enable super mode on the product.
$item->getProduct()->setIsSuperMode(true);
Mage::getSingleton('core/session')->setWelcomeMessage();
}
}
?>
启用模块的代码。
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Mdl_Ajaxcheckout>
<!-- Whether our module is active: true or false -->
<active>true</active>
<!-- Which code pool to use: core, community or local -->
<codePool>community</codePool>
</Mdl_Ajaxcheckout>
</modules>
</config>
答案 0 :(得分:3)
最后我得到了上面线程的解决方案。
我们需要在admin。
中禁用编译器状态system-&gt; tools-&gt; compilation-&gt; click disable。
现在你的观察员活动将会奏效。