cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a contact form to a static block on product pages

Adding a contact form to a static block on product pages

Hi All.

 

I am trying to implement a contact form within a static block on products pages. When the form is submitted it redirects you to the Cart page of the site.

 

I understand why it is happening, however I cannot find a clear route to resolve this.

 

Here is an example on our dev site. http://dev.towelsrus.co.uk/wholesale/branded-merchandise-towels/jacquard-woven-border-towels.html

 

Any help would be much appreciated to resolve this.

1 REPLY

Re: Adding a contact form to a static block on product pages

It should not be within <div class="product-essential"> because inside it you have a form for adding to cart. You have two options here:

 - To move out contact form outside of <div class="product-essential"> and adjust it via CSS for different viewports and devices

 - To implement javascript solution which will took all details from field and send it asynchronously via ajax, something like:

<script type="text/javascript">
function callAjax() {
jQuery.ajax({
    type: "POST",
    url: "<?php echo Mage::getUrl('contacts/index/post') ?>",
    dataType: "json",
    data: {email: mail},
    success: function (exists) {
        if (exists == 0) {
            // js for fail, hide disable button etc etc
        } else if (exists == 1) {
            // js for success bits
        }
    },
    error: function (jqXHR, textStatus, errorThrown) {
                   // error handling
    }
});

}
</script>

And just add event observer "onclick" for Submit button in order to start processing.
If this response was helpful to you, consider giving kudos to this post.
If this response solved your problem, click accept as solution to help others solve this issue