Jump to content

Catch A New Form Submit And Send Email? Product Page


Recommended Posts

I´m trying to add a new function in Product Page, I have set a new option to show a form with Fancybox and then after submit take the details and send an email to admin.
 
This is the code added to product.tpl:
 
<script type="text/javascript">

    $(".fancybox").fancybox({
          openEffect  : 'fade',
          closeEffect : 'fade'
    });

function sentEmail()
{
    $.fancybox.close(true);
}
</script>
<button type="button" name="special_request" class="exclusive btn btn-inverse status-enable">
                <a href="#special_request" class="fancybox">Pedido especial</a>
            </button>

        <form id="special_request" class="form-basic" method="post" action="" enctype="multipart/form-data" style="display:none;height:400px;width:600px;">
            <div class="form-title-row">
                <h1> {$product->name|escape:'html':'UTF-8'} </h1>
            </div>
            <div class="form-row">
                <label>
                    <span>Nombre</span>
                    <input contextmenu="Prueba" placeholder="Indroduzca su nombre" type="text" name="name">
                </label>
            </div>
            <div class="form-row">
                <label>
                    <textarea id="comments" name="comentarios" placeholder="Escriba aquí su pedido especial" rows="4" cols="40"></textarea>
                </label>
            </div>
            <div class="form-row">
                <button type="button" name="enviar" onclick="sentEmail()">Enviar</button>
            </div>
        </form>

 

Someone can tell me the best choice to get the get the submit and then handle the sent of email to admin with the data entered?
 
Thanks
Edited by alex1389 (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Hello,

 

Have you found the solution?

I am trying to do something similar. A simple button that leads to a Bootstrap modal with a button to book the product.

I need that the button sends a mail to admin with First and last names and Product name.

Can't figure out how to use the Prestashop Send mail function. I have read about using Controllers... But I am a bit lost.

I managed to create the button, the modal...

 

Best regards,

 

Quentin

Link to comment
Share on other sites

Hello,

 

Have you found the solution?

I am trying to do something similar. A simple button that leads to a Bootstrap modal with a button to book the product.

I need that the button sends a mail to admin with First and last names and Product name.

Can't figure out how to use the Prestashop Send mail function. I have read about using Controllers... But I am a bit lost.

I managed to create the button, the modal...

 

Best regards,

 

Quentin

Hi,

 

You can use Form Builder Pro module.

The module allow you to create a form with product name (dynamic) and add to product details page. 

But only problem that you have to create modal popup by manually.

Link to comment
Share on other sites

Hi!

 

For the popup, Bootstrap is included so pretty simple to create.

Then I have created a custom .php files to handle the mail and send the information I needed. I don't know if it is the best solution (security...) but it works.

 

Best regards,

 

Quentin

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...