Модуль Magento 1.9.2.1 без имени пакета показывает 404 после SUPEE-6788


Я использую Magento 1.9.2.1, и после установки SUPEE-6788 я исправил все затронутые модули, как описано здесь.

Все мои модули (у которых есть каталог пакетов, например: "приложение/код/локальный/{module_package}/{имя_модуля}"), которые не работали после установки этого исправления, теперь работают нормально.

У меня есть модуль, который отлично работает без SUPEE-6788, и у него нет папки пакетов.

Ниже приведены подробности из единственного модуля, который не работает в admin и предоставляет страницу 404:

Путь к модулю: app/code/{code_pool}/Rewardpoints (где Точки вознаграждения - имя модуля)

Часть кода из Config.xml :

<modules>
    <Rewardpoints>
        <version>0.6.1</version>
        <depends>
            <Mage_Customer />
            <Mage_Checkout />
        </depends>
    </Rewardpoints>
</modules>
<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <rewardpoints before="Mage_Adminhtml">Rewardpoints_Adminhtml</rewardpoints>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>
<adminhtml>
    <layout>
        <updates>
            <rewardpoints>
                <file>rewardpoints.xml</file>
            </rewardpoints>
        </updates>
    </layout>
    <menu>
        <rewardpoints translate="title" module="rewardpoints">
            <title>Reward Points</title>
            <sort_order>50</sort_order>
            <children>
                <stats translate="title" module="rewardpoints">
                    <title>Statistics</title>
                    <sort_order>2</sort_order>
                    <action>adminhtml/rewardpoints_stats</action>
                </stats>
                <clientpoints translate="title" module="rewardpoints">
                    <title>Client points</title>
                    <sort_order>3</sort_order>
                    <action>adminhtml/rewardpoints_clientpoints</action>
                </clientpoints>
                <config translate="title" module="rewardpoints">
                    <title>Configuration</title>
                    <sort_order>8</sort_order>
                    <action>adminhtml/system_config/edit/section/rewardpoints</action>
                </config>
            </children>
        </rewardpoints>
    </menu>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <rewardpoints module="rewardpoints">
                        <title>Reward Points</title>
                        <sort_order>50</sort_order>
                        <children>
                            <stats translate="title" module="rewardpoints">
                                <title>Statistics</title>
                                <sort_order>2</sort_order>
                            </stats>
                            <clientpoints translate="title" module="rewardpoints">
                                <title>Client points</title>
                                <sort_order>3</sort_order>
                            </clientpoints>
                            <config translate="title" module="rewardpoints">
                                <title>Configuration</title>
                                <sort_order>4</sort_order>
                            </config>
                        </children>
                    </rewardpoints>
                </children>
            </admin>
        </resources>
    </acl>
    <acl>
        <resources>
            <admin>
                <children>
                    <catalog>
                        <children>
                            <rewardpoints_adminform>
                                <title>Configuration</title>
                            </rewardpoints_adminform>
                        </children>
                    </catalog>
                </children>
            </admin>
        </resources>
    </acl>
    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <rewardpoints>
                                        <title>Reward Points</title>
                                    </rewardpoints>
                                </children>
                            </config>
                        </children>
                    </system>
                    <customer>
                        <children>
                            <rewardpoints translate="title">
                                <title>Reward Points</title>
                                <sort_order>41</sort_order>
                            </rewardpoints>
                        </children>
                    </customer>
                </children>
            </admin>
        </resources>
    </acl>
</adminhtml>

Путь к контроллерам:

app/code/{code_pool}/Rewardpoints/controllers/Adminhtml/Rewardpoints/StatsController.php

app/code/{code_pool}/Rewardpoints/controllers/Adminhtml/Rewardpoints/ClientpointsController.php

Класс для StatsController.php :

class Rewardpoints_Adminhtml_Rewardpoints_StatsController extends Mage_Adminhtml_Controller_action

Класс для ClientpointsController.php :

class Rewardpoints_Adminhtml_Rewardpoints_ClientpointsController extends Mage_Adminhtml_Controller_action

Функция индексации в StatsController.php :

public function indexAction() {
            $this->_initAction()
                ->_addContent($this->getLayout()->createBlock('rewardpoints/adminhtml_stats'))
                ->renderLayout();
    }

Функция индексации в ClientpointsController.php :

public function indexAction() {
            $this->_initAction()
                ->_addContent($this->getLayout()->createBlock('rewardpoints/adminhtml_clientpoints'))
                ->renderLayout();
    }

Содержание в app/etc/modules/RewardPoints.xml :

<?xml version="1.0"?>
<config>
    <modules>
        <Rewardpoints>
            <active>true</active>
            <codePool>{{code_pool}}</codePool>
        </Rewardpoints>
    </modules>
</config>

Примечание 1: Даже функция die(); не работает в приведенных выше методах индексации.

Примечание 2: Модуль отлично работает в admin без исправления SUPEE-6788.

Для adminhtml нет XML-файла макета

Есть ли что-нибудь, чего мне здесь не хватает?

Author: Wasiq Shahrukh, 2018-05-16

3 answers

Вам нужен только этот Acl:

<acl>
    <resources>
        <all>
            <title>Allow Everything</title>
        </all>
        <admin>
            <children>
                <system>
                    <children>
                        <config>
                            <children>
                                <rewardpoints>
                                    <title>Reward Points</title>
                                </rewardpoints>
                            </children>
                        </config>
                    </children>
                </system>
                <rewardpoints module="rewardpoints">
                    <title>Reward Points</title>
                    <sort_order>50</sort_order>
                    <children>
                        <stats translate="title" module="rewardpoints">
                            <title>Statistics</title>
                            <sort_order>2</sort_order>
                        </stats>
                        <clientpoints translate="title" module="rewardpoints">
                            <title>Client points</title>
                            <sort_order>3</sort_order>
                        </clientpoints>
                        <config translate="title" module="rewardpoints">
                            <title>Configuration</title>
                            <sort_order>4</sort_order>
                        </config>
                    </children>
                </rewardpoints>
                <customer>
                    <children>
                        <rewardpoints translate="title">
                            <title>Reward Points</title>
                            <sort_order>41</sort_order>
                        </rewardpoints>
                    </children>
                </customer>
            </children>
        </admin>
    </resources>
</acl>

Удалите другие и очистите кэш, затем повторите попытку.

Для уточнения: Это для ваших полей настройки конфигурации:

<system>
   <children>
      <config>
         <children>
            <rewardpoints>
               <title>Reward Points</title>
            </rewardpoints>
         </children>
      </config>
   </children>
</system>

И это если вы добавили действие к действию клиента:

<customer>
   <children>
      <rewardpoints translate="title">
         <title>Reward Points</title>
         <sort_order>41</sort_order>
      </rewardpoints>
   </children>
</customer>
 2
Author: kunj, 2018-05-16 08:17:36

Добавить ACL внутри <adminhtml>:

<acl>
    <resources>
        <all>
            <title>Allow Everything</title>
        </all>
        <admin>
            <children>
                <rewardpoints>
                    <title>Rewardpoints Module</title>
                    <sort_order>10</sort_order>                     
                </rewardpoints>
            </children>
        </admin>
    </resources>
</acl>

Проверьте также эти пункты:

В папке контроллеры у вас есть папка Adminhtml имена контроллеров названы правильно, и метод действия успешно вызван

Папка макета администратора содержит правильный обработчик действий /app/design/adminhtml/default/default/layout/your_module.xml, который вызывает правильное имя блока.

Узел ACL правильно определен в adminhtml.xml или config.xml _isAllowed() метод не переопределяется, и если это так, попробуйте проверить $resource параметр isAllowed() метод

Очистите кэш и проверьте.

 2
Author: Nikunj Vadariya, 2018-05-16 07:00:52

Я думаю, что что-то не так в вашем модуле, где находится "пакет модулей"?

Я имею в виду, что ваш модуль должен выглядеть так:

app/code/{code_pool}/{Module Package}/Rewardpoints/Adminhtml/Rewardpoints/StatsController.php

app/code/{code_pool}/{Module Package}/Rewardpoints/Adminhtml/Rewardpoints/ClientpointsController.php

Путь к файлу вашего контроллера администратора должен быть таким:

app/code/local/{{Module Package}}/Rewardpoints/controllers/Adminhtml

Класс также должен быть таким:

class {{Module Package}}_Rewardpoints_Adminhtml_Rewardpoints_StatsController extends Mage_Adminhtml_Controller_action


class {{Module Package}}_Rewardpoints_Adminhtml_Rewardpoints_ClientpointsController extends Mage_Adminhtml_Controller_action
 1
Author: kunj, 2018-05-16 10:04:33