马根托:如何将出生日期的3个输入更改为出生日期的1个输入.格式化日期dd/mm/yyy


Magento: How change 3 input for date of birth to 1 input date of birth. Format date dd/mm/yyy

我有一个问题,就像前面的问题一样。这是我的代码:

<?php
$this->setDateInput('d',
    '<div class="dob-day">
         <input type="text" id="' . $this->getFieldId('day') . '" name="' . $this->getFieldName('day') . '" value="' . $this->getDay() . '" title="' . $this->__('Day') . '" class="input-text validate-custom" ' . $this->getFieldParams() . ' />
         <label for="' . $this->getFieldId('day') . '">' . $this->__('DD') . '</label>
     </div>'
);
$this->setDateInput('m',
    '<div class="dob-month">
         <input type="text" id="' . $this->getFieldId('month') . '" name="' . $this->getFieldName('month') . '" value="' . $this->getMonth()  . '" title="' . $this->__('Month')  . '" class="input-text validate-custom" ' . $this->getFieldParams()  . ' />
         <label for="' . $this->getFieldId('month') . '">' . $this->__('MM')  . '</label>
     </div>'
);
$this->setDateInput('y',
    '<div class="dob-year">
         <input type="text" id="' . $this->getFieldId('year') . '" name="' . $this->getFieldName('year') . '" value="' . $this->getYear()  . '" title="' . $this->__('Year')  . '" class="input-text validate-custom" ' . $this->getFieldParams()  . ' />
         <label for="' . $this->getFieldId('year') . '">' . $this->__('YYYY')  . '</label>
     </div>'
);

?>

我有3个输入,但他想成为一个并保存基本出生日期。你有什么想法吗?

转到app/design/frontend/your_package/your_theme/template/customer/widget

你的dob.html将看起来像这个

<label for="<?php echo $this->getFieldId('month')?>" class="required"><em>*</em><?php echo $this->__('Date of Birth') ?></label>
<div class="input-box customer-dob">
<?php
    if($this->getMonth()=="" || $this->getDay()=="" || $this->getYear()=="")
    {
      $dob = "";?>
      <div class="dob-full">
        <input type="text" class="datepicker input-text required-entry" id="<?php echo $this->getFieldId('dob')?>" name="<?php echo $this->getFieldName('dob')?>" />
    </div>
    <?php } 
    else
    {
      $dob = $this->getMonth()."/".$this->getDay()."/".$this->getYear();?>
      <div class="dob-full">
        <input type="text" class="input-text required-entry" value="<?php echo $dob ?>" id="<?php echo $this->getFieldId('dob')?>" name="<?php echo $this->getFieldName('dob')?>" disabled />
    </div>
    <?php }
?>
    <?php //echo $this->getSortedDateInputs() ?>
    <div class="validation-advice" style="display:none;"></div>
</div>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<script type="text/javascript">
//<![CDATA[
    //var customer_dob = new Varien.DOB('.customer-dob', true, '<?php echo $this->getDateFormat() ?>');
//]]>
jQuery(document).ready(function($){
  $( ".datepicker" ).datepicker({
      dateFormat: "m/d/yy",
      changeMonth: true,
      changeYear: true,
      yearRange: '1910:2014'
    });
})
</script>

Note : Please include ui css and js inside your local.xml