[SOLVED] Ask a Question about this product redirect to a custom Thank You Page

Started by shyntaxx, May 11, 2020, 21:06:32 PM

Previous topic - Next topic

shyntaxx

Hi,

I was searching around a LOT about how to redirect the "Ask a Question" form to a custom Thank You Page for tracking conversion, and I did't really find an answer to that.

I've figured it out so, here is my solution:

ATM I'm using  Joomla version, 3.9.18., VirtueMart 3.6.10, Horme 3 Temlpate.

First of I've created a Thank You Page of course.

Then in /templates/horme_3/html/com_virtuemart/askquestion/mail_confirmed.php file I had:


// Check to ensure this file is included in Joomla!
defined ( '_JEXEC' ) or die ( 'Restricted access' );
if(VmConfig::get('usefancy',1)){
$onclick = 'parent.jQuery.fancybox.close();';
} else {
$onclick = 'parent.jQuery.facebox.close();';
}
?>
<div class="productdetails-view">
  <p>
<?php echo vmText::_('COM_VIRTUEMART_ASK_QUESTION_THANK_YOU'); ?>
  </p>
  <button class="btn btn-primary" type="button" onclick="<?php echo $onclick ?>"><span class="glyphicon glyphicon-remove"></span> <?php echo vmText::_('COM_VIRTUEMART_CLOSE'); ?></button>
</div>
<script>
jQuery('button').click(function(){
  jQuery('#form-collapse', parent.document).collapse('toggle');
});
</script>


and under this line:

<?php echo vmText::_('COM_VIRTUEMART_ASK_QUESTION_THANK_YOU'); ?>

I've added the following code:



<?php redirect(JURI::base() . '/'."thank-you-page");

    function 
redirect($url)
    {
    echo 
'<script type="text/javascript">';
    echo 
'window.top.location.href = "https://yourwebsite.com/thank-you-page"';
    echo 
'</script>';
    echo 
'<noscript>';
    echo 
'<meta http-equiv="refresh" content="0;url=' $url '" />';
    echo 
'</noscript>';
    exit;
    }
  
?>




I hope it's going to be useful for some of You.

Thank you for your attention.

Best wishes,
Shyntaxx.

loppan


pinochico

Thank you very much for the shared code.

I have a few comments below.

The idea of redirecting the customer outside the e-shop website is bad from a marketing point of view. I don't want the customer to leave, I want him to stay at the e-shop and buy something.

Redirecting the form to the thank you page (just to measure the form) is a bad idea for the same reason.

The programmer made an adjustment here so that the e-shop behaved the way he wanted - so that it programmed well. He didn't think about marketing and business at all.

There are many ways to measure form submission (we use 2 ajax boostrap forms with a URL change in a popup without redirection and a thank you message on the product detail and with a reprogrammed recaptcha for multi-display).

For example:
- set up and call up a virtual page and insert the measuring code into it
- use GTM and set the display delay for it
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

shyntaxx

I appreciate the comment!

- set up and call up a virtual page and insert the measuring code into it
- use GTM and set the display delay for it

Not sure if I understand these two options .. Although I've read about "GTM datalayer push" for an another example ..

Anyway .. at first I've set it to open the thank you page in a new browser tab, but then it got blocked by the browser ..

pinochico

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products