我正在創建一個新的模塊,它將記錄聯繫我們頁面的所有數據。 和所有數據信息將顯示在管理面板中。管理控制器不能在客戶端工作Magento
我在config.xml中下面的代碼
<?xml version="1.0"?>
<config>
<modules>
<Vampi_Contactsform>
<version>1.0.0</version>
</Vampi_Contactsform>
</modules>
<global>
<models>
<vampi_contactsform>
<class>Vampi_Contactsform_Model</class>
<resourceModel>vampi_contactsform_mysql4</resourceModel>
</vampi_contactsform>
</models>
<resources>
<vampi_setup>
<setup>
<module>Vampi_Contactsform</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</vampi_setup>
<vampi_write>
<connection>
<use>core_write</use>
</connection>
</vampi_write>
<vampi_read>
<connection>
<use>core_read</use>
</connection>
</vampi_read>
</resources>
<blocks>
<vampi_contactsform>
<class>Vampi_Contactsform_Block</class>
</vampi_contactsform>
</blocks>
<helpers>
<vampi_contactsform>
<class>Vampi_Contactsform_Helper</class>
</vampi_contactsform>
</helpers>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<vampi_contactsform before="Mage_Adminhtml">Vampi_Contactsform_Adminhtml</vampi_contactsform>
</modules>
</args>
</adminhtml>
</routers>
</admin>
<frontend>
<routers>
<contactsform>
<args>
<modules>
<vampi_contactsform before="Mage_Contactsform">Vampi_Contactsform</vampi_contactsform>
</modules>
</args>
</contactsform>
</routers>
</frontend>
和我的應用程序\代碼\社區\ Vampi \ Contactsform \控制器\ Adminhtml \ contactsformController.php包含
<?php
class Vampi_Contactsform_Adminhtml_ContactsformController extends Mage_Adminhtml_Controller_Action{
public function indexAction()
{
$this->_title($this->__('Sales'))->_title($this->__('Contact Enquiries'));
$this->loadLayout();
$this->_setActiveMenu('report/contactsform');
$this->_addContent($this->getLayout()->createBlock('vampi_contactsform/adminhtml_contactsform_list'));
$this->renderLayout();
}
public function deleteAction() {
$orderIds = $this->getRequest()->getPost('order_ids', array());
$countNonCancelOrder = 0;
foreach ($orderIds as $orderId) {
$db = Mage::getSingleton('core/resource')->getConnection('core_write');
$contact_form = Mage::getSingleton("core/resource")->getTableName('contact_form');
$db->delete($contact_form, "id = $orderId");
$countNonCancelOrder++;
}
if ($countNonCancelOrder) {
$this->_getSession()->addError($this->__('%s enquiry(s) deleted', $countNonCancelOrder));
}
$this->_redirect('*/*/');
}
public function gridAction()
{
$this->loadLayout();
$this->getResponse()->setBody(
$this->getLayout()->createBlock('vampi_contactsform/adminhtml_contactsform_list_grid')->toHtml()
);
}
}
請幫忙
這是給404打開頁面時出錯fr om Magento管理面板。
謝謝
嗨,你能給我們打電話的網址嗎?這可能是網址中的錯誤。另外,您需要通過添加adminhtml.xml文件來爲您的新頁面添加acl(授權)。 –
url是http://localhost/magentotest/index.php/admin/contactsform 它工作正常,但在客戶端它不工作。 –