magento 出生日期下拉框 customer dob
来源:互联网 发布:windows 7库 快捷方式 编辑:程序博客网 时间:2024/06/10 06:15
magento 出生日期下拉框
template/customer/widget dob.phtml
<label for="<?php echo $this->getFieldId('month')?>"<?php if ($this->isRequired()) echo ' class="required"' ?>><?php if ($this->isRequired()) echo '<em>*</em>' ?><?php echo $this->__('Date of Birth') ?></label><div class="input-box customer-dob"><?php// daysecho "<select id=\"sDay\" name=\"sDay\" rel=\"".str_replace(":","\:",$this->getFieldId('day'))."\" class=\"dateselect\">";$selected = (!$this->getDay()) ? "selected=\"selected\"" : "";echo "<option value=\"\" ".$selected.">Day</option>";for ($i = 1; $i <= 31; $i++) {$ti = str_pad($i, 2, "0", STR_PAD_LEFT);$selected = ($this->getDay() == $ti) ? "selected=\"selected\"" : "";echo "<option value=\"".$ti."\" ".$selected.">".$i."</option>";}echo "</select>";?><?php// months$months = array('01'=>'一月','02'=>'二月','03'=>'March','04'=>'April','05'=>'May','06'=>'June','07'=>'July','08'=>'August','09'=>'September','10'=>'October','11'=>'November','12'=>'December',);echo "<select id=\"sMonth\" name=\"sMonth\" rel=\"".str_replace(":","\:",$this->getFieldId('month'))."\" class=\"dateselect\">";$selected = (!$this->getMonth()) ? "selected=\"selected\"" : "";echo "<option value=\"\" ".$selected.">Month</option>";foreach ($months as $key=>$var){$selected = ($this->getMonth() == $key) ? "selected=\"selected\"" : "";echo "<option value=\"".$key."\" ".$selected.">".$var."</option>";}echo "</select>";?><?php// years$year_end = date('Y');$year_start = $year_end-99;echo "<select id=\"sYear\" name=\"sYear\" rel=\"".str_replace(":","\:",$this->getFieldId('year'))."\" class=\"dateselect\">";$selected = (!$this->getYear()) ? "selected=\"selected\"" : "";echo "<option value=\"\" ".$selected.">Year</option>";for ($i = $year_end; $i >= $year_start; $i--) {$selected = ($this->getYear() == $i) ? "selected=\"selected\"" : "";echo "<option value=\"".$i."\" ".$selected.">".$i."</option>";}echo "</select>";?><div class="input-box customer-dob"><div class="dob-full" style="display:none;"><?php echo ' <div class="dob-day"><input type="hidden" 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>';?><?php echo '<div class="dob-month"><input type="hidden" 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>'; ?><?php echo '<div class="dob-year"><input type="hidden" 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>';?><div class="validation-advice" style="display:none;"></div></div><div class="dob-full" style="display:none;"><input type="hidden" id="<?php echo $this->getFieldId('dob')?>" name="<?php echo $this->getFieldName('dob')?>" /></div><script type="text/javascript">//<![CDATA[var customer_dob = new Varien.DOB('.customer-dob', <?php echo $this->isRequired() ? 'true' : 'false' ?>, '<?php echo $this->getDateFormat() ?>');jQuery(document).ready(function() {//加载到hidden input值jQuery( ".dateselect" ).each(function() {related_field_id = jQuery(this).attr('rel');current_value = jQuery( "#"+related_field_id ).val();jQuery(this).val(current_value);});jQuery( "#<?php echo str_replace(":","\:",$this->getFieldId('dob'));?>" ).val(jQuery("#<?php echo str_replace(":","\:",$this->getFieldId('year'));?>").val()+'-'+jQuery("#<?php echo str_replace(":","\:",$this->getFieldId('month'));?>").val()+'-'+jQuery("#<?php echo str_replace(":","\:",$this->getFieldId('day'));?>").val());// 给dob赋值jQuery( ".dateselect" ).change(function() {current_value = jQuery(this).val();related_field_id = jQuery(this).attr('rel');jQuery( "#"+related_field_id ).val(current_value);jQuery( "#<?php echo str_replace(":","\:",$this->getFieldId('dob'));?>" ).val(jQuery("#<?php echo str_replace(":","\:",$this->getFieldId('year'));?>").val()+'-'+jQuery("#<?php echo str_replace(":","\:",$this->getFieldId('month'));?>").val()+'-'+jQuery("#<?php echo str_replace(":","\:",$this->getFieldId('day'));?>").val());});});//]]></script>
0 0
- magento 出生日期下拉框 customer dob
- [原创]Magento customer eav属性静态化
- magento 添加customer attribute的方法
- Magento 给用户customer ,添加一个属性
- 纯JS实现出生日期[年月日]下拉菜单
- 出生日期
- MAGENTO客户组自动转换插件 - CUSTOMER GROUP SWITCHER
- 修复 Magento Title 全变成 Customer Login 一例
- magento去除页面底部 “About us” and “Customer Service”链接
- Magento客户组自动转换插件 - Customer Group Switcher
- 使用customer.update 方法 ,magento 1.7.0.2 soap api bug
- Magento customer get by other attribute such as telephone
- magento 设置order start id 和 customer start id
- magento 给customer添加属性 给order添加属性
- Customer
- magento -- 下拉框时获取产品的属性值
- android自定义出生日期输入框
- magento 产品详细页面的下拉框,下拉条,改成点击方式,从数据库中提取下拉框中的信息
- 引用计数和AddRef、Release
- Extjs动态显示列/隐藏列
- Java 线程面试问题
- js中回调函数的学习笔记
- Hibernate的加载抓取方式:Failed to lazily initialize a collection - no session
- magento 出生日期下拉框 customer dob
- AFN框架实现简单的网络状态监测以及支持https安全证书
- Genymotion升完win10后无法打开
- VMWare安装CentOS图文教程
- <STL系列> 配置器
- android模拟器,Genymotion问题:Unable to start the virtual device.
- HDU 4029 Distinct Sub-matrix(哈希+后缀数组)
- 【Unity】 DoTween对UI进行DoFade操作存在问题及解决办法
- 顺序容器--字符串操作