大家好:)我遇到了以下问题,我需要一些帮助。我正在尝试在我的在线商店中安装facebook像素。我使用的是OpenCart 2.2。我已经使用google分析模块将基本像素代码放在了标题中。我已经将标准事件放在了正确的页面上。下载并安装了Google Chrome的"Facebook Pixel Helper“应用程序,一切都运行得很完美。:)购买事件出现问题。这是事件代码:
<script>
fbq('track', 'Purchase', {value: 0.00, currency: 'BGN'});
</script>这里的"value“是静态的,始终为”0.00“。如何让它获得产品的价格?我尝试了几个选项,使用标记"$price“、"$product' price '”、"$text_price“作为OpenCart中的价格标记,但这些都不起作用。我正在考虑一个使用JavaScript的解决方案,将实际价格记录在facebook事件代码之上的值中,并使用这个值作为价格,但我不确定如何做到这一点。有没有其他的解决方案?提前感谢大家的帮助!!
致以最好的问候,茨维特科·克拉斯特夫
发布于 2017-04-28 01:14:37
要获取任何产品的价格,请使用以下命令
$this->load->model('catalog/product');
$product_id = 21 // assume that product id is 21
$product_info = $this->model_catalog_product->getProduct($product_id); // get product info
$data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']);现在你想怎么定这个价格就怎么定。
https://stackoverflow.com/questions/43659261
复制相似问题