0

I have been trying to get an Admin module running for updating some prices. But I keep getting a 404 error. I followed this tutorial: https://magento2.atlassian.net/wiki/spaces/m1wiki/pages/14024903/Create+a+custom+module+with+a+custom+database+table

config.xml

<?xml version="1.0"?>
     <config>
<modules>
    <Speedcrete_PriceUpdate>
        <version>1.0.0</version>
    </Speedcrete_PriceUpdate>
</modules>
<admin>
   <routers>
       <!-- Includes our controller, so when we add the adminhtml menu item below, it is found! -->
       <adminhtml>
            <args>
                <modules>
                    <priceupdate before="Mage_Adminhtml">Speedcrete_PriceUpdate_Adminhtml</priceupdate>
                </modules>
            </args>
        </adminhtml>
   </routers>
  </admin>
<adminhtml>
    <menu>
        <priceupdate module="priceupdate">
            <title>PriceUpdate</title>
            <sort_order>71</sort_order>              
            <children>
                <items module="priceupdate">
                    <title>Manage Items</title>
                    <sort_order>0</sort_order>
                    <action>priceupdate/adminhtml_priceupdate</action>
                </items>
            </children>
        </priceupdate>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <priceupdate>
                        <title>PriceUpdate Module</title>
                        <sort_order>200</sort_order>
                    </priceupdate>
                </children>
            </admin>
        </resources>  
    </acl>
    <layout>
        <updates>
            <priceupdate>
                <file>priceupdate.xml</file>
            </priceupdate>
        </updates>
    </layout>
</adminhtml>  
<global>
    <models>
        <priceupdate>
            <class>Speedcrete_PriceUpdate_Model</class>
            <resourceModel>priceupdate_mysql4</resourceModel>
        </priceupdate>
        <priceupdate_mysql4>
            <class>Speedcrete_PriceUpdate_Model_Mysql4</class>
            <entities>
                <priceupdate>
                    <table>priceupdate</table>
                </priceupdate>
            </entities>
        </priceupdate_mysql4>
    </models>
    <resources>
        <priceupdate_setup>
            <setup>
                <module>Speedcrete_PriceUpdate</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </priceupdate_setup>
        <priceupdate_write>
            <connection>
                <use>core_write</use>
            </connection>
        </priceupdate_write>
        <priceupdate_read>
            <connection>
                <use>core_read</use>
            </connection>
        </priceupdate_read>
    </resources>
    <blocks>
        <priceupdate>
            <class>Speedcrete_PriceUpdate_Block</class>
        </priceupdate>
    </blocks>
    <helpers>
        <priceupdate>
            <class>Speedcrete_PriceUpdate_Helper</class>
        </priceupdate>
    </helpers>
</global>

app/code/community/Speedcrete/PriceUpdate/controllers/Adminhtml/PriceUpdateController.php

class Speedcrete_PriceUpdate_Adminhtml_PriceUpdateController extends 
 Mage_Adminhtml_Controller_Action
{
  public function _initAction()
  {
    die('hello world 1');
    $this->loadLayout()
        ->_setActiveMenu('priceupdate/items')
        ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));

    return $this;
}

public function indexAction() {
    die('hello world 2');
    $this->_initAction();      
    $this->_addContent($this->getLayout()->createBlock('priceupdate/adminhtml_priceupdate'));
    $this->renderLayout();
}

/**
 * Product grid for AJAX request.
 * Sort and filter result for example.
 */
public function gridAction()
{
    die('hello world');
    $this->loadLayout();
    $this->getResponse()->setBody(
           $this->getLayout()->createBlock('priceupdate/adminhtml_priceupdate_grid')->toHtml()
    );
}

The rest are edit, save and delete actions.

If anything else needed please ask

  • try logging out of admin and back in again – treyBake Nov 24 '17 at 11:06
  • Tried that, cleared the cache (in fact the cache is disabled). – Scott Lunnon Nov 24 '17 at 11:09
0
<menu>
            <priceupdate module="priceupdate">
                <title>PriceUpdate</title>
                <sort_order>71</sort_order>              
                <children>
                    <items module="priceupdate">
                        <title>Manage Items</title>
                        <sort_order>0</sort_order>
                        <action>priceupdate/adminhtml_priceupdate</action>
                    </items>
                </children>
            </priceupdate>
        </menu>

it should be

<menu>
        <priceupdate module="priceupdate">
            <title>PriceUpdate</title>
            <sort_order>71</sort_order>              
            <children>
                <items module="priceupdate">
                    <title>Manage Items</title>
                    <sort_order>0</sort_order>
                    <action>adminhtml_priceupdate/priceupdate</action>
                </items>
            </children>
        </priceupdate>
    </menu>
  • I'm afraid that hasn't worked, the routing doesn't even get to the controller. – Scott Lunnon Nov 24 '17 at 11:14
  • i did change code please check it – Sunil Patel Nov 24 '17 at 11:20
  • @ScottLunnon Have you checked? – Sunil Patel Nov 24 '17 at 11:40
  • Checked and still does not work! – Scott Lunnon Nov 24 '17 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.