Я думаю, что вы сделали много ошибок .. Вы идете,
и т.д. / config.xml
<?xml version="1.0"?>
<config>
<modules>
<Exinent_Cusatt>
<version>0.1.0</version>
</Exinent_Cusatt>
</modules>
<global>
<helpers>
<cusatt>
<class>Exinent_Cusatt_Helper</class>
</cusatt>
</helpers>
<models>
<cusatt>
<class>Exinent_Cusatt_Model</class>
<resourceModel>cusatt_mysql4</resourceModel>
</cusatt>
</models>
<resources>
<customerattribute1404212233_setup>
<setup>
<module>Exinent_Cusatt</module>
<class>Mage_Customer_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</customerattribute1404212233_setup>
<customerattribute1404212233_write>
<connection>
<use>core_write</use>
</connection>
</customerattribute1404212233_write>
<customerattribute1404212233_read>
<connection>
<use>core_read</use>
</connection>
</customerattribute1404212233_read>
</resources>
</global>
</config>
Helper / Data.php:
<?php
class Exinent_Cusatt_Helper_Data extends Mage_Core_Helper_Abstract
{
}
Режим / Eav / Entity / Атрибут / Source / Customeroptions14042122330.php
<?php
class Exinent_Cusatt_Model_Eav_Entity_Attribute_Source_Customeroptions14042122330 extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
/**
* Retrieve all options array
*
* @return array
*/
public function getAllOptions()
{
if (is_null($this->_options)) {
$this->_options = array(
array(
"label" => Mage::helper("eav")->__("Myoption-1"),
"value" => 1
),
array(
"label" => Mage::helper("eav")->__("Myoption-2"),
"value" => 2
),
array(
"label" => Mage::helper("eav")->__("Myoption-3"),
"value" => 3
),
array(
"label" => Mage::helper("eav")->__("Myoption-4"),
"value" => 4
),
);
}
return $this->_options;
}
/**
* Retrieve option array
*
* @return array
*/
public function getOptionArray()
{
$_options = array();
foreach ($this->getAllOptions() as $option) {
$_options[$option["value"]] = $option["label"];
}
return $_options;
}
/**
* Get a text for option value
*
* @param string|integer $value
* @return string
*/
public function getOptionText($value)
{
$options = $this->getAllOptions();
foreach ($options as $option) {
if ($option["value"] == $value) {
return $option["label"];
}
}
return false;
}
/**
* Retrieve Column(s) for Flat
*
* @return array
*/
public function getFlatColums()
{
$columns = array();
$columns[$this->getAttribute()->getAttributeCode()] = array(
"type" => "tinyint(1)",
"unsigned" => false,
"is_null" => true,
"default" => null,
"extra" => null
);
return $columns;
}
/**
* Retrieve Indexes(s) for Flat
*
* @return array
*/
public function getFlatIndexes()
{
$indexes = array();
$index = "IDX_" . strtoupper($this->getAttribute()->getAttributeCode());
$indexes[$index] = array(
"type" => "index",
"fields" => array($this->getAttribute()->getAttributeCode())
);
return $indexes;
}
/**
* Retrieve Select For Flat Attribute update
*
* @param int $store
* @return Varien_Db_Select|null
*/
public function getFlatUpdateSelect($store)
{
return Mage::getResourceModel("eav/entity_attribute")
->getFlatUpdateSelect($this->getAttribute(), $store);
}
}
SQL / customerattribute1404212233_setup / mysql4-установки-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute("customer", "exinent", array(
"type" => "text",
"backend" => "",
"label" => "exinent1",
"input" => "multiselect",
"source" => "cusatt/eav_entity_attribute_source_customeroptions14042122330",
"visible" => true,
"required" => false,
"default" => "",
"frontend" => "",
"unique" => false,
"note" => ""
));
$attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "exinent");
$used_in_forms=array();
$used_in_forms[]="adminhtml_customer";
$attribute->setData("used_in_forms", $used_in_forms)
->setData("is_used_for_customer_segment", true)
->setData("is_system", 0)
->setData("is_user_defined", 1)
->setData("is_visible", 1)
->setData("sort_order", 100)
;
$attribute->save();
$installer->endSetup();
Вот и все. Просто включите ваш модуль, чтобы объявить свой пул кода, и не путайте с числами. <customerattribute1404212233_setup>
Это просто случайное нет для вас атрибута идентичности, для предотвращения повторного ввода. .. ура ..!