PDA

View Full Version : Contact form at the bottom of listing detail page



Andreas_M
November 23, 2012, 11:23 PM
Hello,



I would like to show the contact owner form at the bottom of listing detail pages and I also need a checkbox before sending the message, like I accept the terms of use and privacy policy.

Do anyone have this solution?

Would it also be possible to put more contact owner buttons into the detail pages / between the field groups?
I tried to copy the code, but every time just one of these buttons was working.




Thanks & best regards
Andreas

Vladimir
November 29, 2012, 10:47 AM
Hello,

I suggest that you make it the following way:

1.
- open file: libs/javascript/flynax.lib.js
- find this code:



this.contactOwnerSubmit = function(obj, listing_id) {
xajax_contactOwner($('#contact_name').val(), $('#contact_email').val(), $('#contact_phone').val(), $('#contact_owner_message').val(), $('#contact_code_security_code').val(), listing_id);
$(obj).val(lang['loading']);
};


and replace it by:



this.contactOwnerSubmit = function(obj, listing_id, prefix = '') {
xajax_contactOwner($('#' + prefix + 'contact_name').val(), $('#' + prefix + 'contact_email').val(), $('#' + prefix + 'contact_phone').val(), $('#' + prefix + 'contact_owner_message').val(), $('#' + prefix + 'contact_code_security_code').val(), listing_id);
$(obj).val(lang['loading']);
};


2.
- open file: templates/your_template/tpl/controllers/listing_details.tpl
- find this code:



<form name="contact_owner" onsubmit="flynax.contactOwnerSubmit($(this).find('input[type=submit]'), {$listing_data.ID});return false;" method="post" action="">


and replace it by:



<form name="contact_owner" onsubmit="flynax.contactOwnerSubmit($(this).find('input[type=submit]'), {$listing_data.ID}, 'f1_');return false;" method="post" action="">


("f1_" - it is the prefix of first form)

- after then you should to change IDs of html fields.

For example:

-- find this code: id="contact_owner_message" and change it to: id="f1_contact_owner_message".

3.
- Can you please do the things described in point 2 for the second contact form.

Andreas_M
December 2, 2012, 09:16 PM
Hello Vladimir,

thanks for your help.
I had no time at the weekend, will try it next days and come back with the result.

Hareesh Ghanta
September 30, 2013, 12:21 AM
Hi Viktor,
I tried but its not working.May be I did not understand clearly.I change in java script and listing detail files.
Can you please provide complete instructions.

Viktor
September 30, 2013, 03:18 AM
Hello All,

I don't know what Vladimir show the code but he didn't show how to move contact form to listing details tab,

Contact form code you can ind in listing_details.tpl file:


<!-- contact owner form template -->
<div id="contact_owner_form">
<div class="caption">{$lang.contact_owner}</div>

<form name="contact_owner" onsubmit="flynax.contactOwnerSubmit($(this).find('input[type=submit]'), {$listing_data.ID});return false;" method="post" action="">
<table class="submit_modal">
{if $isLogin}
<tr>
<td colspan="2">
<div>{$lang.message} <span class="red">*</span></div>
<textarea id="contact_owner_message" rows="6" cols="" style="width: 97%;"></textarea>
</td>
</tr>
{else}
<tr>
<td class="name">{$lang.name} <span class="red">*</span></td>
<td class="field"><input type="text" id="contact_name" value="{$account_info.First_name} {$account_info.Last_name}" /></td>
</tr>
<tr>
<td class="name">{$lang.mail} <span class="red">*</span></td>
<td class="field"><input type="text" id="contact_email" value="{$account_info.Mail}" /></td>
</tr>
<tr>
<td class="name">{$lang.contact_phone}</td>
<td class="field"><input type="text" id="contact_phone" /></td>
</tr>
<tr>
<td class="name" colspan="2">
<div>{$lang.message} <span class="red">*</span></div>
<textarea id="contact_owner_message" rows="6" cols="" style="width: 97%;"></textarea>
</td>
</tr>
<tr>
<td colspan="2">{include file='captcha.tpl' captcha_id='contact_code' no_wordwrap=true}</td>
</tr>
{/if}
<tr>
<td colspan="2" {if !$isLogin}class="button"{/if}>
<input type="submit" name="finish" value="{$lang.send}" />
<input type="button" name="close" value="{$lang.cancel}" />
</td>
</tr>
</table>
</form>
</div>
<!-- contact owner form template end -->

then find comment
<!-- listing stat data end --> and insert it form above this comment.

Hareesh Ghanta
September 30, 2013, 03:36 AM
You are awesome.It worked.Thank you

Nguyen Dat tai
September 30, 2013, 03:39 AM
cool
Thanks,
Nguyen

Viktor
September 30, 2013, 05:06 AM
But I didn't understand what Vladimir shows the code?

What should do the code?

Vladimir I demand explanation from you.

Sui soon Chua
October 1, 2013, 04:43 PM
Hi,

Thanks for the code. Great.

Bert

Petrache Nicolae
November 11, 2013, 02:39 PM
thanks for sharing this Viktor

Nguyen Dat tai
November 11, 2013, 09:19 PM
Hi Andreas_M,

Can u PM me your site.
I want to see your work.

Thanks,
Nguyen
Hello,



I would like to show the contact owner form at the bottom of listing detail pages and I also need a checkbox before sending the message, like I accept the terms of use and privacy policy.

Do anyone have this solution?

Would it also be possible to put more contact owner buttons into the detail pages / between the field groups?
I tried to copy the code, but every time just one of these buttons was working.




Thanks & best regards
Andreas

Petrache Nicolae
December 1, 2013, 10:08 PM
Hello All,

I don't know what Vladimir show the code but he didn't show how to move contact form to listing details tab,

Contact form code you can ind in listing_details.tpl file:


<!-- contact owner form template -->
<div id="contact_owner_form">
<div class="caption">{$lang.contact_owner}</div>

<form name="contact_owner" onsubmit="flynax.contactOwnerSubmit($(this).find('input[type=submit]'), {$listing_data.ID});return false;" method="post" action="">
<table class="submit_modal">
{if $isLogin}
<tr>
<td colspan="2">
<div>{$lang.message} <span class="red">*</span></div>
<textarea id="contact_owner_message" rows="6" cols="" style="width: 97%;"></textarea>
</td>
</tr>
{else}
<tr>
<td class="name">{$lang.name} <span class="red">*</span></td>
<td class="field"><input type="text" id="contact_name" value="{$account_info.First_name} {$account_info.Last_name}" /></td>
</tr>
<tr>
<td class="name">{$lang.mail} <span class="red">*</span></td>
<td class="field"><input type="text" id="contact_email" value="{$account_info.Mail}" /></td>
</tr>
<tr>
<td class="name">{$lang.contact_phone}</td>
<td class="field"><input type="text" id="contact_phone" /></td>
</tr>
<tr>
<td class="name" colspan="2">
<div>{$lang.message} <span class="red">*</span></div>
<textarea id="contact_owner_message" rows="6" cols="" style="width: 97%;"></textarea>
</td>
</tr>
<tr>
<td colspan="2">{include file='captcha.tpl' captcha_id='contact_code' no_wordwrap=true}</td>
</tr>
{/if}
<tr>
<td colspan="2" {if !$isLogin}class="button"{/if}>
<input type="submit" name="finish" value="{$lang.send}" />
<input type="button" name="close" value="{$lang.cancel}" />
</td>
</tr>
</table>
</form>
</div>
<!-- contact owner form template end -->

then find comment
<!-- listing stat data end --> and insert it form above this comment.

Hello Viktor. If i try to use the usual button of contact wich opens the popup window and in adition add your code, both areas will stop working. any ideea how to overcome this?

the words counter dissapears and than, random i get message that i must fill in the text even if i filled in the message. if i remove your code and leave just the regular contact button, the contact button and popup box works ok. thanks

Viktor
December 2, 2013, 04:49 AM
Hello Petrache Nicolae,

Please add this code and write me in PM I will show it on your site and may be fix it :)

Beau
December 6, 2013, 11:09 PM
How can I add the contact form as another tab on the listings page??

Mahmoud Khedr
July 22, 2015, 08:17 AM
thank you for the code