Question

The requirement is to add a feature that sends an email to the shop's address through a form. This is for visitors that wish to find out if they're eligible for a 5 euro bonus.

I've done a standalone script that fills in this requirements and the form appears as it should when I enter the full url. However, clicking on a link to the same url from a product description produces a 404.

Could this be due to url rewriting? Can the PHP page co-exist with Prestashop or should I write a barebones module of some sort to fit in?

Was it helpful?

Solution

I upvoted you after you revised the question to get you to -2. I hope this helps.

I am not familiar with Prestashop, but if it uses PHP which I believe it does because of your tags you can try a few things:

1 - you can add an event listener to the submit button. When the form submit button is pressed, the function will send an Ajax request to the server to send the email.

window.addEvent('load', function() {
    var foo = document.getElementById("bar");   
    foo.addEventListener("click", function_to_execute(), false);
}

The function_to_execute() will be called when the submit button is clicked.

You can add this code to the script where the form is, or if you don't want to hack Prestashop code you can prepend it to all scripts using php.ini. Just add:

auto_prepend_file = "/path/to/file/with/function.php"

I believe this might work. Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top