هل يقوم البحث في شبكة مخصصة بإعادة التوجيه إلى صفحة 404؟

magento.stackexchange https://magento.stackexchange.com//questions/63112

سؤال

لدي شبكة مخصصة تعرض جميع كتل CMS.عندما أستخدم شريط البحث في الشبكة لتصفية عنوان ما، فإنه يعيد توجيهي إلى صفحة 404.هل هناك خطأ ما في شبكتي يتسبب في إعادة التوجيه إلى صفحة غير معروفة؟

أيضًا، لست متأكدًا مما إذا كان الأمر مهمًا ولكن هذا يحدث في Enterprise Edition 1.12.لدي مثيل آخر وهو EE-1.13، وهذه ليست مشكلة.

class TP_CustomApp_Block_Adminhtml_Glcmsblock_Grid extends Mage_Adminhtml_Block_Widget_Grid {

      public function __construct() {
        parent::__construct();
        $this->setId('glcmsblockGrid');
        $this->setDefaultSort('entity_id');
        $this->setDefaultDir('DESC');
        $this->setSaveParametersInSession(true);
        $this->setVarNameFilter('product_filter');
      }

      protected function _prepareCollection() {
        $store =  $this->getRequest()->getParam('store', '');
        Mage::getSingleton('core/session')->unsObjectType();
        Mage::getSingleton('core/session')->setObjectType(‘cms/block’);
        $collection = Mage::getModel('cms/block')->getCollection()->addStoreFilter($store->getId());
        $this->setCollection($collection);
        return parent::_prepareCollection();
      }

      protected function _prepareColumns() {

        $this->addColumn('title', array(
            'header' => Mage::helper('cms')->__('Title'),
            'align' => 'left',
            'index' => 'title',
            'width' => '25%',
        ));

        $this->addColumn('identifier', array(
            'header' => Mage::helper('cms')->__('Identifier'),
            'align' => 'left',
            'index' => 'identifier',
            'width' => '20%',
        ));

        …

        return parent::_prepareColumns();
      }

      public function getGridUrl() {
        return $this->getUrl('*/*', array('_current' => true));
      }

      public function getRowUrl($row) {
        return '"';
      }

      protected function _prepareMassaction() {
        $this->setMassactionIdField('entity_id');
        $this->getMassactionBlock()->setFormFieldName('gl_block_ids[]');
        $this->getMassactionBlock()->addItem('add', array(
            'label' => ‘Do some stuff’,
            'url' => $this->getUrl('*/*/massAdd'),
        ));
        return $this;
      }

}

مراقب:

class TP_CustomApp_Adminhtml_GlcategoryController extends Mage_Adminhtml_Controller_Action {

  public function indexAction() {
    $this->loadLayout();
    $this->_setActiveMenu(‘MyApp/do_something’);
    $this->renderLayout();
  }

  public function gridAction(){
    $this->loadLayout();
    $this->getResponse()->setBody(
        $this->getLayout()->createBlock('MyApp/adminhtml_glcategory_grid')->toHtml()
    );
  }

  public function filterAction() {
    $post = $this->getRequest()->getPost();
    $radio = $post['filter'];
    Mage::getSingleton('core/session')->unsCategoryFilter();
    Mage::getSingleton('core/session')->setCategoryFilter($radio);
    $store = $post['store_id'];
    if ($store != '') {
      $this->_redirect('MyApp/adminhtml_glcategory', array('_query' => array('store' => $store)));
      return $this;
    }
    else {
      $this->_redirect('*/*');
      return $this;
    }
  }

  public function massAddAction() {
    $post = $this->getRequest()->getPost();
    $selected_category_ids = $post['gl_category_ids'];
    if (count($selected_category_ids) > 0) {
      // do some stuff with the ids
      return $this;
    }
    else {
      Mage::getSingleton('adminhtml/session')->addError('Please select a record.');
      $this->_redirect('*/*');
      return $this;
    }
  }

}
هل كانت مفيدة؟

المحلول

اسم الإجراء مفقود في ملفك getGridUrl() طريقة

public function getGridUrl() { 
      return $this->getUrl('*/*/grid', array('_current' => true)); 
} 

يحرر :تغيير الخاص بك gridAction() مثل أدناه

public function gridAction(){
    $this->loadLayout();
    $this->renderLayout();
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top