Поскольку патч SUPEE-5994 в Magento Кажется, что я получаю ошибку 404 при запросе функции внутри контроллера, перед этим патчем эта функция работает нормально. Согласно this post, он должен что-то сделать с config.xml
, но, насколько я знаю, это не относится к блокам adminhtml, которые должны вызываться из контроллера. Я также не могу найти, является ли эта ошибка результатом патча, который необходимо определить маршрутизаторам.Модуль Magento Backend вызывает 404
Я попытался добавить маршрутизатор со всеми контроллерами и блоками, но даже после очистки кэша, выхода из системы и снова, функция по-прежнему является 404.
Это мой код:
приложение/код/сообщества/MyModule/Advanced/Controller/AjaxController.php
class Icepay_IceAdvanced_AjaxController extends Mage_Adminhtml_Controller_Action
{
protected $webservice = null;
public function iceWebservice()
{
if ($this->webservice == null)
$this->webservice = new Icepay_IceAdvanced_Model_Paymentmethods();
return $this->webservice;
}
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
public function get_paymentmethodsAction()
{
$this->getResponse()->setBody(Zend_Json::encode($this->iceWebservice()->retrieveAdminGrid($this->getRequest()->get("store"))));
}
public function save_paymentmethodAction()
{
$adv_sql = Mage::getSingleton('iceadvanced/mysql4_iceAdvanced');
$reference = $this->getRequest()->getPost("reference");
$scopeID = $this->getRequest()->getPost("store");
if (!isset($reference))
return;
$adv_sql->setScope($scopeID);
$settings = Mage::helper("iceadvanced")->getPaymentmethodExtraSettings();
if ($this->getRequest()->getPost("active_issuers")) {
$issuers = explode(",", $this->getRequest()->getPost("active_issuers"));
if (count($issuers) >= 1)
array_push($settings, "active_issuers"); //At least 1 issuer active is required
}
foreach ($settings as $setting) {
$adv_sql->saveConfigValue($reference, $setting, $this->getRequest()->getPost($setting));
}
$this->getResponse()->setBody(sprintf($this->__("%s settings have been saved."), $this->getRequest()->getPost("name")));
}
}
приложение/код/сообщества/MyModule/Advanced/Block/Adminhtml/Сетка/Paymentmethods.php
class Icepay_IceAdvanced_Block_Adminhtml_Grid_PaymentMethods extends Mage_Adminhtml_Block_Widget implements Varien_Data_Form_Element_Renderer_Interface
{
protected $_element;
protected $_scope;
protected $_ajaxLoadPaymentMethodURL;
protected $_ajaxSavePaymentMethodURL;
protected $_ajaxGetPaymentMethodsURL;
protected $debug;
public function __construct()
{
$this->_scope = Mage::app()->getStore(Mage::helper("icecore")->getStoreFromRequest())->getId();
$this->_ajaxLoadPaymentMethodURL = Mage::helper('adminhtml')->getUrl('icepayadvanced/config/index/paymentmethod/{{pm_code}}', array('_secure' => true, 'scope' => $this->_scope));
$this->_ajaxSavePaymentMethodURL = Mage::helper('adminhtml')->getUrl('icepayadvanced/ajax/save_paymentmethod', array('_secure' => true, 'scope' => $this->_scope));
$this->_ajaxGetPaymentMethodsURL = Mage::helper('adminhtml')->getUrl('icepayadvanced/ajax/get_paymentmethods', array('_secure' => true));
$this->setTemplate('icepayadvanced/grid_paymentmethods.phtml');
}
public function render(Varien_Data_Form_Element_Abstract $element)
{
$this->setElement($element);
return $this->toHtml();
}
public function setElement(Varien_Data_Form_Element_Abstract $element)
{
$this->_element = $element;
return $this;
}
public function getElement()
{
return $this->_element;
}
public function getJS($uri)
{
return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS, true) . $uri;
}
public function getPaymentmethods()
{
return Mage::getSingleton('iceadvanced/mysql4_iceAdvanced')->getAdminPaymentmethodConfigForStore($this->_scope);
}
public function getAddButtonHtml()
{
return $this->getChildHtml('add_button');
}
protected function _prepareLayout()
{
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
->setData(array(
'label' => Mage::helper('icecore')->__('Get paymentmethods'),
'onclick' => 'return ICEPAY.retrieveFromICEPAY()',
'class' => 'add'
));
$button->setName('add_tier_price_item_button');
$this->setChild('add_button', $button);
if (version_compare(Mage::getVersion(), '1.7.0.0', '<')) {
$this->getLayout()->getBlock('head')->addItem('js_css', 'prototype/windows/themes/magento.css');
} else {
$this->getLayout()->getBlock('head')->addItem('skin_css', 'lib/prototype/windows/themes/magento.css');
}
$this->getLayout()
->getBlock('head')
->addItem('js_css', 'prototype/windows/themes/default.css');
return parent::_prepareLayout();
}
}
Здесь я загрузил config.xml и любой other file для обзора.
Редактировать: Последующий BJ Hoffpauir руководство; это выход error.log
192.168.137.1 - - [17/Июль/2015: 23: 03: 56 +0000] «POST /index.php/icepayadvanced/ajax/get_paymentmethods/key/ ? 21e4f55bb33ad6a323c50140bc5ef585/isAjax = истина HTTP/1.1" 404 16910 "http://192.168.137.124/index.php/admin/system_config/edit/section/icecore/key/e96d9f50648cad8168ebf376470196ad/" "Mozilla/5.0 (Windows NT 6.3; Win64; 64) AppleWebKit/537,36 (KHTML, как Gecko) Chrome/43.0.2357.134 Сафари/537,36"
Спасибо за ваш ответ. Я попробовал '_isAllowed()' в AjaxController, но у меня все еще есть 404. В файле config.xml нет параметров меню. Нужно ли мне что-то менять? –
Я быстро просмотрел репозиторий github, вы даже не определили маршрут в 'admin', как раз в' frontend', как это могло бы работать?Если ваши контроллеры - все контроллеры администратора, переместите определение '' из' 'в' ' –
Не все, AjaxController используется в бэкэнд. Результат после нажатия кнопки, которая вызывает 'isAjax', эта ошибка возвращает:' POST https://127.0.0.1/index.php/icepayadvanced/ajax/g...ey/ecef8a8e468421e9c2a9e82aaed176cb/?isAjax=true 404 не найден 1.37s ' –