Magento add product attribute and assign to all group
$attributes = array(
'product_type' => array(
'type' => 'int',
'input' => 'select',
'source_model' => 'mcatalog/source_eav_attribute_product_type',
'frontend_label' => '产品类型',
'is_global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'frontend_input' => 'select',
'backend_type' => 'int',
'used_in_product_listing' => false,
'is_visible_on_front' => false,
'is_required' => true,
'user_defined' => true,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'position' => 15,
'is_unique' => false,
)
); $productEntityId = $installer->getEntityTypeId(Mage_Catalog_Model_Product::ENTITY);
$productAttributeSets = Mage::getModel('eav/entity_attribute_set')->getCollection()
->addFieldToFilter('entity_type_id', $productEntityId); foreach($attributes as $attributeCode=>$attribute)
{
try{ $attributeModel = Mage::getModel('catalog/resource_eav_attribute');
$attributeModel->addData($attribute);
$attributeModel->setAttributeCode($attributeCode);
$attributeModel->setEntityTypeId($productEntityId);
$re = $attributeModel->save(); foreach ($productAttributeSets as $attributeSet){ $generalAttributeGroupId = $installer->getAttributeGroupId($productEntityId,$attributeSet->getId(),'General');
Mage::getModel('eav/entity_attribute')
->setAttributeSetId($attributeSet->getId())
->setAttributeGroupId($generalAttributeGroupId)
->setEntityTypeId($productEntityId)
->setAttributeId($re->getId())
->save();
} }catch (Exception $e){ Mage::logException($e);
} }
Magento add product attribute and assign to all group的更多相关文章
- [转]Magento Configurable Product
本文转自:https://docs.magento.com/m1/ce/user_guide/catalog/product-configurable.html A configurable prod ...
- 向json中添加新的熟悉或对象 Add new attribute (element) to JSON object using JavaScript
How do I add new attribute (element) to JSON object using JavaScript? JSON stands for JavaScript Obj ...
- enovia PLM: add characteristic to both prototype and product
Issue: add new mandatory attribute named LUX_HazardousMaterial to protoype and product, and export t ...
- Magento WebServices SOAP API 创建和使用
首先 SOAP 简介: http://baike.baidu.com/view/1695890.htm?fromtitle=SOAP 然后简单介绍下Magento API.Magento API干啥用 ...
- Magento创建configurable产品的要点
接着上一篇用API创建可配置的产品Configurable Product说事.Magento的产品类型可分为Simple Product.Group Product.Configurable Pro ...
- Magento网站如何添加一个可配置产品
有的产品,比如服装,同一件衣服有S.M.L.XL.XXL等尺码供客户选择,或者有多种颜色可以供客户选择,Magento中管这种有选项供客户选择的产品叫做可配置产品 (Configurable Prod ...
- magento搜索属性值的设置方法
前台特性(Frontend Properties)在快速搜索中应用(Use in quick search) - 开启此选项,在客户使用Header中的 搜索功能时Magento将搜索所有产品这个At ...
- 将Magento后台汉化的方法
方法一: 打开/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Main.php文件, 找到几个用来显示的代码,替换成 ...
- add characteristic to color
Problem: add a new Char. name D_COI6 that the description is Injected coloration #7 (COI6) in the D_ ...
随机推荐
- java并发包提供的三种常用并发队列实现
java并发包中提供了三个常用的并发队列实现,分别是:ConcurrentLinkedQueue.LinkedBlockingQueue和ArrayBlockingQueue. ConcurrentL ...
- mongoose.model第三个参数的问题
这个是个好问题,之前按照教程做的数据库没有问题,现在自己从新做出现了问题.还好之前有无意中接触了这个知识点,不然感觉真的很难解决. 在检查完所有东西都没错的时候(前端传给req的数据正常,与数据库相符 ...
- Django学习路
1.脚本不能随便运行,没准 linux 运行完就上不去了 2.pip 在 linux 上 写 pip3 同理 python 写为 python3 3.在 pycharm 上安装库之后,在命令提示符中依 ...
- C/C++编程笔记:C++入门知识丨认识C++面向过程编程的特点
一. 本篇要学习的内容和知识结构概览 二. 知识点逐条分析 1. 使用函数重载 C++允许为同一个函数定义几个版本, 从而使一个函数名具有多种功能, 这称之为函数重载. 像这样: 虽然函数名一样, 但 ...
- luogu P3223 [HNOI2012]排队
LINK:排队\ 原谅我没学过组合数学 没有高中数学基础水平... 不过凭着隔板法的应用还是可以推出来的. 首先考虑女生 发现一个排列数m! 两个女生不能相邻 那么理论上来说存在无解的情况 而这道题好 ...
- python数据可视化编程实战PDF高清电子书
点击获取提取码:3l5m 内容简介 <Python数据可视化编程实战>是一本使用Python实现数据可视化编程的实战指南,介绍了如何使用Python最流行的库,通过60余种方法创建美观的数 ...
- 把Spring Cloud Data Flow部署在Kubernetes上,再跑个任务试试
1 前言 欢迎访问南瓜慢说 www.pkslow.com获取更多精彩文章! Spring Cloud Data Flow在本地跑得好好的,为什么要部署在Kubernetes上呢?主要是因为Kubern ...
- 当asp.net core偶遇docker二(打造个人docker镜像)
网络上的docker容器总有一些不尽人意的感觉,这个时候,就需要自己diy一个自用的. 比如我们想在163的mysql 5.7内diy一下,结果发现,这个不带vim,我想改造一个自用的mysql镜像, ...
- NTFS 文件系统结构
背景 NTFS 作为一个新的文件系统,因其安全性高而受到越来越多的重视,越来越多的应用采用了NTFS 文件系统.作为一个新的文件系统,NTFS 有着许多区别于FAT32 的优点,如磁盘配额.文件系统加 ...
- Linux系统中玩到让你停不下来的命令行游戏!
大家好,我是良许. 在使用 Linux 系统时,命令行不仅可以让我们在工作中提高效率,它还可以在生活上给我们提供各种娱乐活动,因为你可以使用它玩许多非常有意思的游戏,这些游戏可都不需要使用专用显卡. ...