【问题标题】:orderTotal and orderId inside tpl_checkout_success_default - zen-carttpl_checkout_success_default 中的 orderTotal 和 orderId - zen-cart
【发布时间】:2012-02-18 12:20:06
【问题描述】:

任何想法如何在 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'];

非常感谢, 干杯

【问题讨论】:

    标签: php zen-cart


    【解决方案1】:

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

    【讨论】:

    • 我看了一点,我不认为它被拉出,因为你想要的是在 orders_total 表中,而不仅仅是订单。所以你想进行这样的查询:(见上文)
    • 很好,但如何从 $order_total 获取价值? $order_total->价值?欢呼
    • $order_summary 变量呢?
    • 是的,也许它也在里面,试着把它放在那里 var_dump($variable);打印出它的存储内容。
    【解决方案2】:

    对于一个用于购物比较网站的简单跟踪代码,我使用以下代码作为订单 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'];
    

    希望这对某人有所帮助!

    【讨论】:

      猜你喜欢
      • 2011-09-14
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 2015-01-03
      • 2013-11-08
      • 2011-10-04
      • 2011-11-20
      • 2012-12-06
      相关资源
      最近更新 更多