KServices Posted January 16, 2018 Share Posted January 16, 2018 (edited) Hello, I need help in the development of my module, i followed this pretty useful tutorial 'http://nemops.com/prestashop-products-new-tabs-fields/#.Wl3gVKjiaM8', to add a new tab in the products back office But i don't know where execute my sql function when click on 'save and stay' button My tpl <div class="form-group"> <input name="configurator_shipping" type="number" step="0.01"> <label for="configurator_shipping">Frais de port</label> <div class="panel-footer {if version_compare($smarty.const._PS_VERSION_,'1.6','<')}margin-form{/if}"> <button class="button btn btn-default" id="cancelConfiguratorProduct" name="cancelConfiguratorProduct" type="submit"><i class="process-icon-save"></i> {l s='Cancel' mod='configurator'}</button> <button class="button btn btn-default pull-right" id="submitConfiguratorProduct" name="submitAddproduct" type="submit"><i class="process-icon-save"></i> {l s='Save' mod='configurator'}</button> </div> </div> And in my module PHP public function hookDisplayAdminProductsExtra($params) { $this->smarty->assign(array('product' => $product)); return $this->display(__FILE__, 'product-extra.tpl'); } am trying to catch the click event with the hookActionProductSave And hookActionProductUpdate But these function aren't executed. So where can i find my posted values ? Does someone have an idea ? Edited January 16, 2018 by KServices (see edit history) Link to comment Share on other sites More sharing options...
ENS Enterprises Posted January 16, 2018 Share Posted January 16, 2018 Please follow the tutorial properly. you will have the answer. newfieldstut.php: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 public function hookActionProductUpdate($params) { // get all languages // for each of them, store the new field $id_product = (int)Tools::getValue('id_product'); $languages = Language::getLanguages(true); foreach ($languages as $lang) { if(!Db::getInstance()->update('product_lang', array('custom_field'=> pSQL(Tools::getValue('custom_field_'.$lang['id_lang']))) ,'id_lang = ' . $lang['id_lang'] .' AND id_product = ' .$id_product )) $this->context->controller->_errors[] = Tools::displayError('Error: ').mysql_error(); } } Link to comment Share on other sites More sharing options...
KServices Posted January 16, 2018 Author Share Posted January 16, 2018 (edited) /** * hookActionProductUpdate * * Product Update * **/ public function hookActionProductUpdate($params) { $id_product = (int)Tools::getValue('id_product'); var_dump(Tools::getValue('configurator_shipping')); die(); } This function is already in my newfieldstut.php but i don't understand why it is never called. Edited January 16, 2018 by KServices (see edit history) Link to comment Share on other sites More sharing options...
KServices Posted January 18, 2018 Author Share Posted January 18, 2018 Up ! I found a way to get around my problem with an ajax request but i don't like this solution. Why my hookActionProductupdate is never called ? 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