/** * check attribute value exits or not * @param unknown $arg_attribute * @param unknown $arg_value * @return unknown|boolean */ public function attributeValueExists($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); foreach($options as $option) { if ($option['label'] == $arg_value) { return $option['value']; } } return false; } /** * add attribute value * @param unknown $arg_attribute * @param unknown $arg_value * @return unknown|boolean */ public function addAttributeValue($arg_attribute, $arg_value) { $attribute_model = Mage::getModel('eav/entity_attribute'); $attribute_code = $attribute_model->getIdByCode('catalog_product', $arg_attribute); $attribute = $attribute_model->load($attribute_code); if(!$this->attributeValueExists($arg_attribute, $arg_value)) { $value['option'] = array($arg_value,$arg_value); $result = array('value' => $value); $attribute->setData('option',$result); $attribute->save(); } $attribute_options_model= Mage::getModel('eav/entity_attribute_source_table') ; $attribute_table = $attribute_options_model->setAttribute($attribute); $options = $attribute_options_model->getAllOptions(false); foreach($options as $option) { if ($option['label'] == $arg_value) { return $option['value']; } } return false; }
相关推荐
Magento 2的Dmatthew_AttributeDescription模块这是一个Magento 2模块,它增加了向产品属性添加描述的功能。 将描述添加到可配置属性,并将其显示在您的产品视图页面上。 使用属性描述可以帮助向客户解释复杂的属性...
Magento 2客户属性扩展示例此扩展程序展示了如何使用Magento 2扩展程序创建客户属性。
NULL 博文链接:https://justcoding.iteye.com/blog/1886183
深入理解Magento-第一章 – Magento强大的配置系统 深入理解Magento-第二章 – Magento请求分发与控制器 深入理解Magento-第三章 – 布局,块和模板 深入理解Magento-第四章 – 模型和ORM基础 深入理解...
Chapter 1, Installing Magento 2 on Apache and NGINX, is a totally different ballgame compared to Magento 1. Where Magento 1 could be installed through FTP...Chapter 8, Creating Magento 2 Extensions – Ad
此代码仅供参考没有后台管理表格1.8版本下可用 ...2.eav_attribute,eav_attribute_group,eav_attribute_set,eav_entity_attribute,eav_entity_type 每个表多一条数据。 作者网站:http://www.sharpmagento.com/
magento数据结构分析 magento数据字典
magento的SMTP插件magento的SMTP插件magento的SMTP插件
magik shoes magento 模板, magento 1.7 模板
What this book covers Chapter 1, Installing Magento 2 on Apache and NGINX, is a totally different ballgame compared to Magento 1....this is a new requirement for extensions listed on the new Magento
深入理解Magento 由精东博客下载下来制作成pdf
Magento插件开发手册 Magento Extension Developers Guide
Athlete Magento主题,兼容Magento 1.9.x, 1.8.x, 1.7.x ,特点:完全自适应(响应式布局),自定义子主题,无限颜色,完全自定义,一键安装演示,小工具化横幅系统,颜色选择,MEGA菜单,多商店支持,自定义产品...
magento2 developers cookbook, magento 开发手册,magento教程
magento首页New Pro产品显示数目、列数。
Magento 2 Beginners Guide by Gabriel Guarino English | 14 Mar. 2017 | ASIN: B01MS81BQX | 442 Pages | AZW3 | 31.84 MB Key Features Set up and manage your very first online store with a friendly and ...
Magento Magento商城 Magento目录结构
主要包括的内容有:magento的常用设置、Magento模板制作教程、Magento商城_目录结构说明、Magento中文教程实用文档、常用的xml的文件的作用以及自定义模块的应用