Hi,
Problem: Enabling reCaptcha on "Ask a Question" section
This is little complicated, so please do exactly what i say:
1 - First of all disable all the 3rd party plugins you have installed to activate the reCaptcha
2 - Open "plugin manager" and find this plugin:
Captcha - ReCaptcha
3 - fill out the 2 necessary fields by taking those credentials from here:
www.google.com/recaptcha/admin and enable the plugin.
4 - Navigate to
Joomla Backend >> Virtuemart Configuration >> Shop
5 - Enable this option:
Use ReCaptcha for recommendation and ask a question
6- Open this PHP file:
/templates/flexible_stylemart/html/com_virtuemart/productdetails/default_askquestionform.php
7- find these 2 lines (59th - 60th):
<div class="clearfix"> </div>
<div class="col-xs-12 col-sm-6 text-left nopadding">
and replace those lines with this:
<div class="clearfix"> </div>
<?php // captcha addition
if(VmConfig::get ('ask_captcha')){
JHTML::_('behavior.framework');
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onInit','dynamic_recaptcha_1');
?>
<div id="dynamic_recaptcha_1"></div>
<?php
}
// end of captcha addition
?>
<div class="col-xs-12 col-sm-6 text-left nopadding">
Basically include the PHP lines to activate the reCaptcha between 2 DIV elements
The result will be:
Attachment ScreenShot2014-09-06at9.29.48PM.png not found
To activate the reCaptcha on modal popup Ask a Question section:
8- open this php file:
/templates/flexible_stylemart/html/com_virtuemart/askquestion/form.php
9- find this line:
<textarea placeholder="<?php echo $ask_comment; ?>" title="<?php echo $ask_comment ?>" class="validate[required,minSize[<?php echo $min ?>],maxSize[<?php echo $max ?>]] askText" id="comment" name="comment" rows="10" cols="100"></textarea>
11- and replace it with this:
<textarea placeholder="<?php echo $ask_comment; ?>" title="<?php echo $ask_comment ?>" class="validate[required,minSize[<?php echo $min ?>],maxSize[<?php echo $max ?>]] askText" id="comment" name="comment" rows="10" cols="100"></textarea>
<?php // captcha addition
if(VmConfig::get ('ask_captcha')){
JHTML::_('behavior.framework');
JPluginHelper::importPlugin('captcha');
$dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onInit','dynamic_recaptcha_1');
?>
<div id="dynamic_recaptcha_1"></div>
<?php
}
// end of captcha addition
?><br>
12- open this PHP file:
/templates/flexible_stylemart/html/com_virtuemart/productdetails/default.php
(default.php or flexv2.php, depends on what ever layout you are currently using for product details page)
13- find these lines (445th - 449th):
<?php // Ask a question about this product
if (VmConfig::get('ask_question', 1) == 1 and ($params->get('productdetails_ask_link'))) { ?>
<div class="col-xs-12 col-sm-4 FlexibleAskQuestionElement nomargin"> <a class="ProductDetailsAskQuestion" href="<?php echo $url ?>" <?php if (!($parameter == "quicklook")) { ?>data-toggle="modal" data-target="#remoteModal" <?php } ?> ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a> </div>
<?php } ?>
and replace them with this:
<?php // Ask a question about this product
if (VmConfig::get('ask_question', 1) == 1 and ($params->get('productdetails_ask_link'))) { ?>
<div class="col-xs-12 col-sm-4 FlexibleAskQuestionElement nomargin">
<s-cript> jQuery(document).ready(function(){ jQuery('.fancybox2iframe').fancybox2({type: 'iframe'}); });</s-cript>
<a class="ProductDetailsAskQuestion <?php if (!($parameter == "quicklook")) { ?>fancybox2iframe<?php } ?>" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&tmpl=component&task=askquestion&virtuemart_product_id='.$this->product->virtuemart_product_id.'&virtuemart_category_id='.$this->product->virtuemart_category_id); ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a> </div>
<?php } ?>
In the above lines change s-cript with script (because script tag is not allowed in our forum, so i change the script tag like this <s-cript>....</s-cript>
The result will be:
Attachment ScreenShot2014-09-06at9.47.15PM.png not found
All those code injections i provided above has been tested and confirmed. The working example can be seen in the Live DEMO of StyleMart:
demo.flexiblewebdesign.com/stylemart/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=21&virtuemart_category_id=7&Itemid=520
Problem: Translation
To translate things;
- If those texts are come from Virtuemart Component, the language file is here:
/components/com_virtuemart/language/en-GB/en-GB.com_virtuemart.ini
(this INI file is for english)
- If the Text comes from StyleMart, then the INI file is this:
/language/en-GB/en-GB.tpl_flexible_stylemart.ini
If you like StyleMart and satisfied with the support you have received, please "write a review" on:
www.flexiblewebdesign.com/Joomla-Virtuemart-Templates/StyleMart
Rate StyleMart and write a couple of sentences to share your experience with the support team.
It won't take more than 2 minutes from you but it is extremely important for us.
Thanks in advance!
Regards,
Support