Forums / General Questions / Blank Page after Placing an Order

Blank Page after Placing an Order

Views: 1,392

Results 1 to 15 of 15
12 Apr 2016, 7:38 PM
#1
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Blank Page after Placing an Order

Customers get following message on a blank screen after hitting order submit button:

'WARNING: An error occurred. Please refresh the page and try again"

The actual order DOES go thru and I also get the order confirmation email. I am using Paypal payment modules, which handle transactions without any errors.

When I look in to the error logs, I have following errors:

[12-Apr-2016 13:09:41 America/New_York] PHP Warning: Illegal string offset 'cost' in /home/*****/public_html/includes/classes/order.php on line 355

[12-Apr-2016 13:19:58 America/New_York] PHP Fatal error: 1146:Table '.zen_orders' doesn't exist :: SELECT * FROM zen_orders
WHERE orders_id = 7968
LIMIT 1 in /home/
/public_html/includes/classes/db/mysql/query_factory.php on line 120

[12-Apr-2016 13:20:05 America/New_York] PHP Warning: Creating default object from empty value in /home/*****/public_html/ipn_main_handler.php on line 354
[12-Apr-2016 13:20:05 America/New_York] ERROR: Failed sending email to: " " <> with subject: "Order Confirmation No: 7969" (failed validation)

[12-Apr-2016 13:30:34 America/New_York] PHP Warning: Creating default object from empty value in /home/*****/public_html/includes/modules/shipping_estimator.php on line 92

12 Apr 2016, 7:45 PM
#2
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Blank Page after Placing an Order

/home/*****/public_html/includes/classes/order.php

   $this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
                        'currency' => $_SESSION['currency'],
                        'currency_value' => $currencies->currencies[$_SESSION['currency']]['value'],
                        'payment_method' => $GLOBALS[$class]->title,
                        'payment_module_code' => $GLOBALS[$class]->code,
                        'coupon_code' => $coupon_code->fields['coupon_code'],
    //                          'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),
    //                          'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),
    //                          'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),
    //                          'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),
    //                          'cc_cvv' => (isset($GLOBALS['cc_cvv']) ? $GLOBALS['cc_cvv'] : ''),
                        'shipping_method' => (is_array($_SESSION['shipping']) ? $_SESSION['shipping']['title'] : $_SESSION['shipping']),
                        'shipping_module_code' => (isset($_SESSION['shipping']['id']) && strpos($_SESSION['shipping']['id'], '_') > 0 ? $_SESSION['shipping']['id'] : $_SESSION['shipping']),
                        'shipping_cost' => $_SESSION['shipping']['cost'],
                        'subtotal' => 0,
                        'shipping_tax' => 0,
                        'tax' => 0,
                        'total' => 0,
                        'tax_groups' => array(),
                        'comments' => (isset($_SESSION['comments']) ? $_SESSION['comments'] : ''),
                        'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
                        );

Line 355 is:

'shipping_cost' => $_SESSION['shipping']['cost'],
12 Apr 2016, 7:50 PM
#3
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Blank Page after Placing an Order

/home/******/public_html/includes/classes/db/mysql/query_factory.php

  function show_error() {
    if ($this->error_number == 0 && $this->error_text == DB_ERROR_NOT_CONNECTED && !headers_sent() && file_exists('nddbc.html') ) include('nddbc.html');
    echo '<div class="systemError">';
    if (defined('STRICT_ERROR_REPORTING') && STRICT_ERROR_REPORTING == true) 
    {
      echo $this->error_number . ' ' . $this->error_text;
      echo '<br />in:<br />[' . (strstr($this->zf_sql, 'db_cache') ? 'db_cache table' : $this->zf_sql) . ']<br />';
    } else {
      echo 'WARNING: An Error occurred, please refresh the page and try again.';	
    }
    trigger_error($this->error_number . ':' . $this->error_text . ' :: ' . $this->zf_sql, E_USER_ERROR);
    if (defined('IS_ADMIN_FLAG') && IS_ADMIN_FLAG==true) echo 'If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.<br />';
    echo '</div>';
  }

Line 120 is:

trigger_error($this->error_number . ':' . $this->error_text . ' :: ' . $this->zf_sql, E_USER_ERROR);
12 Apr 2016, 7:53 PM
#4
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Blank Page after Placing an Order

/home/*****/public_html/ipn_main_handler.php

       ipn_debug_email('Breakpoint: 5k - OSH update done');
        $order->create_add_products($insert_id, 2);
        ipn_debug_email('Breakpoint: 5L - adding products');
        $_SESSION['order_number_created'] = $insert_id;
        $GLOBALS[$_SESSION['payment']]->transaction_id = $_POST['txn_id'];
        $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_ORDER_CREATE_ADD_PRODUCTS');
        $order->send_order_email($insert_id, 2);
        ipn_debug_email('Breakpoint: 5m - emailing customer');
        $zco_notifier->notify('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL');

Line 354:

        $GLOBALS[$_SESSION['payment']]->transaction_id = $_POST['txn_id'];
12 Apr 2016, 10:58 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Blank Page after Placing an Order

sle39lvr:

[12-Apr-2016 13:09:41 America/New_York] PHP Warning: Illegal string offset 'cost' in /home/*****/public_html/includes/classes/order.php on line 355
That's a result of using PHP 5.4 or newer with an old version of Zen Cart that was designed before PHP 5.4 was created.
In modern versions of Zen Cart there are a lot of arrays that have been updated and improved for compatibility with modern PHP versions. You need to upgrade your Zen Cart if you're going to continue upgrading your PHP.

sle39lvr:

[12-Apr-2016 13:30:34 America/New_York] PHP Warning: Creating default object from empty value in /home/*****/public_html/includes/modules/shipping_estimator.php on line 92I'm pretty sure this one is also related to the PHP version mismatch.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Apr 2016, 11:00 PM
#6
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Blank Page after Placing an Order

Understood. :oops:

12 Apr 2016, 11:05 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Blank Page after Placing an Order

sle39lvr:

Customers get following message on a blank screen after hitting order submit button:

'WARNING: An error occurred. Please refresh the page and try again"

[12-Apr-2016 13:19:58 America/New_York] PHP Fatal error: 1146:Table '.zen_orders' doesn't exist :: SELECT * FROM zen_orders
WHERE orders_id = 7968
LIMIT 1 in /home/
/public_html/includes/classes/db/mysql/query_factory.php on line 120
That fatal error is the cause of the blank screen.

Chances are you've got some custom code or poorly-written plugins that are looking for a table named "zen_orders" when the rest of your site is using tables names without the "zen_" prefix on those tables.

Normally one would use the PHP constant named TABLE_ORDERS to properly combine the global table-prefix value with the expected table name suffix instead of presupposing the actual table name.

In this case the query_factory.php file is only the messenger. It's only executing the query, not preparing it. I'm guessing that you've got something added to your site to do extra "stuff" after orders are created. This could mean custom code in a lot of places, such as:
/includes/modules/pages/checkout_process/.php
/includes/modules/pages/checkout_success/
.php
/includes/classes/observers/*.php
/includes/templates/your_template_name/templates/tpl_checkout_success_default.php
and perhaps others.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

13 Apr 2016, 1:48 PM
#8
lat9 avatar

lat9

Administrator

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

Re: Blank Page after Placing an Order

You could install the myDebug Backtrace plugin to see where the mal-formed call to the queryFactory class is coming from.

26 Apr 2016, 10:14 PM
#9
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Blank Page after Placing an Order

Just updated to 1.5.5. The issue still exists.

Attachment 16262

26 Apr 2016, 11:04 PM
#10
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,973
Plugin Contributions:
8

Re: Blank Page after Placing an Order

you need to post the contents of your error logs.

in addition, i think the problem is still related to the sql statement: "select * from zen_orders... "

can you track down what file contains that bit of code and post its contents?

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

27 Apr 2016, 3:42 AM
#11
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Blank Page after Placing an Order

After the latest upgrade, this is what I got after my test order:

[26-Apr-2016 13:12:57 America/Chicago] Request URI: /index.php?main_page=checkout_success&zenid=xxxxxxxxxxxxxxxxxxx, IP address: xxx.xxx.xxx.xxx
#1  trigger_error() called at [/home/euroasia/public_html/includes/classes/db/mysql/query_factory.php:167]
#2  queryFactory->show_error() called at [/home/xxxxxx/public_html/includes/classes/db/mysql/query_factory.php:139]
#3  queryFactory->set_error() called at [/home/xxxxxx/public_html/includes/classes/db/mysql/query_factory.php:266]
#4  queryFactory->Execute() called at [/home/xxxxxx/public_html/includes/modules/pages/checkout_success/jscript_google.php:11]
#5  require(/home/xxxxx/public_html/includes/modules/pages/checkout_success/jscript_google.php) called at [/home/xxxxx/public_html/includes/templates/megashop/common/html_header.php:158]
#6  require(/home/xxxxx/public_html/includes/templates/megashop/common/html_header.php) called at [/home/xxxxxx/public_html/index.php:43]

[26-Apr-2016 13:12:57 America/Chicago] PHP Fatal error:  1146:Table 'xxxxx_xxx.zen_orders' doesn't exist :: SELECT * FROM zen_orders
WHERE orders_id = 1017
LIMIT 1 ==> (as called by) /home/xxxxx/public_html/includes/modules/pages/checkout_success/jscript_google.php on line 11 <== in /home/xxxxx/public_html/includes/classes/db/mysql/query_factory.php on line 167
27 Apr 2016, 3:50 AM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Blank Page after Placing an Order

sle39lvr:

[26-Apr-2016 13:12:57 America/Chicago] PHP Fatal error: 1146:Table 'xxxxx_xxx.zen_orders' doesn't exist :: SELECT * FROM zen_orders
WHERE orders_id = 1017
LIMIT 1 ==> (as called by) /home/xxxxx/public_html**/includes/modules/pages/checkout_success/jscript_google.php** on line 11
Your "jscript_google.php" file has hard-coded a table name of "zen_orders" instead of properly treating table names the way Zen Cart code does by using the defined tablenames which honor system prefixes.

The code on or before line 11 of that file should be changed from (something like):"select * from zen_orders ..."to ```
"select * from " . TABLE_ORDERS . " ......"

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

27 Apr 2016, 3:56 AM
#13
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Blank Page after Placing an Order

This is what I got on that file:
Attachment 16266

27 Apr 2016, 4:04 AM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Blank Page after Placing an Order

Exactly.

As I said, replace zen_orders with: " . TABLE_ORDERS . "

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

27 Apr 2016, 4:05 AM
#15
sle39lvr avatar

sle39lvr

Zen Follower

Join Date:
Jan 2011
Posts:
196
Plugin Contributions:
0

Re: Blank Page after Placing an Order

DrByte:

Exactly.

As I said, replace zen_orders with: " . TABLE_ORDERS . "

Thank you!!