Reputation: 8791
I want to remove fields from Registration (/customer/account/create/). How can I do this? is there some way without get into files of the store (e.g. hiding these fields)?
Upvotes: 2
Views: 9341
Reputation: 1907
Somehow I got it to work. This is want I did and I request you to try it and check if it solves the issue.
customer/address/middlename_show
.customer/address/middlename_show
and change it to 1 . Generally, this will be 0 (zero) by default.Upvotes: 3
Reputation: 3218
You should update some fields in the DB.
For example. I need to remove last name from registration form. It's a requried field. So I created own module with sql update file to change field parameters:
upgrade-1.0.0.1-1.0.0.2.php
/* @var $installer Mage_Customer_Model_Entity_Setup */
$installer = $this;
$installer->startSetup();
// SELECT attribute_id, entity_type_id FROM eav_attribute where attribute_code = 'lastname'
// SELECT * FROM customer_eav_attribute where attribute_id in (SELECT attribute_id FROM eav_attribute where attribute_code = 'lastname')
$options = unserialize('a:2:{s:15:"max_text_length";i:255;s:15:"min_text_length";i:1;}');
if (isset($options['min_text_length'])) unset($options['min_text_length']);
$installer->addAttribute('customer', 'lastname', array(
'validate_rules' => serialize($options),
'required' => false
));
$installer->addAttribute('customer_address', 'lastname', array(
'validate_rules' => serialize($options),
'required' => false
));
$installer->endSetup();
After that you should hide this field using html+css or js
UPDATE:
Edit file /app/design/frontend/default/YOURTHEME/template/customer/widget/name.phtml to change your registration form. In my case I commented out html block there:
<?php /*if ($this->showMiddlename()): ?>
<?php $isMiddlenameRequired = $this->isMiddlenameRequired(); ?>
<div class="field name-middlename">
<label for="<?php echo $this->getFieldId('middlename')?>"<?php echo $isMiddlenameRequired ? ' class="required"' : '' ?>><?php echo $isMiddlenameRequired ? '<em>*</em>' : '' ?><?php echo $this->getStoreLabel('middlename') ?></label>
<div class="input-box">
<input type="text" id="<?php echo $this->getFieldId('middlename')?>" name="<?php echo $this->getFieldName('middlename')?>" value="<?php echo $this->escapeHtml($this->getObject()->getMiddlename()) ?>" title="<?php echo $this->getStoreLabel('middlename') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('middlename') ?>" <?php echo $this->getFieldParams() ?> />
</div>
</div>
<?php endif; */?>
<!--<div class="field name-lastname">
<label for="<?php echo $this->getFieldId('lastname')?>" class="required"><em>*</em><?php echo $this->getStoreLabel('lastname') ?></label>
<div class="input-box">
<input type="text" id="<?php echo $this->getFieldId('lastname')?>" name="<?php echo $this->getFieldName('lastname')?>" value="<?php echo $this->escapeHtml($this->getObject()->getLastname()) ?>" title="<?php echo $this->getStoreLabel('lastname') ?>" maxlength="255" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('lastname') ?>" <?php echo $this->getFieldParams() ?> />
</div>
</div>-->
Also you could add some class to <div class="field name-middlename">
and <div class="field name-lastname">
. This class should has css property "display:none;"
.
Upvotes: 3