Page 1 of 1

FATAL ERROR: Call to a member function fetch_to_address()

Posted: Wed Jan 03, 2024 5:40 am
by lecarlb
Hello,

This on a 1.0.8.16 version site. When attempting to add a product to cart, I receive a 500 error.

Until recently, I haven't touched added nor subtracted anything. Here's what I've done:

(1) Installed the MSRP addon - S05E07 downloaded from forums
(2) Cleared caching in CloudFlare although caching has been paused for about 2 weeks
(3) Changed Force Cookie Use from True to False

Below is the error in the logs.

Code: Select all

[Tue Jan 02 23:05:04.884816 2024] [php7:error] [pid 24467] [client 173.190.176.123:50300] PHP Fatal error:  Uncaught Error: Call to a member function fetch_to_address() on null in /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.7.10/cart_order_builder.php:65\nStack trace:\n#0 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.7.10/cart_order_builder.php(149): cart_order_builder->build_addresses()\n#1 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.7.10/order.php(25): cart_order_builder::build()\n#2 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/modules/content/shopping_cart/cm_sc_order_total.php(100): order->__construct()\n#3 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.8.4/template.php(106): cm_sc_order_total->execute()\n#4 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/templates/default/includes/pages/shopping_cart.php(13): Template->get_content()\n#5 /usr in /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.7.10/cart_order_builder.php on line 65, referer: https://www.xxxxxxxxxx.com/
[Tue Jan 02 23:05:31.761586 2024] [php7:error] [pid 25188] [client 34.208.159.126:8825] PHP Fatal error:  Uncaught Error: Call to a member function fetch_to_address() on null in /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.7.10/cart_order_builder.php:65\nStack trace:\n#0 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.7.10/cart_order_builder.php(149): cart_order_builder->build_addresses()\n#1 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.7.10/order.php(25): cart_order_builder::build()\n#2 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/modules/content/shopping_cart/cm_sc_order_total.php(100): order->__construct()\n#3 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.8.4/template.php(106): cm_sc_order_total->execute()\n#4 /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/templates/default/includes/pages/shopping_cart.php(13): Template->get_content()\n#5 /usr in /usr/local/apache/subdomains/xxxxxxxxxx/www.xxxxxxxxxx.com/htdocs/includes/system/versioned/1.0.7.10/cart_order_builder.php on line 65, referer: https://www.xxxxxxxxxx.com/shopping_cart.php?action=buy_now&products_id=417&ceid=ul970d3qns2h2ijomrtqm161sc
Not sure when the error began but an order was made prior to this discovery.

Thank you for your help.

Re: FATAL ERROR: Call to a member function fetch_to_address()

Posted: Wed Jan 03, 2024 10:43 am
by burt
includes/modules/content/shopping_cart/cm_sc_order_total.php
is mentioned in that error.

It seems like it is trying to get the customers address, but the customer does not exist (ie no account created or not logged in).

It's not a core file:
https://github.com/CE-PhoenixCart/Phoen ... pping_cart

So maybe try turning it off and see if error resolves?
At least you will then know where the error is.

Re: FATAL ERROR: Call to a member function fetch_to_address()

Posted: Thu Jan 04, 2024 2:39 am
by lecarlb
Thank you @burt.

That helped me get to the bottom of things. At some point, I don't know when, I turned on the Order Totals Estimator.

However, it is supposed to be accompanied by the Shipping Estimator. I turned that on and things started working.

So it's either both on or both off.