我创建了一个新模块,我将在下面解释。 我可以看到管理员的新选项。 我点击了角色,管理员并保存了。 我退出并登录
但是当我想要更改配置时,我仍然看到404找不到。 http://screencast.com/t/IbLJeVjpxMm
的Config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Luisvalencia_Affiliate>
<version>0.0.1</version>
</Luisvalencia_Affiliate>
</modules>
<global>
<models>
<luisvalencia_affiliate>
<class>Luisvalencia_Affiliate_Model</class>
</luisvalencia_affiliate>
</models>
<helpers>
<affiliate>
<class>Luisvalencia_Affiliate_Helper</class>
</affiliate>
</helpers>
</global>
<frontend>
<events>
<controller_action_predispatch>
<observers>
<luisvalencia_affiliate>
<class>luisvalencia_affiliate/observer</class>
<method>captureReferral</method>
<type>singleton</type>
</luisvalencia_affiliate>
</observers>
</controller_action_predispatch>
</events>
</frontend>
</config>
adminhtml.xml
<?xml version="1.0"?>
<config>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<luisvalenciasection translate="title" module="affiliate">
<title>Luisvalencia Section</title>
<sort_order>0</sort_order>
</luisvalenciasection>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
的system.xml
<?xml version="1.0" ?>
<config>
<tabs>
<luisvalenciatab translate="label" module="affiliate">
<label>Luisvalencia Cookie</label>
<sort_order>0</sort_order>
</luisvalenciatab>
</tabs>
<sections>
<luisvalenciasection translate="label" module="affiliate">
<label>Luisvalencia</label>
<tab>luisvalenciatab</tab>
<frontend_type>text</frontend_type>
<sort_order>0</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<luisvalenciagroup translate="label">
<label>Luisvalencia Group</label>
<frontend_type>text</frontend_type>
<sort_order>0</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<cookie_time translate="label">
<label>Set Cookie Time</label>
<frontend_type>text</frontend_type>
<sort_order>0</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</cookie_time>
</fields>
</luisvalenciagroup>
</groups>
</luisvalenciasection>
</sections>
</config>
Data.php
<?php
class Luisvalencia_Affiliate_Helper_Data extends Mage_Core_Helper_Abstract {
}
Observer.php
<?php
class Luisvalencia_Affiliate_Model_Observer
{
const COOKIE_KEY_SOURCE = 'luisvalencia_affiliate_source';
public function captureReferral(Varien_Event_Observer $observer)
{
$cookietime = Mage::getStoreConfig('luisvalenciasection/luisvalenciagroup/cookie_time');
if(Mage::getModel('core/cookie')->get('ref') != 'cj'){
if( isset($_GET["ref"]) ){
$ref=$_GET["ref"];
}
else{
$ref='';
}
$name_c = 'ref';
$val_c = $ref;
$expired = 31556926; /* 1 year */
$path = '/';
$cookie = Mage::getSingleton('core/cookie');
$cookie->set($name_c, $val_c ,(int)$cookietime,$path);
}
}
}
Luisvalencia_Affiliate.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Luisvalencia_Affiliate>
<active>true</active>
<codePool>community</codePool>
</Luisvalencia_Affiliate>
</modules>
</config>
答案 0 :(得分:0)
l.v
在config.xml中添加此代码
<resources>
<affiliate_setup>
<setup>
<module>Luisvalencia_Affiliate</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</affiliate_setup>
<affiliate_read>
<connection>
<use>core_read</use>
</connection>
</affiliate_read>
<affiliate_write>
<connection>
<use>core_write</use>
</connection>
</affiliate_write>
</resources>
在</helpers>
结束后
然后
create a installer:Luisvalencia/Affiliatesql/affiliate_setup/install-0.0.1.php
代码:
<?php
$session = Mage::getSingleton('admin/session');
$session->setReloadAclFlag(true);
$session->refreshAcl();
答案 1 :(得分:0)
显然不需要上面的答案,我在adminhtml.xml上缺少一个acl部分
<acl>
<children>
<luisvalenciasection translate="title" module="affiliate">
<title>Luisvalencia Section</title>
</luisvalenciasection>
</children>
</acl>