应用\设计\前端\ XXXX \ YYYY \模板\结帐\ success.phtml
但是,我无法在此文件中找到任何内容。
代码看起来像这样,有没有人知道如何实现它?:
<!-- Facebook Conversion Code for track facebook -->
<script type="text/javascript">
var fb_param = {};
fb_param.pixel_id = 'xxxxxxxxxxxx';
fb_param.value = '0.00';
fb_param.currency = 'USD';
(function(){
var fpw = document.createElement('script');
fpw.async = true;
fpw.src = '//connect.facebook.net/en_US/fp.js';
var ref = document.getElementsByTagName('script')[0];
ref.parentNode.insertBefore(fpw, ref);
})();
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/offsite_event.php?id=6015688541915&value=0&currency=USD" /></noscript>
答案 0 :(得分:1)
实现此目的的最简单方法
在template \ checkout \ success.phtml
中<?php $order = Mage::getModel(‘sales/order’)->loadByIncrementId($this->getOrderId()); ?>
<!-- Facebook Conversion Code for Checkout -->
<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', 'XXXXXXXXXX', {'value':'<?php echo $order->getBaseGrandTotal() ?>','currency':'SGD'}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=XXXXXXXXXXXXX&cd[value]=0.01&cd[currency]=SGD&noscript=1" /></noscript>