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是一 ...
随机推荐
- onepill Android端
使用的框架 第三方登录集成基于ThinkPHP5的第三方登录插件 QQ第三方登录集成QQ互联.qq第三方接入 SharedPreference实现记住账号密码功能参考.参考2
- 第一章 Java快速入门
1.1.安装开发环境 第一步:打开下载地址,下载对应平台的 JDK 安装包 第二步:打开下载软件,全部默认下一步傻瓜式安装 1.2.配置环境变量 第一步:配置JAVA_HOME 第二步:配置CLASS ...
- Django学习路3
1.打开 Data Source alt insert 打开 Data Source 找到 db.sqlite3 确定 Download 下载后 TestConnection 测试是否成功 2.项目下 ...
- 什么是 PHP 过滤器?
PHP 过滤器 PHP 过滤器用于验证和过滤来自非安全来源的数据,比如用户的输入. 什么是 PHP 过滤器? PHP 过滤器用于验证和过滤来自非安全来源的数据. 测试.验证和过滤用户输入或自定义数据是 ...
- PHP mysqli_thread_safe() 函数
定义和用法 mysqli_thread_safe() 函数返回是否将客户端库编译成 thread-safe. 语法 mysqli_thread_safe();高佣联盟 www.cgewang.com ...
- 一本通 高手训练 1782 分层图 状压dp
LINK:分层图 很精辟的一道题 写的时候没带脑子 导致搞了半天不知道哪错了. 可以想到状压每次到某一层的状态 然后这个表示方案数 多开一维表示此时路径条数的奇偶即可. 不过显然我们只需要知道路径条数 ...
- 2019 7 8 HL 模拟赛
今天 很不爽 昨天晚上没有睡好觉 大约2点才睡着吧 反正翻来覆去睡不着 不知道为什么可能可行流 或者可行费用流并没有深刻理解 .我不会写 让我心情非常的焦躁. 大凶 顺理成章的被3位强者吊着锤(妈呀我 ...
- Nginx使用中遇到的问题记录
问题一.关于空格 nginx配置对空格十分敏感,在关键字和符号的前后,一定记得有空格(或换行).一个典型的场景是 if { } 语句,大括号前后要有空格,否则可能出现非预期行为. 问题二.关于serv ...
- C++ 中可调用的且有函数功能的东东
第一个:函数 其实函数在声明的时候都有个名字: 这个名字可以看作是是指针,将其直接赋值给函数指针 也可以看作是可取指的对其& 再赋值给函数指针 第二个:函数指针 通过其被赋值的方式 ...
- Kaggle-pandas(4)
Grouping-and-sorting 教程 映射使我们可以一次将整个列中的数据转换为DataFrame或Series中的一个值. 但是,通常我们希望对数据进行分组,然后对数据所在的组进行特定的操作 ...