Magento 1.7 - 删除/ customer / account / create /中注册的字段

时间:2013-02-23 20:58:32

标签: magento magento-1.7

我想从注册中删除字段(/ customer / account / create /)。我怎样才能做到这一点? 有没有办法进入商店的文件(例如隐藏这些字段)?

2 个答案:

答案 0 :(得分:3)

不知怎的,我得到了它的工作。这是我想要的,我请求你尝试并检查它是否解决了这个问题。

  1. 打开Magento DB并转到表core_config_data。
  2. 搜索路径 - customer/address/middlename_show
  3. customer/address/middlename_show的修改值字段,并将其更改为 1 。通常,默认情况下为0(零)。
  4. 保存表格。
  5. 清除缓存。最好删除var文件夹中存在的文件夹Cache和Session。
  6. 登录Magento admin并转到以下位置: 系统 - >配置 - >客户 - >客户配置
  7. 在“名称和地址选项”标签下,现在“显示中间名(首字母)”的选项将显示为“是”。
  8. 将其更改为“否”。
  9. 保存配置并清除缓存。

答案 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;"

相关问题