我有点卡在我的发展中。我试图向管理员添加新的批量操作订单,但我总是返回404.我尝试了多种方法但从未成功过。希望你们中的一些人可以告诉我我做错了什么以及如何解决它。
我的config.xml
<modules>
<plusshop_shipmentcontrol>
<version>0.1.0</version>
</plusshop_shipmentcontrol>
</modules>
<global>
<models>
<shipmentcontrol>
<class>Plusshop_ShipmentControl_Model</class>
</shipmentcontrol>
</models>
</global>
<admin>
<routers>
<shipmentcontrol>
<use>admin</use>
<args>
<module>Plusshop_ShipmentControl</module>
<frontName>shipmentcontrol</frontName>
</args>
</shipmentcontrol>
</routers>
</admin>
<adminhtml>
<events>
<!-- Before rendering event -->
<core_block_abstract_prepare_layout_before>
<observers>
<plusshop_shipmentcontrol_add>
<type>singleton</type>
<class>shipmentcontrol/observer</class>
<method>addMassExport</method>
</plusshop_shipmentcontrol_add>
</observers>
</core_block_abstract_prepare_layout_before>
</events>
</adminhtml>
我的模型/ Observer.php:
<?php
class Plusshop_ShipmentControl_Model_Observer
{
public function addMassExport(Varien_Event_Observer $observer)
{
$block = $observer->getEvent()->getBlock();
if($block instanceof Mage_Adminhtml_Block_Widget_Grid_Massaction && $block->getRequest()->getControllerName() == 'sales_order')
{
$block->addItem('shipmentcontrolall', array(
'label' => 'Create all shipments (GLS, DAO)',
'url' => Mage::app()->getStore()->getUrl('*/shipmentcontrol/massactions/index')
));
}
}
}
最后是我的MassActionsController.php
<?php
require_once 'Mage/Adminhtml/controllers/Action.php';
class Plusshop_ShipmentControl_MassActionsController extends Mage_Adminhtml_Controller_Action {
public function indexAction() {
// $orderIds = $this->getRequest()->getPost('order_ids', array());
$this->_redirect('adminhtml/sales_order/');
}
}
真的希望你们有些人可以告诉我这里做错了什么?感觉就像我尝试了一切,但没有运气。我误解了什么或出了什么问题吗?
此致 凯文。
答案 0 :(得分:1)
替换:
<admin>
<routers>
<shipmentcontrol>
<use>admin</use>
<args>
<module>Plusshop_ShipmentControl</module>
<frontName>shipmentcontrol</frontName>
</args>
</shipmentcontrol>
</routers>
</admin>
使用:
<admin>
<routers>
<adminhtml>
<args>
<modules>
<Plusshop_ShipmentControl after="Mage_Adminhtml">Plusshop_ShipmentControl</Plusshop_ShipmentControl>
</modules>
</args>
</adminhtml>
</routers>
</admin>
您应该可以访问您的页面:yoururl.com/admin/massactions/index
(如果您使用不同的管理员路径,请替换/ admin部分。)