This post deals with a thing that didn't get any real answer in this thread : using checkboxes for custom registration fields
This will display a checkbox on the frontend and a "Yes/No" select in the backend.
Let's say we want to know if the customer likes (or not) the chocolate flavour.
'chocolate'=>array('label'=>'Do you like chocolate','type'=>'int','input'=>'select','visible'=>true,'required'=>true,// or false'source'=>'eav/entity_attribute_source_boolean',),
At step 5.
Add
$setup->addAttribute('customer','chocolate',array('label'=>'Do you like chocolate','type'=>'int','input'=>'select','visible'=>true,'required'=>true,// or false'position'=>1,'source'=>'eav/entity_attribute_source_boolean',));
At step 6.
For register.phtml, add
<div class="input-box">
<label for="chocolate"><?phpecho$this->__('Do you like chocoalte')?><span class="required">*</span></label><br />
<input type="checkbox" name="chocolate" id="chocolate" value="1" title="<?phpecho$this->__('Do you like chocolate')?>" class="class="required-entry checkbox" />
</div>
For edit.phtml, add
<div class="input-box">
<label for="chocolate"><?phpecho$this->__('Do you like chocoalte')?><span class="required">*</span></label><br />
<input type="checkbox" name="chocolate" id="chocolate" value="1" title="<?phpecho$this->__('Do you like chocolate')?>" <?phpif($this->getCustomer()->getChocolate()==1):?> checked="checked"<?phpendif;?> class="class="required-entry checkbox" />
</div>
We also need to modify the AccountController.php file (best practice is to override it to prevent from loosing modification on core updates)
This post deals with a thing that didn't get any real answer in this thread : using checkboxes for custom registration fields
This will display a checkbox on the frontend and a "Yes/No" select in the backend.
Let's say we want to know if the customer likes (or not) the chocolate flavour.
At step 3.
Add
<chocolate><create>1</create><update>1</update></chocolate>At step 4.
Add
At step 5.
Add
At step 6.
For register.phtml, add
For edit.phtml, add
We also need to modify the AccountController.php file (best practice is to override it to prevent from loosing modification on core updates)
Around line 583, change
to
An we're done. Tested on Magento 1.4.0.1.