|
Im using AiContactSafe as a replacement contact form for the com_properties component, and have spent alot of time trying to get things just right, so I thought I would share what I have learned so far and what works for me:
To just open a form in a pop-up window this is the code I use, this code is modified in the details.php file of com_properties. You will have to locate the original code, and then replace it with what I publish here.
original code:
<?php
//if($ShowContactLink==1){
$statusC = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=1000,height=800,directories=no,location=no';
$rutaC= JURI::base().'index.php?option=com_properties&view=form1&tmpl=component&id='.$Product->id;
?>
<a href="javascript:void(0)" onclick="window.open('/<?php echo $rutaC ; ?>','win2','<?php echo $statusC; ?>');" title="<?php echo JText::_('Contact '); ?>"><?php //echo JText::_('Contact'); ?></a><br />
<?php //}?>
Modified code for popup:
<?php
//if($ShowContactLink==1){
$statusC = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=1000,height=800,directories=no,location=no';
$rutaC= JURI::base().'index.php?option=com_aicontactsafe&view=message&layout=message&pf=1&id='.$Product->id;
?>
<a href="javascript:void(0)" onclick="window.open('/<?php echo $rutaC ; ?>','win2','<?php echo $statusC; ?>');" title="<?php echo JText::_('Order or Book '); ?>"><?php //echo JText::_('Order or Book'); ?></a><br />
<?php //}?>
Okay, now.... I also wanted to have hidden fields in my form, that could be populated with things like the $Product->id and $Product->name, etc. It took me awhile to figure this out, because the examples I found, just did not work... here is the code I'm using that brings up a AiContactSafe form in the main body, not a popup, the form has hidden fields and is self populated, based on the current $Product->name
Below aics_aptname is the name of my hidden field and its being populated by the $Product->name
Just remove the original code and insert this in it's place:
<?php $CurrentUrl = $_SERVER['REQUEST_URI'] ;?>
<form name="aiContactSafeCall" id="aiContactSafeCall" action="<?php echo JURI::base(); ?>index.php?option=com_aicontactsafe&view=message&layout=message" method="post">
<a id="link_to_contact" onclick="javascript:document.aiContactSafeCall.submit();" title="<?php echo JText::_('Contact'); ?>"><?php echo JText::_('Contact'); ?></a>
<input type="hidden" name="pf" id="pf" value="1" />
<input type="hidden" name="dt" id="dt" value="1" />
<input type="hidden" name="aics_aptname" id="aics_aptname" value="<?php echo $Product->name ?>" />
<input type="hidden" name="return_to" id="return_to" value="<?php echo $CurrentUrl ?>" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
Hope this helps someone
|