多选产品的属性
Multiselect prodct's attribute
我使用 管理属性 部分在 magento 的管理员中创建了一个新的多 select 类型属性,并将后端源模型用于标签和值。
现在,当我使用导出所有数据配置文件从管理员导出产品 csv 时,我的多 select 属性显示为空白。我想在 csv 中显示 selected 值。
我的源模型代码:
<?php
class CityVal_City_Model_Product_Attribute_Unit extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
public function getAllOptions()
{
$connection = Mage::getModel('core/resource')->getConnection('core_read');
$sql = 'SELECT city_id,city_name FROM cities';
$orders = $connection->fetchAll($sql);
foreach($orders as $ord)
{
$customerArr[] = array(
'value' => $ord['city_id'],
'label' => $ord['city_name'],
);
}
if (!$this->_options) {
$this->_options = $customerArr;
}
return $this->_options;
}
}
?>
在 foreach 之后,我们在管理中的多个 select 城市下拉列表中有值。我对 post 图片不满意 否则,我 post 一张图片
如果您想导出多个 select 属性,请转到系统 -> import/export -> 数据流 - 配置文件并通过 select 您的商店导出产品。
您会在 csv 文件中找到具有产品 select 值的 multiselect 属性。
我使用 管理属性 部分在 magento 的管理员中创建了一个新的多 select 类型属性,并将后端源模型用于标签和值。
现在,当我使用导出所有数据配置文件从管理员导出产品 csv 时,我的多 select 属性显示为空白。我想在 csv 中显示 selected 值。
我的源模型代码:
<?php
class CityVal_City_Model_Product_Attribute_Unit extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
public function getAllOptions()
{
$connection = Mage::getModel('core/resource')->getConnection('core_read');
$sql = 'SELECT city_id,city_name FROM cities';
$orders = $connection->fetchAll($sql);
foreach($orders as $ord)
{
$customerArr[] = array(
'value' => $ord['city_id'],
'label' => $ord['city_name'],
);
}
if (!$this->_options) {
$this->_options = $customerArr;
}
return $this->_options;
}
}
?>
在 foreach 之后,我们在管理中的多个 select 城市下拉列表中有值。我对 post 图片不满意 否则,我 post 一张图片
如果您想导出多个 select 属性,请转到系统 -> import/export -> 数据流 - 配置文件并通过 select 您的商店导出产品。 您会在 csv 文件中找到具有产品 select 值的 multiselect 属性。