Reputation: 41
I'm adding a field to the template customer/form/edit.phtml. I used this code :
<li>
<?php
$attribute = Mage::getModel('eav/config')->getAttribute('customer','code_magique');
?>
<label for="code_magique" class="<?php if($attribute->getIsRequired() == true){?>required<?php } ?>"><?php if($attribute->getIsRequired() == true){?><em>*</em><?php } ?><?php echo $this->__('Code') ?></label>
<div class="input-box">
<input type="text" name="code_magique" id="code_magique" value="<?php echo $this->htmlEscape($this->getCustomer()->getData("code_magique")) ?>" title="<?php echo $this->__('Code') ?>" class="input-text" />
</div>
</li>
This display a field with my "code_magique" attribute inside but when i try to modify this attribute, it doesn't work, did I forget something?
Upvotes: 1
Views: 706
Reputation: 5193
I did a quick look at AccountController.php, and it seems there is some postprocessing of form data, not the simple $model->addData($post);
Try hooking to customer_save_before
event and adding your data manually.
Hopefully you know how to create anobserver and add data to model object?
Upvotes: 1