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