0

任何想法如何在 tpl_checkout_success_default 中获取 orderTotal 和 orderId 以进行转化跟踪?

到目前为止,看起来可以通过使用此变量 $zv_orders_id 访问订单 ID,但如何获得订单总额?

此代码是否有效:

$orders_query = "SELECT * FROM zen_orders WHERE orders_id = " . $zv_orders_id ." LIMIT 1"; $orders = $db->Execute($orders_query); $order_total = $orders->fields['order_total'];

非常感谢,干杯

4

2 回答 2

1

在看/includes/modules/pages/checkout_success/header_php.php

在那里你会看到已经运行的查询zencart来处理你的订单,并且我说它已经提取了你想要的信息。

因此,您只需将所需的所述数据设置为一个变量,然后您可以在tpl_checkout_success_default.php文件中使用该变量。

例如,类似$customer_has_gv_balance,您将看到它在听者文件中的设置位置,然后在模板文件中使用

这是我在其中发现的order.php几乎可以按原样执行的内容:

$order_total_query = "select text, value
                             from " . TABLE_ORDERS_TOTAL . "
                             where orders_id = '" . (int)$order_id . "'
                             and class = 'ot_total'";

$order_total = $db->Execute($order_total_query);
于 2012-01-25T10:22:11.337 回答
0

对于一个用于购物比较网站的简单跟踪代码,我使用以下代码作为订单 ID 和订单金额。在 tpl_checkout_success.php 页面中使用这些

订单编号:

echo $zv_orders_id;

使用此选择语句:

$to_send_sql = 'select REPLACE (text,"$","") text from orders_total where orders_id = '.$zv_orders_id.' and class = "ot_subtotal"';

$to_send= $db->Execute($to_send_sql);

订单金额:

echo $to_send->fields['text'];

希望这对某人有帮助!

于 2012-01-28T04:13:01.233 回答