我想从注册中删除字段(/ customer / account / create /)。我怎样才能做到这一点? 有没有办法进入商店的文件(例如隐藏这些字段)?
答案 0 :(得分:3)
不知怎的,我得到了它的工作。这是我想要的,我请求你尝试并检查它是否解决了这个问题。
customer/address/middlename_show
。customer/address/middlename_show
的修改值字段,并将其更改为 1 。通常,默认情况下为0(零)。答案 1 :(得分:2)
您应该更新数据库中的某些字段。
例如。我需要从注册表中删除姓氏。这是一个需要的领域。 所以我用sql update文件创建了自己的模块来改变字段参数:
<强>升级-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();
之后你应该使用html + css或js
隐藏这个字段<强>更新强>
编辑文件 /app/design/frontend/default/YOURTHEME/template/customer/widget/name.phtml 以更改您的注册表单。在我的情况下,我在那里评论了html块:
<?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>-->
您还可以向<div class="field name-middlename">
和<div class="field name-lastname">
添加一些课程。该类应具有css属性"display:none;"
。