2015-02-05 2 views
1

У меня проблема, как в главных вопросах. Это мой код:Magento: Как изменить 3 ввода для даты рождения до 1 входной даты рождения. Формат даты 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 входа, но он хочет быть один и сохранить базовую дату рождения?. У тебя есть идеи?

ответ

1

Перейти к приложению/дизайн/интерфейс/your_package/your_theme/шаблон/клиент/виджет

Ваш 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 
Смежные вопросы