Magento1.9 add attribute to catalog product & assign to all attribute set general group
$installer = $this; $attributes = array(
'region' => array(
'type' => 'int',
'input' => 'select',
'source_model' => 'evebit_catalog/entity_attribute_source_region',
'frontend_label' => 'Region',
'is_global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'frontend_input' => 'select',
'backend_type' => 'int',
'used_in_product_listing' => true,
'is_visible_on_front' => true,
'is_required' => false,
'is_user_defined' => true,
'searchable' => true,
'filterable' => true,
'comparable' => false,
'visible_in_advanced_search'=>true,
'position' => 15,
'is_unique' => false,
)
); $productEntityId = $installer->getEntityTypeId(Mage_Catalog_Model_Product::ENTITY);
$allAttributeSetIds = $installer->getAllAttributeSetIds($productEntityId); foreach($attributes as $attributeCode=>$attribute)
{
$attributeModel = Mage::getModel('catalog/resource_eav_attribute');
$attributeModel->addData($attribute);
$attributeModel->setAttributeCode($attributeCode);
$attributeModel->setEntityTypeId($productEntityId); try
{
$attributeModel->save(); }catch (Mage_Core_Exception $e)
{
Mage::logException($e);
} try
{
foreach ($allAttributeSetIds as $attributeSetId){ $generalAttributeGroup = $installer->getAttributeGroupId($productEntityId,$attributeSetId,'General');
$attributeModel->setAttributeSetId($attributeSetId);
$attributeModel->setAttributeGroupId($generalAttributeGroup);
$attributeModel->save();
} }catch (Mage_Core_Exception $e)
{
Mage::logException($e);
}
} $installer->updateAttribute(Mage_Catalog_Model_Product::ENTITY, 'country_of_manufacture', 'frontend_label', 'Country'); $installer->endSetup();
Magento1.9 add attribute to catalog product & assign to all attribute set general group的更多相关文章
- enovia PLM: add characteristic to both prototype and product
Issue: add new mandatory attribute named LUX_HazardousMaterial to protoype and product, and export t ...
- Optimizing Item Import Performance in Oracle Product Hub/Inventory
APPLIES TO: Oracle Product Hub - Version 12.1.1 to 12.1.1 [Release 12.1] Oracle Inventory Management ...
- [转]Magento Configurable Product
本文转自:https://docs.magento.com/m1/ce/user_guide/catalog/product-configurable.html A configurable prod ...
- Oracle Product Hub / Product Lifecycle Management / Product Information Management / Advanced Produc
In this Document Goal Solution 1. Master List showing sample code for APIs in Product Data Hub ...
- magento产品成功添加到购物车后跳转到不同页面 添加 add to cart 按钮
1 添加产品到购物车成功后是跳转到购物车页面或不跳转.这个在后台可以设置 system -> configuration -> After Adding a Product Redirec ...
- magento添加多个产品到购物车(Add multiple products to cart )
Step 1app\design\frontend\base\default\template\catalog\product\list.phtml<?php $_productColl ...
- How to Programmatically Add/Delete Custom Options in Magento? - See more at: http://apptha.com/blog/
In this tutorial, I would like to help out Magento developers and clients with how to programmatical ...
- [转]论magento1和magento2的速度性能优化问题
本文转自:http://www.360magento.com/blog/magento-speed-up/ magento从2007年发展至今,也经历了十余年的磨练,如今也迎来了magento的换代产 ...
- (转)Attribute在.net编程中的应用
Attribute在.net编程中的应用(一)Attribute的基本概念 经常有朋友问,Attribute是什么?它有什么用?好像没有这个东东程序也能运行.实际上在.Net中,Attribute是一 ...
随机推荐
- Kafka入门(2):消费与位移
摘要 在这篇文章中,我将从消息在Kafka中的物理存储方式讲起,介绍分区-日志段-日志的各个层次. 然后我将接着上一篇文章的内容,把消费者的内容展开讲一讲,区分消费者与消费者组,以及这么设计有什么用. ...
- Lua中 pairs和ipairs的区别
Lua系列–pairs和ipairsLua中Table的存储方式在看二者的区别之前,我们首先来看一下Lua中的table是如何在内存中进行分配的.Table的组成:1.哈希表 用来存储Key-Valu ...
- Android Zero (基础介绍篇)
开发Android首先你得先配置好环境,配置的文章网上一大把,这里就不重复造轮子说了,配置好JAVA下载好AndroidStudio后我们先对基本的项目结构做一下了解! 首先介绍下你必须得知道的文件夹 ...
- Ubuntu Linux markdown编辑工具 typora 安装
Typora简介 Typora是一款轻便简洁的Markdown编辑器,支持即时渲染技术,这也是与其他Markdown编辑器最显著的区别.即时渲染使得你写Markdown就想是写Word文档一样流畅自如 ...
- Day01_WebCrawler(网络爬虫)
学于黑马和传智播客联合做的教学项目 感谢 黑马官网 传智播客官网 微信搜索"艺术行者",关注并回复关键词"webcrawler"获取视频和教程资料! b站在线视 ...
- Python日历模块
Python日历模块 calendar: 0:星期一是第一天 6:星期日是最后一天 注:形参 w,I,c 可以不写,正常使用,使用默认形参即可 calendar(year,w=2,I=1,c=6): ...
- PHP is_null() 函数
is_null() 函数用于检测变量是否为 NULL.高佣联盟 www.cgewang.com PHP 版本要求: PHP 4 >= 4.0.4, PHP 5, PHP 7 语法 bool is ...
- 5.15 牛客挑战赛40 C 小V和字符串 数位dp 计数问题
LINK:小V和字符串 容易想到只有1个数相同的 才能有贡献. 知道两个01串 那么容易得到最小步数 大体上就是 第一个串的最前的1和第二个串最前的1进行匹配. 容易想到设f[i][j]表示 前i位1 ...
- Java垃圾回收原来这么简单
什么是垃圾回收? 垃圾回收(Garbage Collection,GC),顾名思义就是释放垃圾占用的空间,防止内存泄露.有效的使用可以使用的内存,对内存堆中已经死亡的或者长时间没有使用的对象进行清除和 ...
- Elasticsearch和Scala类型转换
Scala Type ES Unit null None null Nil empty array Some[T] according to the table Map object Traver ...