- 浏览: 74262 次
- 性别:
- 来自: 上海
-
最新评论
下面的代码为Customer实体添加了性别属性,有两个可选值 Male和Female
$installer->startSetup(); $installer->addAttribute('customer', 'gender', array( 'label' => 'Gender', 'visible' => true, 'required' => false, 'type' => 'int', 'input' => 'select', 'source' => 'eav/entity_attribute_source_table', )); $tableOptions = $installer->getTable('eav_attribute_option'); $tableOptionValues = $installer->getTable('eav_attribute_option_value'); // add options for level of politeness $attributeId = (int)$installer->getAttribute('customer', 'gender', 'attribute_id'); foreach (array('Male', 'Female') as $sortOrder => $label) { // add option $data = array( 'attribute_id' => $attributeId, 'sort_order' => $sortOrder, ); $installer->getConnection()->insert($tableOptions, $data); // add option label $optionId = (int)$installer->getConnection()->lastInsertId($tableOptions, 'option_id'); $data = array( 'option_id' => $optionId, 'store_id' => 0, 'value' => $label, ); $installer->getConnection()->insert($tableOptionValues, $data); } $installer->endSetup();
发表评论
-
Magento随机生成sales rule的coupon code
2013-01-02 22:09 2292在Magento中可以使用SalesRule模块下的Mage_ ... -
Magento 后台配置中实现日期选择 (Date picker)
2012-12-28 15:07 2534首先,创建一个新的Form Field 类: <?p ... -
获得指定customer 购买的产品数据
2011-12-10 20:54 1400获得指定customer 购买的产品信息,如果是configu ... -
将缺货产品放在产品列表后面
2011-12-10 20:50 1416Rewrite Mage_Catalog_Model_Laye ... -
Mac Lion上安装配置Nginx PHP PHP-FPM
2011-12-10 16:01 8058<!--?xml version="1.0&q ... -
How to customize Magento as CMS system (1.5.0 CE)
2011-03-06 22:42 1086Before install: 1. Go to app/et ... -
How to redirect to another url in block or template
2011-02-25 13:47 1153In Block class: public funct ... -
Use call back function to proccess Magento large collection
2011-01-19 12:58 964$orders = Mage::getModel('sal ... -
How to remove unnecessary columns in Magento collection
2011-01-19 12:56 1151$orders = Mage::getModel('sal ... -
How to calculate currency according to reward points rate in Magento
2011-01-13 18:03 1351$rate = Mage::getModel('enter ... -
Magento二次开发的利器:Rewrite
2010-12-08 17:15 2752Magento是一个十分优秀的电子商务系统,但是有时候我们需要 ... -
增加Magento后台管理功能三:在后台设置(System/Configuration)中加入自定义设置
2010-11-30 16:17 1991在模块的etc目录下新建system.xml配置文件,内容如下 ... -
增加Magento后台管理功能二:开发后台Controller
2010-11-30 16:02 2722在模块的controllers目录下创建Adminhtml目录 ... -
增加Magento后台管理功能一:在后台管理界面加入菜单
2010-11-30 15:47 4562在模块的etc目录下增加adminhtml.xml配置文件,用 ... -
Magento在CMS Page中增加用户信息变量
2010-11-26 10:14 2846Magento的cms页面和static block页面中可以 ... -
Magento根据不同的浏览器自动切换package或 theme
2010-11-26 10:05 2108在后台设置中: System > Configurat ... -
Magento让后台数据列表中的action列链接在新窗口打开
2010-11-08 16:56 1219'actions' => array( ... -
Maegen获得后台当前用户的信息
2010-11-08 16:53 970$admin = Mage::getSingleton(' ... -
Magento中用子类替换Block
2010-10-15 10:47 1876Step 1:创建一个新的Module Step 2: 编辑模 ... -
Magento为后台用户保存操作日志(企业版)
2010-09-19 17:00 2781protected function _logAdm ...
相关推荐
### Magento中文用户指南知识点概述 #### 一、Magento简介 ...以上内容覆盖了Magento中文用户指南中的关键知识点,旨在帮助新手快速掌握Magento的核心功能与操作技巧,同时也为有经验的用户提供了进阶指南。
EavOptionSetup(Magento2) 此Magento2扩展包含一个类,该类仅在指定的属性尚不具有带有相同管理范围标签的选项时,才可以轻松添加EAV属性选项。事实描述EavOptionSetup类旨在在安装脚本中使用,但实际上也可以在...
在Magento中,每个模块都可以有自己的模型、视图和控制器,而这些部分可以通过配置文件灵活地组合在一起。 **2.3 HelloWorld示例** 接下来我们以`HelloWorld`模块为例,详细介绍如何创建一个简单的模块。 **2.4 ...
我已经设置了位于app / code / local / Samuidavid / CustCatAttr / sql / custcatattr_setup中的安装脚本,以将新的图像输入字段添加到类别的“常规信息”选项卡中,并带有标签“类别横幅”。 “输入”可以更改为...
主题是Magento 2中定制外观的主要方式,而小部件则提供了一种方便的方式来添加动态内容或功能,比如侧边栏小部件、产品滑块等。 总的来说,《No Frills Magento Layout》文档将带你深入理解Magento 2的布局系统,...
带有电子商务跟踪功能的Google Universal Support 动态再营销(添加Google提供的转化ID和标签,产品由其产品ID标识) 标记管理器(这为标记管理器脚本代码段提供了一个输入字段-请注意,数据层的填充量取决于您) ...