Post by HAO » Thu Aug 15, 2024 2:29 pm

This is the error message I just found, How can I fix this error?

Code: Select all

[15-Aug-2024 03:48:04 UTC] PHP Fatal error:  Uncaught Error: Call to a member function getAffiliate() on null in /home/***/public_html/catalog/controller/account/affiliate.php:221
Stack trace:
#0 /home/***/storage/modification/system/engine/action.php(79): ControllerAccountAffiliate->getForm()
#1 /home/***/public_html/catalog/controller/startup/router.php(27): Action->execute(Object(Registry))
#2 /home/***/storage/modification/system/engine/action.php(79): ControllerStartupRouter->index()
#3 /home/***/storage/modification/system/engine/router.php(77): Action->execute(Object(Registry))
#4 /home/***/storage/modification/system/engine/router.php(66): Router->execute(Object(Action))
#5 /home/***/public_html/system/framework.php(179): Router->dispatch(Object(Action), Object(Action))
#6 /home/***/public_html/system/startup.php(104): require_once('/home/***/pub...')
#7 /home/***/public_html/index.php(19): start('catalog')
#8 {main}
  thrown in /home/***/public_html/catalog/controller/account/affiliate.php on line 221
The code for this section:
// Custom Fields
$this->load->model('account/custom_field');

$data['custom_fields'] = $this->model_account_custom_field->getCustomFields($this->config->get('config_customer_group_id'));

if (isset($this->request->post['custom_field'])) {
$data['affiliate_custom_field'] = $this->request->post['custom_field'];
} elseif (isset($affiliate_info)) {
$data['affiliate_custom_field'] = json_decode($affiliate_info['custom_field'], true);
} else {
$data['affiliate_custom_field'] = array();
}

$affiliate_info = $this->model_account_customer->getAffiliate($this->customer->getId()); affiliate.php on line 221

if (!$affiliate_info && $this->config->get('config_affiliate_id')) {
$this->load->model('catalog/information');

$information_info = $this->model_catalog_information->getInformation($this->config->get('config_affiliate_id'));

if ($information_info) {
$data['text_agree'] = sprintf($this->language->get('text_agree'), $this->url->link('information/information/agree', 'information_id=' . $this->config->get('config_affiliate_id'), true), $information_info['title']);
} else {
$data['text_agree'] = '';
}
} else {
$data['text_agree'] = '';
}

HAO
Active Member

Posts

Joined
Fri Jun 03, 2011 2:52 pm

Post by by mona » Thu Aug 15, 2024 2:56 pm

The error is that you can not get the account without having the customer id.
More information is needed.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by xxvirusxx » Thu Aug 15, 2024 3:29 pm

PHP 8.3?

It is possible to get also these warnings

PHP Unknown: mb_strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /system/helper/utf8.php on line 30

PHP Unknown: md5(): Passing null to parameter #1 ($string) of type string is deprecated in system/library/cart/customer.php on line 69

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by HAO » Thu Aug 15, 2024 4:16 pm

My OpenCart 3.0.4.0 is running on php 7.3, And upgraded from OpenCart 2.3.0.2 a few days ago.

Maybe affiliate has some data before upgrading, But now oc_customer_affiliate data is empty and we do not intend to use this function.

So how do I fix this error message?

HAO
Active Member

Posts

Joined
Fri Jun 03, 2011 2:52 pm

Post by JNeuhoff » Thu Aug 15, 2024 4:54 pm

Try a fresh install of OC 3.0.4.0, the upgrade function almost always causes problems. And use at least PHP 7.4, or better one of PHP 8.x versions.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by HAO » Thu Aug 15, 2024 7:46 pm

Because I have important modules I can only switch to php 7.4, Can someone tell me why it's going wrong?

My affiliate doesn't have any members why would it need to find the ID?

HAO
Active Member

Posts

Joined
Fri Jun 03, 2011 2:52 pm

Post by JNeuhoff » Thu Aug 15, 2024 7:49 pm

Since nobody else can reproduce your issue, you have to be more specific, giving the exact steps to reproduce this issue.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 5 guests