Jump to content

Form in tpl of hook


NeedZoom

Recommended Posts

Hi,

I have create a module that display tpl ( hook) with static data.

I want to add a input in this tpl and save the data in db when the client click a btn submit.

I have sreach in internet but i dont find a module with form in tpl

Link to comment
Share on other sites

where i can write in my module.php the "if (Tools::isSubmit('submitMyBtn')) {.....}" when the client clicked the btn in fond.tpl ?

 

like in module newsletters  :

 if (Tools::isSubmit('submitNewsletter')) {$this->newsletterRegistration();           

Edited by NeedZoom (see edit history)
Link to comment
Share on other sites

thanks,

how can know the id of the cart?

for the id of the customer:

in my module :

global $smarty;
        $id_customer = null;
        if ($this->context->customer->isLogged()) {
            // code to execute if i am logued
             $id_customer = $this->context->customer->id;
        }

for the product :

in the theme : {hook h='displayMaperso' product=$product}

in my module :

if (!isset($params['product'])) {
            return;
        }
 $product = $params['product'];
 $id_prod =(int) $product['id_product'];
 $this->context->smarty->assign(array('id_prod' => $id_prod));
return $this->display(__FILE__, 'maperso.tpl');

Edited by NeedZoom (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...