tpl_checkout_success_default 中的 orderTotal 和 orderId - zen-cart

发布于 2024-12-28 15:12:04 字数 373 浏览 1 评论 0原文

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

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

此代码是否有效:

$orders_query = "SELECT * FROM zen_orders WHERE orders_id = " 。 $zv_orders_id ." 限制 1"; $orders = $db->执行($orders_query); $order_total = $orders->fields['order_total'];

非常感谢, 干杯

any ideas how to get orderTotal and orderId inside the tpl_checkout_success_default for the conversions tracking purposes ?

So far it looks like order id can be accessed by using this variable $zv_orders_id but how to get order total ?

will this code work:

$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'];

many thanks,
cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沦落红尘 2025-01-04 15:12:04

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

,您将看到 zencart 已经在运行查询来处理您的订单,并且 id 表示其已经拉出了你想要的信息。

因此,您只需将所需的数据设置为一个变量,然后就可以在 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);

look in /includes/modules/pages/checkout_success/header_php.php

in there you will see the queries already being run by zencart to do with your order, and id say its already pulling out the info you want.

so you just need to set said data you need to a variable that you can then use in your tpl_checkout_success_default.php file.

eg, something like $customer_has_gv_balance, you will see where it is set in the hearder file and then used in the template file

heres something i found in order.php that would almost do it as is:

$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);
土豪 2025-01-04 15:12:04

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

订单 ID:

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'];

希望这对某人有帮助!

For a simple tracking code like one used for a shopping comparison site, I've used the following for the order ID and order amount. Use these in the tpl_checkout_success.php page

Order ID:

echo $zv_orders_id;

Use this select statement:

$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);

Order amount:

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

Hope this helps someone!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文