2012-07-23 3 views
0

나는 magento가있는 초보자입니다. 고객 등록 페이지에 사용자 정의 필드를 추가해야하는 사용자 정의 모듈을 만들었습니다. 나는 고객을 편집하거나 새로운 것을 추가 할 때 admin/customer에서 볼 수있는 고객에게 하나의 사용자 정의 필드를 성공적으로 추가했습니다. 등록 페이지에서도 어떻게 표시 할 수 있습니까?Magento의 등록 페이지에서 사용자 정의 필드를 표시하는 방법은 무엇입니까?

mysql4 설치-0.1.0.php

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

$setup = new Mage_Eav_Model_Entity_Setup('core_setup'); 

$entityTypeId  = $setup->getEntityTypeId('customer'); 
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId); 
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); 

$setup->addAttribute('customer', 'resale', array(
    'input'   => 'text', 
    'type'   => 'varchar', 
    'label'   => 'Resale number', 
    'visible'  => 1, 
    'required'  => 1, 
    'user_defined' => 1, 
)); 

$setup->addAttributeToGroup(
$entityTypeId, 
$attributeSetId, 
$attributeGroupId, 
'resale', 
'999' //sort_order 
); 

$oAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', 'resale'); 
$oAttribute->setData('used_in_forms', array('adminhtml_customer','customer_account_create')); 
$oAttribute->save(); 

$installer->endSetup(); 

감사합니다 :

여기 내 모듈의 파일을 설치합니다.

답변

1

당신은 아래와 같이 register.html하는 코드를 추가해야합니다 :

<div class="field"> 
    <label for="my_attribute" class="required"><em>*</em><?php echo $this->__('My Attribute') ?></label> 
    <div class="input-box"> 
    <input type="text" name="my_attribute" id="my_attribute" value="<?php echo $this->htmlEscape($this->getFormData()->getMyAttribute()) ?>" title="<?php echo $this->__('My Attribute') ?>" class="input-text required-entry" /> 
    </div> 
</div> 
+0

감사합니다, 그것은했다! – Joonas

관련 문제