Я хочу добавить новое поле "custom_house_no" для адреса доставки во время процесса оформления одной страницы.
Я добавил приведенный ниже код в мой файл mysql собственного расширения "mysql4-install-0.1.0.php "
// Customer Address
$entityTypeId = $installer->getEntityTypeId('customer_address');
$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);</p>
<pre><code>$installer->addAttribute('customer_address', 'custom_house_no', array(
'label' => 'Custom House No',
'input' => 'text', // Input field type textbox
'type' => 'varchar', // Store varchar data type
'frontend' => '', //frontend model
'backend' => '', //backend model
'visible' => 1, //true
'required' => 0, //false
'user_defined' => 1,
'default' => '', //default value
'searchable' => 0,
'filterable' => 0,
'comparable' => 0,
'visible_on_front' => 0,
'unique' => 0,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
// 'class' => '',
// 'source' => 'catalog/category_attribute_source_page',
));
$installer->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'custom_house_no',
'150' //last Magento's attribute position in General tab is 140
);
$attribute = Mage::getSingleton('eav/config')->getAttribute('customer_address', 'custom_house_no');
$attribute->setData('used_in_forms', array('customer_register_address', 'customer_address_edit', 'adminhtml_customer_address')); // Setting the relation between the attribute and forms in which this attribute will be used
$attribute->save();`
Я также сделал класс в папке MY / CustomExtension / Model / Entity / Setup.php
class MY_CustomExtension_Model_Entity_Setup extends Mage_Eav_Model_Entity_Setup {
}
У меня естьтакже добавлено имя класса в файле конфигурации расширения.
Link to config code : <a href="http://pastebin.com/Li7CqEyj" rel="nofollow">Config File Content</a>
И в файл шаблона доставки я добавил текстовое поле с именем «custom_house_no».
Атрибут был успешно добавлен и он связан с формами, но со всеми даннымисохраняется сохранение в базе данных, кроме поля "custom_house_no".
Я не знаю, что не так с моим кодом.