manudas Posted June 9, 2014 Share Posted June 9, 2014 Hi all. I need some help or inspiration. I´m making a module for my boss. We want to modify the prices depeding on the destination of the order. For the module I´m using some tabs, and into the tab class I´m using the next code to declare the form to pass the data directly to database: public function renderForm(){ if (Tools::isSubmit('add'.$this->table)){ $this->fields_form =... ... } } In the constructor of this class I declare primary key of my mysql table this way: $this->identifier = "ID_RATE"; //the primary key The problem now, that I have not seen in Canvas example module that we can find in this forum and in internet, is that a hidden input appears. This is the html code of the input: <input type="hidden" name="ID_RATE" id="ID_RATE" value="255"> I can confirm that if I modify in the constructor the identifier param, in the input it gets modified too. The value of the input (255) is the id of the tab into ps_tab table. So, if I try to get the value of other input with a name of ID_RATE (like I do) for saving a new rate or modifing an existing one, the system always take this input as the source of this data, making all the process to fail. Today it started to happend this to me, yesterday it was working fine, I don´t know what I did to break this. Why is this happening to me and not to canvas module, for example ? I´m going to upload the full alpha version in developing right now for the people who wants to take a look at this. If you want to compare, I´m going to upload the example canvas module also. Thanks you very much in advance. Please fell free to ask everythin you want about this. modules.zip Link to comment Share on other sites More sharing options...
manudas Posted June 9, 2014 Author Share Posted June 9, 2014 I would like to add that the tpl template that generates this behaviour is in rootdir\admindir\themes\default\template\helpers\form and It´s form.tpl. Just in line 33-34-35: <form id="{if isset($fields.form.form.id_form)}{$fields.form.form.id_form|escape:'htmlall':'UTF-8'}{else}{if $table == null}configuration_form{else}{$table}_form{/if}{/if}" class="defaultForm {$name_controller}" action="{$current}&{if !empty($submit_action)}{$submit_action}=1{/if}&token={$token}" method="post" enctype="multipart/form-data" {if isset($style)}style="{$style}"{/if}> {if $form_id} <input type="hidden" name="{$identifier}" id="{$identifier}" value="{$form_id}" /> {/if} Link to comment Share on other sites More sharing options...
manudas Posted June 9, 2014 Author Share Posted June 9, 2014 Maybe should I do some kind of helper form without associating it to a adminTab ? But then, why was it working till today ? Please help! Link to comment Share on other sites More sharing options...
manudas Posted June 9, 2014 Author Share Posted June 9, 2014 Solved: $this->classname inside my controller was the same name of the class that belongs the attribute (ratecontroller...), but it should be the name of the class that have the objetcModel::definition (ratedata.php) 1 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