be_tnt Posted January 30, 2013 Share Posted January 30, 2013 (edited) Hello! I have added an helper form on my module configuration page. This form has a field with type = "file": array( 'type' => 'file', 'label' => $this->l('Select a file:'), 'desc' => $this->l('Banner picture. Extension allowed: jpeg, png, jpg, gif.'), 'name' => 'banner_image', 'required' => true, 'lang' => false, 'display_image' => true, ), The display_image allows to display the image for an existing element (information about this image is located in fields_value array). My problem is that the helper form.tpl add a delete link below the picture and in my case, it does not work: {elseif $input.type == 'file'} {if isset($input.display_image) && $input.display_image} {if isset($fields_value.image) && $fields_value.image} <div id="image"> {$fields_value.image} <p align="center">{l s='File size'} {$fields_value.size}kb</p> <a href="{$current}&{$identifier}={$form_id}&token={$token}&deleteImage=1"> <img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'} </a> </div><br /> {/if} {/if} <input type="file" name="{$input.name}" {if isset($input.id)}id="{$input.id}"{/if} /> {if !empty($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if} I do not see what should be {$identifier}={$form_id}, how to set those variables and what is the different call made when you click on the delete. Any idea? Edited February 1, 2013 by be_tnt (see edit history) 1 Link to comment Share on other sites More sharing options...
be_tnt Posted February 1, 2013 Author Share Posted February 1, 2013 I resolved my issue by creating my own file input type for my module. FYI: to override the form.tpl in your module, you have to create your form.tpl in the following folder: \modules\{your module name}\views\templates\admin\_configure\helpers\form 1 Link to comment Share on other sites More sharing options...
sttaq Posted June 2, 2014 Share Posted June 2, 2014 (edited) I resolved my issue by creating my own file input type for my module. FYI: to override the form.tpl in your module, you have to create your form.tpl in the following folder: \modules\{your module name}\views\templates\admin\_configure\helpers\form Hi just hit this old post and wonder if you can help me. I am trying to override form tpl in my module just as you but my override is not working if I place in the above directory. I am using PS 1.5.6. However, I have discovered that if I manually copy my overriden form.tpl to admin\themes\default\template\controllers\my_custom\helpers\form\ folder then my override is loaded. Also, for the above path to work my back office module controller must be named as AdminMyCustomController.php. In the controller, I am using the default renderForm method. I would appreciate if you can point me to exactly what I need to do in order to properly override form.tpl from my module's custom admin controller. Thanks Edited June 2, 2014 by sttaq (see edit history) Link to comment Share on other sites More sharing options...
megamurmulis Posted December 8, 2014 Share Posted December 8, 2014 (edited) I am trying to override form tpl in my module just as you but my override is not working if I place in the above directory. Make sure you have set this line in Helper loader: $helper = new HelperForm(); $helper->module = $this; .. return $helper->generateForm($form); Without module line - overrides aren't loaded at all. Spent hours debugging myself.... (Should be right away, but i normally do uninstall and reinstall for the module too) Edited December 8, 2014 by megamurmulis (see edit history) 1 Link to comment Share on other sites More sharing options...
Hasher Posted March 5, 2015 Share Posted March 5, 2015 I resolved my issue by creating my own file input type for my module. FYI: to override the form.tpl in your module, you have to create your form.tpl in the following folder: \modules\{your module name}\views\templates\admin\_configure\helpers\form I did the same, the only difference is that in my case I need to override a file from helpers/list folder. But after reinstalling the module and clearing the cache nothing changed. Do I have to override that file in code manually also? Link to comment Share on other sites More sharing options...
Dev Franco Posted May 27, 2015 Share Posted May 27, 2015 Hi, I have two file input fields. array("type"=>"file","label"=>$this->l('Logo:'),"name"=>"logo","display_image"=>true,"col"=>6,"desc"=>$this->l('Upload seller logo from your computer')), array("type"=>"file","label"=>$this->l('Shop Image:'),"name"=>"shop_image","display_image"=>true,"col"=>6,"desc"=>$this->l('Upload shop image from your computer')) But in my form , the two file input fields are generating with same name as below. <input type="file" name="logo"> <input type="file" name="logo"> Please help me Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now