Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento 未在adminhtml编辑部分中选择存储视图_Magento - Fatal编程技术网

Magento 未在adminhtml编辑部分中选择存储视图

Magento 未在adminhtml编辑部分中选择存储视图,magento,Magento,谁能帮帮我吗。这可能真的很简单,好像我错过了什么 我试图在这里开发一个非常简单的模块 在编辑部分,它没有选择区域 门店id 1位于澳大利亚 代码: 以下步骤可能对您有所帮助 在Grid.php中 protected function _prepareCollection(){ $collection Mage::getModel("faq/faq")->getCollection(); foreach($collection as $link){

谁能帮帮我吗。这可能真的很简单,好像我错过了什么

我试图在这里开发一个非常简单的模块

在编辑部分,它没有选择区域

门店id 1位于澳大利亚

代码:


以下步骤可能对您有所帮助

在Grid.php中

 protected function _prepareCollection(){

      $collection Mage::getModel("faq/faq")->getCollection();

      foreach($collection as $link){

           if($link->getStoreId() && $link->getStoreId() != 0 ){

                $link->setStoreId(explode(',',$link->getStoreId()));

           }                
           else{                    
                $link->setStoreId(array('0'));                  
           }

       }

      $this->setCollection($collection);

      return parent::_prepareCollection();

 }
 $fieldset->addField('store_id', 'multiselect', array(
      'name'      => 'store_id[]',
      'label'     => 'Store View',
      'title'     => '',
      'required'  => true,
      'values'    => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
 ));
添加列

 $this->addColumn("store_id", array(
      "header"        => Mage::helper("faq")->__("Store View"),         
      "index"        => "store_id",
      "type"          => "store",
      "store_all"     => true,
      "store_view"    => true,
      "sortable"      => true,
      "filter_condition_callback" => array($this,  
      "_filterStoreCondition"),
 ));
在form.php中

 protected function _prepareCollection(){

      $collection Mage::getModel("faq/faq")->getCollection();

      foreach($collection as $link){

           if($link->getStoreId() && $link->getStoreId() != 0 ){

                $link->setStoreId(explode(',',$link->getStoreId()));

           }                
           else{                    
                $link->setStoreId(array('0'));                  
           }

       }

      $this->setCollection($collection);

      return parent::_prepareCollection();

 }
 $fieldset->addField('store_id', 'multiselect', array(
      'name'      => 'store_id[]',
      'label'     => 'Store View',
      'title'     => '',
      'required'  => true,
      'values'    => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
 ));

您好检查以下步骤可能会对您有所帮助

在Grid.php中

 protected function _prepareCollection(){

      $collection Mage::getModel("faq/faq")->getCollection();

      foreach($collection as $link){

           if($link->getStoreId() && $link->getStoreId() != 0 ){

                $link->setStoreId(explode(',',$link->getStoreId()));

           }                
           else{                    
                $link->setStoreId(array('0'));                  
           }

       }

      $this->setCollection($collection);

      return parent::_prepareCollection();

 }
 $fieldset->addField('store_id', 'multiselect', array(
      'name'      => 'store_id[]',
      'label'     => 'Store View',
      'title'     => '',
      'required'  => true,
      'values'    => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
 ));
添加列

 $this->addColumn("store_id", array(
      "header"        => Mage::helper("faq")->__("Store View"),         
      "index"        => "store_id",
      "type"          => "store",
      "store_all"     => true,
      "store_view"    => true,
      "sortable"      => true,
      "filter_condition_callback" => array($this,  
      "_filterStoreCondition"),
 ));
在form.php中

 protected function _prepareCollection(){

      $collection Mage::getModel("faq/faq")->getCollection();

      foreach($collection as $link){

           if($link->getStoreId() && $link->getStoreId() != 0 ){

                $link->setStoreId(explode(',',$link->getStoreId()));

           }                
           else{                    
                $link->setStoreId(array('0'));                  
           }

       }

      $this->setCollection($collection);

      return parent::_prepareCollection();

 }
 $fieldset->addField('store_id', 'multiselect', array(
      'name'      => 'store_id[]',
      'label'     => 'Store View',
      'title'     => '',
      'required'  => true,
      'values'    => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
 ));
尝试更新form.php

  if (!Mage::app()->isSingleStoreMode()) {
       $fieldset->addField('store_ids', 'multiselect', array(
             'label'     => Mage::helper('ubt_faq')->__('Visible In'),
             'required'  => true,
             'name'      => 'store_ids',
             'values'    => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
       ));          
   }
尝试更新form.php

  if (!Mage::app()->isSingleStoreMode()) {
       $fieldset->addField('store_ids', 'multiselect', array(
             'label'     => Mage::helper('ubt_faq')->__('Visible In'),
             'required'  => true,
             'name'      => 'store_ids',
             'values'    => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
       ));          
   }

您需要在您模块的数据库中添加表存储id,然后在模块数据控制器中添加保存操作。

您需要在您模块的数据库中添加表存储id,然后在模块数据控制器中添加保存操作。

此部分有哪些网格和添加列?此部分有哪些网格和添加列?您可以吗能给我提供更多的信息吗?您是否将其保存到数据库中?是的,但即使在我的代码中,我硬编码了'value'=>'4',它也不起作用selected=“selected”您能为我提供更多的信息吗?您是否将其保存到数据库中?是的,但即使在我的代码中硬编码'value'=>'4',它也不会执行selected=“selected”