Zen Cart Logo
Forums / General Questions / Variables that are passed to define_checkout_success.php

Variables that are passed to define_checkout_success.php

Views: 363

Results 1 to 5 of 5
2 Dec 2024, 8:27 PM
#1
chadlly2003 avatar

chadlly2003

Totally Zenned

Join Date:
Jan 2015
Posts:
784
Plugin Contributions:
0

Variables that are passed to define_checkout_success.php

Zencart 2.1
php 8.2
OPC 2.5.4

I just upgraded my website from 1.5.8 to 2.1.

I have a shopper approved script I use for Variables that are passed to define_checkout_success.php

I always use these variables as indicated in the script

orders_id: <?php echo $orders->fields['orders_id'] ?>
Name: <?php echo $orders->fields['customers_name'] ?>
Email: <?php echo $orders->fields['customers_email_address'] ?>

<!-- shopper approved survey Script -->
<script type="text/javascript"> var sa_values = { "site":xxxxxx, "token":"xxxxxx", 'orderid':'<?php echo $orders->fields['orders_id'] ?>', 'name':'<?php echo $orders->fields['customers_name'] ?>', 'email':'<?php echo $orders->fields['customers_email_address'] ?>' }; function saLoadScript(src) { var js = window.document.createElement("script"); js.src = src; js.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(js); } var d = new Date(); if (d.getTime() - 172800000 > 1477399567000) saLoadScript("https://www.shopperapproved.com/thankyou/ratexxx.js?d=" + d.getTime()); else saLoadScript("//direct.shopperapproved.com/thankyou/rate/10324.js?d=" + d.getTime()); </script>

I am getting an error from the variables can someone assist me or lead me in the right direction in solving this issue

[01-Dec-2024 02:21:02 Europe/Berlin] Request URI: /xxx.com/index.php?main_page=checkout_success, IP address: 127.0.0.1, Language id 1
#0 C:\xampp\htdocs\xxx.com\includes\templates\bootstrap\templates\tpl_checkout_success_guest.php(100): zen_debug_error_handler()
#1 C:\xampp\htdocs\xxx.com\includes\modules\pages\checkout_success\main_template_vars.php(15): require('C:\xampp\htdocs...')
#2 C:\xampp\htdocs\xxx.com\includes\templates\bootstrap\common\tpl_main_page.php(285): require('C:\xampp\htdocs...')
#3 C:\xampp\htdocs\xxx.com\index.php(94): require('C:\xampp\htdocs...')
--> PHP Warning: Undefined variable $orders in C:\xampp\htdocs\xxx.com\includes\templates\bootstrap\templates\tpl_checkout_success_guest.php on line 100.

[01-Dec-2024 02:21:02 Europe/Berlin] Request URI: /xxx.com/index.php?main_page=checkout_success, IP address: 127.0.0.1, Language id 1
#0 C:\xampp\htdocs\xxx.com\includes\templates\bootstrap\templates\tpl_checkout_success_guest.php(100): zen_debug_error_handler()
#1 C:\xampp\htdocs\xxx.com\includes\modules\pages\checkout_success\main_template_vars.php(15): require('C:\xampp\htdocs...')
#2 C:\xampp\htdocs\xxx.com\includes\templates\bootstrap\common\tpl_main_page.php(285): require('C:\xampp\htdocs...')
#3 C:\xampp\htdocs\xxx.com\index.php(94): require('C:\xampp\htdocs...')
--> PHP Warning: Attempt to read property "fields" on null in C:\xampp\htdocs\xxx.com\includes\templates\bootstrap\templates\tpl_checkout_success_guest.php on line 100.

[01-Dec-2024 02:21:02 Europe/Berlin] Request URI: /xxx.com/index.php?main_page=checkout_success, IP address: 127.0.0.1, Language id 1
#0 C:\xampp\htdocs\xxx.com\includes\templates\bootstrap\templates\tpl_checkout_success_guest.php(100): zen_debug_error_handler()
#1 C:\xampp\htdocs\xxx.com\includes\modules\pages\checkout_success\main_template_vars.php(15): require('C:\xampp\htdocs...')
#2 C:\xampp\htdocs\xxx.com\includes\templates\bootstrap\common\tpl_main_page.php(285): require('C:\xampp\htdocs...')
#3 C:\xampp\htdocs\xxx.com\index.php(94): require('C:\xampp\htdocs...')
--> PHP Warning: Trying to access array offset on value of type null in C:\xampp\htdocs\xxx.com\includes\templates\bootstrap\templates\tpl_checkout_success_guest.php on line 100.

2 Dec 2024, 10:16 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: Variables that are passed to define_checkout_success.php

The $orders variable is not set on the initial entry to the checkout_success page from the order's confirmation.

Always present during the template's display of the page is the $order variable which is an instance of the order-class for the customer's just-placed order.

2 Dec 2024, 10:44 PM
#3
chadlly2003 avatar

chadlly2003

Totally Zenned

Join Date:
Jan 2015
Posts:
784
Plugin Contributions:
0

Re: Variables that are passed to define_checkout_success.php

lat9:

The $orders variable is not set on the initial entry to the checkout_success page from the order's confirmation.

Always present during the template's display of the page is the $order variable which is an instance of the order-class for the customer's just-placed order.

Note sure i clearly understand. How would i solve this issue

2 Dec 2024, 11:18 PM
#4
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: Variables that are passed to define_checkout_success.php

$orders_id = $order->info['order_id'];
$customers_name = $order->customer['name'];
$customers_email_address = $order->customer['email_address'];
3 Dec 2024, 9:26 AM
#5
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,874
Plugin Contributions:
7

Re: Variables that are passed to define_checkout_success.php

To get this sort of info (what variables are available where and when) Superglobals goes a long way to providing that info:
https://github.com/lat9/super_globals_plus