Hi,
The
@$_SERVER['HTTP_REFERER']
in the recaptcha2.php file is not being used as the _checkCaptcha function is called with the $redirect parameter being false in the onBeforeSendContactRequest function triggered by the product controller's send_email function.
In the case of HikaShop's contact form, when the captcha is invalid, the send_email task will just as for the display of the form on the redirected page.
I think what's missing is adding the current Itemid to the URL of the contact form in order to stay on the same menu item and thus not loose the link with the modules.
To do that, add the code:
<?php
global $Itemid;
$this->url_itemid='';
if(!empty($Itemid)){
$this->url_itemid='&Itemid='.$Itemid;
}
?>
at the beginning of the product / contact.php view file via the menu Display>Views.
And then change the line:
<form action="<?php echo hikashop_completeLink('product'); ?>" id="hikashop_contact_form" name="hikashop_contact_form" method="post" onsubmit="return checkFields();">
to:
<form action="<?php echo hikashop_completeLink('product&task=contact&cid='.hikaInput::get()->getInt('cid').$this->url_itemid); ?>" id="hikashop_contact_form" name="hikashop_contact_form" method="post" onsubmit="return checkFields();">
there.
It should then work like you want.