VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: Sheepiss on July 31, 2015, 10:00:47 AM

Title: Adding facebook script to virtuemart thank you page.
Post by: Sheepiss on July 31, 2015, 10:00:47 AM
Hi everyone,

my e-shop is running on Joomla! 3.4.1 - VirtueMart 3.0.6.4.

I have installed component VM UIKit on YOOtheme template.

I would like to add facebook script (pixel) to the thank you page, which is on my opinion located in: /www/templates/my_theme/html/com_virtuemart/cart/order_done.php

Actual content of the file order_done.php is:
<?php // no direct access
defined('_JEXEC') or die;

/**
 * Theme: VirtueMart Theme
 *
 * @package      FrontEnd / Template
 * @author      MoWebSo.com / Eugen Stranz
 * @copyright       (C) 2009 - 2013 ENYtheme e.K.
 * @license     GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
 */

// Include The MoWebSo Library 
require_once("components/com_vmuikit/libraries/joomla/thirdparty/virtuemart.php");
$vmuikitlib VmuikitVirtuemart::getInstance(); 


// Include The Right Start File For The Chosen Theme
$this->addTemplatePath(JPATH_SITE '/templates/' $vmuikitlib->templateName '/html/com_virtuemart/themes/' $vmuikitlib->themeName '/checkout/');
echo 
$this->loadTemplate('start');
//echo $vmuikitlib->getFooterText();
$vmuikitlib->headerdata();


Facebook script looks like this:
<!-- Facebook Conversion Code for Zákazníci, kteří nakoupili -->
<script>(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', '6025561659922', {'value':'0.00','currency':'CZK'}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=6025561659922&cd[value]=0.00&cd[currency]=CZK&noscript=1" /></noscript>


I dont know where exactly to add this facebook script code or how to modify the files to run it correctly.

Thanks for any advice.

Sheepiss
Title: Re: Adding facebook script to virtuemart thank you page.
Post by: GJC Web Design on July 31, 2015, 11:45:22 AM
 just echo it out on the order_done.php file -- it is just javascript that needs to be printed

you'll have to see what is available in the $this object to see if you can get the value
Title: Re: Adding facebook script to virtuemart thank you page.
Post by: Sheepiss on August 04, 2015, 17:03:42 PM
Can you advice me how exactly to do it? I am not a programmer and dont understand what you answered. How to echo it out on the order_done.php file? And what should exactly be in the $this object?

Sorry for my ignorance.

Thanks, Sheepiss
Title: Re: Adding facebook script to virtuemart thank you page.
Post by: GJC Web Design on August 05, 2015, 10:22:13 AM
Afraid house calls need to be paid for.. PM if interested