我想在订购时发送制造商的电子邮件。为此,我想在制造商产品属性中添加制造商的电子邮件地址?怎么做到这一点?
答案 0 :(得分:0)
我会假设您在询问如何在代码中执行此操作?无论如何,只需构建一个带有安装脚本的小模块(遍布Web的教程),并使安装脚本看起来像这样:
$installer = $this;
$installer->startSetup();
// check if the attribute exists
if (Mage::getModel('catalog/resource_eav_attribute')->loadByCode('catalog_product','calculated_sold')->getId() !== NULL) {
$installer->removeAttribute('catalog_product', 'calculated_sold');
}
// not anymore, that's for sure!
// Note! For product attributes the XML set class needs to be "Mage_Catalog_Model_Resource_Setup"
// instead of "Mage_Customer_Model_Entity_Setup" as you would usually go with.
$installer->addAttribute('catalog_product','calculated_sold', array (
'type' => 'decimal',
'label' => 'Calculated sold',
'input' => 'price', // for filtering to work only certain input types allowed
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'searchable' => true,
'filterable' => true,
'visible' => false,
'required' => false,
'visible_in_advanced_search' => true,
'used_in_product_listing' => true,
'used_for_sort_by' => true,
'apply_to' => 'configurable', // yeah!
));
$installer->endSetup();
此示例添加了一个属性来跟踪已售出的商品数量,但它会让您了解如何根据自己的需要进行更改。