nhelliwell Posted July 1, 2014 Share Posted July 1, 2014 Anyone know if the <input type="time"> is supported when defining the admin form for a custom module? It doesn't seem to render when I set it, even though documentation suggests it should be supported. $this->fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Order Processing Cut-Off Time'), ), 'input' => array( array( 'type' => 'time', 'label' => $this->l('Daily Order Cut-Off Time:'), 'desc' => $this->l('Set the time orders will be accepted for current day'), 'name' => 'prodman_pcutoff', 'required' => true ) ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button' ) ); Cheers Link to comment Share on other sites More sharing options...
loulou66 Posted July 1, 2014 Share Posted July 1, 2014 Hi try 'type' =>'datetime', i dont see event for time in helper.php and form.tpl @++ Loulou66 Link to comment Share on other sites More sharing options...
nhelliwell Posted July 1, 2014 Author Share Posted July 1, 2014 Hi, Yep, just been playing with that. I can get a time only selector to render but documentation not clear on how I should override this correctly. {extends file="helpers/form/form.tpl"} {block name="script"} if ($(".timepicker").length > 0) $('.timepicker').timepicker({ prevText: '', nextText: '', dateFormat: 'yy-mm-dd', // Define a custom regional settings in order to use PrestaShop translation tools currentText: '{l s='Now'}', closeText: '{l s='Done'}', ampm: false, amNames: ['AM', 'A'], pmNames: ['PM', 'P'], timeFormat: 'hh:mm:ss tt', timeSuffix: '', timeOnlyTitle: '{l s='Choose Time' js=1}', timeText: '{l s='Time' js=1}', hourText: '{l s='Hour' js=1}', minuteText: '{l s='Minute' js=1}', }); {/block} Link to comment Share on other sites More sharing options...
loulou66 Posted July 2, 2014 Share Posted July 2, 2014 Hi I found a solution in fuction GetContent add $this->context->controller->addJqueryUI('ui.datepicker'); in you form add array( 'type' => 'datetime', 'label' => $this->l('Test time'), 'name' => 'test_time', 'desc' => $this->l('enter the time you want') ), **test_time is a column with time format in table in you sql in your objetmodel add (your_moduleClass.php) /** @var string test_time*/ public $test_time; and in $definition array 'test_time' => array('type' => self::TYPE_DATETIME, 'validate' => 'isPhpDateFormat'), in the file module\your_module\views\templates\admin\_configure\helpers\form extends file="helpers/form/form.tpl"} { {block name="input"} {if $input.type == 'time'} <div class="row"> <div class="input-group col-lg-4"> <input id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}" type="text" data-hex="true" {if isset($input.class)}class="{$input.class}" {else}class="timepicker"{/if} name="{$input.name}" value="{$fields_value[$input.name]|escape:'html':'UTF-8'}" /> <span class="input-group-addon"> <i class="icon-calendar-empty"></i> </span> </div> </div> {else} {$smarty.block.parent} {/if} {/block} {block name="script"} if ($(".timepicker").length > 0) $(".timepicker").timepicker({ pickDate: false }); </script> {/block} tested on my 1.6 local server @++ Loulou66 1 Link to comment Share on other sites More sharing options...
loulou66 Posted July 2, 2014 Share Posted July 2, 2014 Hi you can change the icon in form.tpl replace <i class="icon-calendar-empty"></i> by <i class="icon-time"></i> @++ Loulou66 Link to comment Share on other sites More sharing options...
nhelliwell Posted July 2, 2014 Author Share Posted July 2, 2014 Nice! That works like a charm. Link to comment Share on other sites More sharing options...
goutham7p Posted July 14, 2014 Share Posted July 14, 2014 Can you please share the created module please? Link to comment Share on other sites More sharing options...
nhelliwell Posted July 14, 2014 Author Share Posted July 14, 2014 here you go. this should display the time only selector in the back office. Install and hit configure. timeselectorexample.zip Link to comment Share on other sites More sharing options...
goutham7p Posted July 15, 2014 Share Posted July 15, 2014 Thank You So Much nhelliwell Link to comment Share on other sites More sharing options...
Recommended Posts