我正在使用magento API,并需要为不同的商家视图创建下拉选项。Magento API:为商店视图设置下拉属性选项
我发现一个函数来创建默认storeview下拉选项:
public function addAttributeOption($arg_attribute, $arg_value)
{
$attribute_model = Mage::getModel('eav/entity_attribute');
$attribute_options_model= Mage::getModel('eav/entity_attribute_source_table');
$attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute);
$attribute = $attribute_model->load($attribute_code);
$attribute_table = $attribute_options_model->setAttribute($attribute);
$options = $attribute_options_model->getAllOptions(false);
$value['option'] = array($arg_value,$arg_value);
$result = array('value' => $value);
$attribute->setData('option',$result);
$attribute->save();
}
此功能工作正常,我可以添加默认storeview新attribut值。
例子:
我有属性“mycolor”,并呼吁像
addAttributeOption("mycolor", "black")
功能现在我有一个德国的店storeview,喜欢设置德语色彩。我需要这样的东西
addAttributeOption(“mycolor”,“黑”,“施瓦茨”,$ storeview)
来设定storeview对施瓦茨的颜色选项,其中默认值的颜色为黑色。
有没有人有一个想法我该怎么做?
问候
好了,当没有办法,我将通过MySQL查询解决。 – dermold