首页 > 解决方案 > Avantlink 订单确认与付费会员专业版集成

问题描述

我在将 Avantlink 订单跟踪和订单确认代码与付费会员专业版 WP 集成时遇到问题。

我收到了来自 avantlinks 和付费会员专业的文件来跟踪和执行任务,但它对我不起作用。

Here are the codes which needs to be integrate with Paid membership pro. 
Remember I am using Divi theme on my wp site.

<script type="text/javascript">
var _AvantMetrics = _AvantMetrics || [];
_AvantMetrics.push(['order',{ order_id:'[ORDER_ID]',
amount:'[ORDER_AMOUNT]',     
state:'[BILLING_STATE]', country:'[BILLING_COUNTRY]' }]);
_AvantMetrics.push(['item',{ order_id:'[ORDER_ID]', 
parent_sku:'[ITEM_PARENT_SKU]', variant_sku:'[ITEM_VARIANT_SKU]', 
price:'[ITEM_PRICE]', qty:'[ITEM_QUANTITY]' }]);
</script>

The code above is for order confirmation and that Avantlink order 
confirmation code requires different array of variables to verify. And here 
are the paid membership pro variables that need to be set with the code 
above i am not sure how to do that

$order->membership_id
$pmpro_invoice->billing->state
$pmpro_invoice->billing->country
$pmpro_invoice->total
$pmpro_invoice->discount_code->code
$pmpro_invoice->accountnumber

如何在 avantlink 代码中使用这些变量?

标签: wordpress

解决方案


您在此处粘贴的订单确认代码包含您需要从成员变量中分配值的变量。因此,将代码视为模板,所有这些值(ORDER_ID、ORDER_AMOUNT、BILLING_STATE 等)都应分配一个值,该值在成员资格 pro 中具有相应的变量。请查看下面的代码以了解值如何从会员资格传递到 Avant Metrics。

<script type="text/javascript">
var _AvantMetrics = _AvantMetrics || [];
_AvantMetrics.push(['order',{ order_id:'<?php echo $order->membership_id;?>',
amount:'<?php echo $pmpro_invoice->total;?>',     
state:'[BILLING_STATE]', country:'<?php echo $pmpro_invoice->billing->country;?>' }]);
_AvantMetrics.push(['item',{ order_id:'<?php echo $order->membership_id;?>', 
parent_sku:'[ITEM_PARENT_SKU]', variant_sku:'[ITEM_VARIANT_SKU]', 
price:'[ITEM_PRICE]', qty:'[ITEM_QUANTITY]' }]);
</script>

分配值的另一种方法是创建您自己的变量并将这些值传递给它们。然后,您可以将变量分配给 Avant Metrics 跟踪函数。

/* here goes your custom variable */
var ORDER_ID='<?php echo $order->membership_id;?>';

并且当您按照上述方法时,请记下如何将自定义变量分配给 AvantMetrics 函数。

_AvantMetrics.push(['order',{ order_id:ORDER_ID,

请尝试让我知道它是否有效。


推荐阅读