久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在 Magento 中向客戶組添加自定義屬性?

How do you add custom attributes to Customer Groups in Magento?(如何在 Magento 中向客戶組添加自定義屬性?)
本文介紹了如何在 Magento 中向客戶組添加自定義屬性?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我們使用的是 Magento CE 1.7.0.0,我們正在嘗試向客戶組實體添加新屬性.我們已使用以下安裝腳本成功地向客戶添加了自定義屬性:

We're on Magento CE 1.7.0.0, and we're trying to add new attributes to the Customer Group entities. We've successfully added custom attributes to Customers using the following install script:

<?php
$installer = $this;
$installer->startSetup();

$setup = Mage::getModel('customer/entity_setup', 'core_setup');

$setup->addAttribute('customer', 'ussco_account_number', array(
    'type' => 'varchar',
    'input' => 'text',
    'label' => 'USSCO Account Number',
    'note' => 'Leave blank for default',
    'global' => 1,
    'visible' => 1,
    'required' => 0,
    'user_defined' => 0,
    'default' => '',
    'visible_on_front' => 0,
    'source' =>   NULL,
));

Mage::getSingleton('eav/config')
    ->getAttribute('customer', 'ussco_account_number')
    ->setData('used_in_forms', array('adminhtml_customer'))
    ->save();

$installer->endSetup();

有沒有人對客戶組而不是客戶做過類似的事情?

Has anyone had any luck doing something similar with Customer Groups, rather than customers?

推薦答案

如果您查看 sql 安裝程序/更新腳本,您會發(fā)現(xiàn)如下內(nèi)容:

If you take a look at the sql installer/update scripts you will find something like this:

$table = $installer->getConnection()
    ->newTable($installer->getTable('customer/customer_group'))
    ->addColumn('customer_group_id', Varien_Db_Ddl_Table::TYPE_SMALLINT, null, array(
        'identity'  => true,
        'unsigned'  => true,
        'nullable'  => false,
        'primary'   => true,
        ), 'Customer Group Id')
    ->addColumn('customer_group_code', Varien_Db_Ddl_Table::TYPE_TEXT, 32, array(
        'nullable'  => false,
        ), 'Customer Group Code')
    ->addColumn('tax_class_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
        'unsigned'  => true,
        'nullable'  => false,
        'default'   => '0',
        ), 'Tax Class Id')
    ->setComment('Customer Group');

如您所見,它是一個簡單的 mysql4 表,您只需向組中添加一列.它不是 EAV,所以你不要使用它的屬性!

As you can see its a simple mysql4 table and you simply need to add a column to the group. It is not EAV so you dont work with attributes on that one!

新列不會顯示在表格或網(wǎng)格中!您必須通過觀察者或重寫 Mage_Adminhtml_Block_Customer_Group_Edit_FormMage_Adminhtml_Block_Customer_Group_Grid 手動添加此內(nèi)容,例如為文本字段添加類似內(nèi)容:

The new colum will not show up in the form or grid! You have to add this manually via observer or rewriting Mage_Adminhtml_Block_Customer_Group_Edit_Form or Mage_Adminhtml_Block_Customer_Group_Grid by adding something like this for e.g text field:

$fieldset->addField('your_column', 'text',
    array(
        'name'  => 'Your_Column',
        'label' => Mage::helper('customer')->__('Tax Class'),
        'title' => Mage::helper('customer')->__('Tax Class'),
        'class' => 'required-entry',
        'required' => true
    )
);

這篇關于如何在 Magento 中向客戶組添加自定義屬性?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產(chǎn)生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 精品亚洲一区二区 | 日韩a v在线免费观看 | 91精品国产一区二区 | 成人免费一区二区三区视频网站 | 精品国产乱码久久久久久老虎 | 免费在线观看av | 精品国产黄a∨片高清在线 www.一级片 国产欧美日韩综合精品一区二区 | 在线久草| 国产亚洲一区二区三区 | 久热中文字幕 | 国产露脸对白88av | 人人做人人澡人人爽欧美 | 午夜激情小视频 | 国产精品久久久久久婷婷天堂 | 久久久久久久国产精品 | 视频在线日韩 | 国产精品亚洲精品 | 国产精品视频久久久久 | 国产精品久久久久久吹潮日韩动画 | 国产黄色一级电影 | 久久夜夜 | 黄色一级视频免费 | 国产精品亚洲片在线播放 | 99久久中文字幕三级久久日本 | 久久国产精品网 | 国产成人精品一区二区三区视频 | 国产精品18hdxxxⅹ在线 | 日本视频中文字幕 | 91社区在线观看播放 | 精品国产99 | 中文字幕av一区 | 成年男女免费视频网站 | 色婷婷久久久亚洲一区二区三区 | 国产精品视频久久久 | 日韩av一区二区在线观看 | 久久高清| 一区二区精品视频 | 99亚洲精品| 欧美一区二区三区在线 | 国产在线观看网站 | 欧美激情视频一区二区三区免费 |