Php Magento:如何将3个输入的出生日期更改为1个输入的出生日期。格式日期:年月日

Php Magento:如何将3个输入的出生日期更改为1个输入的出生日期。格式日期:年月日,php,magento,date,Php,Magento,Date,我有一个问题,就像上面的问题一样。 这是我的代码: <?php $this->setDateInput('d', '<div class="dob-day"> <input type="text" id="' . $this->getFieldId('day') . '" name="' . $this->getFieldName('day') . '" value="' . $this->getDay() . '" ti

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

<?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>'
);

进入app/design/frontend/your_-package/your_-theme/template/customer/widget

您的dob.phtml将如下所示

<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