2013-02-23 47 views

回答

2

您应该更新数据库中的一些字段。

例如。我需要从注册表中删除姓氏。这是一个需要考虑的领域。 因此,我创建自己的模块与SQL更新文件,以更改场参数:

升级,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

UPDATE:

编辑文件/应用程序/设计/前端/默认/ YOURTHEME /模板/客户/ widge t/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;"

+0

谢谢!以及它将如何成为html + css的一部分? – 2013-02-24 10:24:28

+0

我更新了我的答案 – Anthony 2013-02-24 12:27:14

+0

感谢您的帮助。 – 2013-02-24 15:54:35

3

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

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