Post by rainerk74 » Thu Apr 13, 2023 1:38 am

Hello.

I have been using OC 2.3.0.2 for our little webshop without major problems for a few years, but when my service provider in Norway upgraded to PHP 8.2 I had to upgrade to OC 3.0.3.8 and the 3.0.x.x Maintenance to get it to work with PHP 8.2. After much adjustments most of the webshop seems to be working fine, but when I try checking out and buy products an error appears when getting to Payment Methods. The following error message appears after clicking "Continue" in Delivery Methods:

Fatal error: Uncaught ArgumentCountError: 4 arguments are required, 3 given in /home/4/e/energy-and-light/www/catalog/controller/checkout/payment_method.php:110

Stack trace:
#0 /home/4/e/energy-and-light/www/catalog/controller/checkout/payment_method.php(110): sprintf('Jeg har lest og...', 'http://www.ener...', 'Kj\xC3\xB8psvilk\xC3\xA5r')
#1 /home/4/e/energy-and-light/storage/modification/system/engine/action.php(79): ControllerCheckoutPaymentMethod->index() #2 /home/4/e/energy-and-light/www/catalog/controller/startup/router.php(25): Action->execute(Object(Registry))
#3 /home/4/e/energy-and-light/storage/modification/system/engine/action.php(79): ControllerStartupRouter->index()
#4 /home/4/e/energy-and-light/www/system/engine/router.php(67): Action->execute(Object(Registry))
#5 /home/4/e/energy-and-light/www/system/engine/router.php(56): Router->execute(Object(Action))
#6 /home/4/e/energy-and-light/www/system/framework.php(169): Router->dispatch(Object(Action), Object(Action))
#7 /home/4/e/energy-and-light/www/system/startup.php(104): require_once('/home/4/e/energ...')
#8 /home/4/e/energy-and-light/www/index.php(24): start('catalog')
#9 {main} thrown in /home/4/e/energy-and-light/www/catalog/controller/checkout/payment_method.php on line 110


Anyone with any ideas or thoughts about what is wrong? I have some very basic knowledge about PHP and how it works, but not enough to find out how to fix this....

Regards
Rainer

Newbie

Posts

Joined
Mon Mar 27, 2023 1:46 am

Post by rainerk74 » Thu Apr 13, 2023 3:03 am

Codelines referring to above stack trace:

#0, line 109-111: if ($information_info) {
$data['text_agree'] = sprintf($this->language->get('text_agree'), $this->url->link('information/information/agree', 'information_id=' . $this->config->get('config_checkout_id'), true), $information_info['title']);

#1, line 78-79: if ($reflection->hasMethod($this->method) && $reflection->getMethod($this->method)->getNumberOfRequiredParameters() <= count($args)) {
return call_user_func_array(array($controller, $this->method), $args);

#2, line 25: $output = $action->execute($this->registry);

#3, see #1

#4, line 67: $result = $action->execute($this->registry);

#5, line 56: $action = $this->execute($action);

#6, line 169: $route->dispatch(new Action($config->get('action_router')), new Action($config->get('action_error')));

#7, line 104: require_once(DIR_SYSTEM . 'framework.php');

#8, line 24: start('catalog');

#9, see #0

Newbie

Posts

Joined
Mon Mar 27, 2023 1:46 am

Post by rainerk74 » Thu Apr 13, 2023 3:49 am

I also notice that if I change the system settings for the store, and sets the terms of purchase to "None" in the dropdown menu, the error disappears, and it is possible to proceed with the shopping process. But obviously I want our customers to agree to the terms of purchase before being allowed to shop.....

Newbie

Posts

Joined
Mon Mar 27, 2023 1:46 am

Post by Johnathan » Thu Apr 13, 2023 9:16 pm

Use this version of 3.0.3.8:

https://github.com/opencart/opencart/tr ... aintenance

That version does not have the lines 78-79 that you're mentioning, which do not look like normal OpenCart functions to me. Hopefully it will fix your issue.

If not, look into the string you are trying to use for the "text_agree" variable in this file:

/catalog/language/YOURLANGUAGE/checkout/checkout.php

That has two %s variables in there, so if you only have one in your string, that would be the problem.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by rainerk74 » Mon Apr 17, 2023 11:42 pm

Ok, thank you very much for your answer.

So I tried downloading and installing that version of 3.0.3.8, and although the action.php with the lines 78-79 are not present in the storage folder, the action.php located in new version www/system/engine/ folder is exactly like the one I had in my old version, and the error message just changes to:

Fatal error: Uncaught ArgumentCountError: 4 arguments are required, 3 given in /home/4/e/energy-and-light/www/catalog/controller/checkout/payment_method.php:110
Stack trace:
#0 /home/4/e/energy-and-light/www/catalog/controller/checkout/payment_method.php(110): sprintf('Jeg har lest og...', 'http://www.ener...', 'Kj\xC3\xB8psvilk\xC3\xA5r')
#1 /home/4/e/energy-and-light/www/system/engine/action.php(79): ControllerCheckoutPaymentMethod->index()
#2 /home/4/e/energy-and-light/www/catalog/controller/startup/router.php(25): Action->execute(Object(Registry))
#3 /home/4/e/energy-and-light/www/system/engine/action.php(79): ControllerStartupRouter->index()
#4 /home/4/e/energy-and-light/www/system/engine/router.php(67): Action->execute(Object(Registry))
#5 /home/4/e/energy-and-light/www/system/engine/router.php(56): Router->execute(Object(Action))
#6 /home/4/e/energy-and-light/www/system/framework.php(169): Router->dispatch(Object(Action), Object(Action))
#7 /home/4/e/energy-and-light/www/system/startup.php(104): require_once('/home/4/e/energ...')
#8 /home/4/e/energy-and-light/www/index.php(19): start('catalog')
#9 {main} thrown in /home/4/e/energy-and-light/www/catalog/controller/checkout/payment_method.php on line 110

The same error message as in my first post, but it appears to be generating the error from an identical action.php located in another folder.

Also my "text_agree" variable in /catalog/language/YOURLANGUAGE/checkout/checkout.php has two variables, and should not be a problem I think:

$_['text_agree'] = 'Jeg har lest og godtatt <a href="%s" class="agree"><b>%s</b></a>';

Any other suggestions would be much appreciated.

Best regards
Rainer

Newbie

Posts

Joined
Mon Mar 27, 2023 1:46 am

Post by rainerk74 » Tue Apr 18, 2023 1:12 am

Ok, so I actually found the solution to this problem. By replacing the following code section in catalog/controller/checkout/payment_method.php:

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

with:

$data['text_agree'] = sprintf($this->language->get('text_agree'), $this->url->link('information/information', 'information_id=5' , true), $information_info['title'], $information_info['title']);

everything in that step is working fine. The checkbox and link to our terms of purchase appears under the comment field in the step "Payment method"

Newbie

Posts

Joined
Mon Mar 27, 2023 1:46 am

Post by Johnathan » Tue Apr 18, 2023 9:30 pm

You're basically changing it so there's only one %s replacement, which is why it works. If it's good enough for you, then you can leave it that way.

However, I'm puzzled why it's not working when your string already has two %s in it. I'm guessing either that variable is redeclared somewhere else with one %s, or this is happening for a particular language if you are using multiple languages. You'd have to do some more digging to figure that out, so if your solution is sufficient for you, then hopefully you won't see any other issues from this.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by YPD » Fri Feb 16, 2024 11:42 pm

Hello,

on this website >> zajavka.bg I am using Journal 3 theme and OC 3.0.3.8. I have checked all payment modules. Activated the Pay on Delivery, but somehow I am not able to have it working properly and I always receive the error "warning - shipping method required".

I have searched the internet but so far nothing. There are users suggest some eddits in the htaccess file. I have tried them, no results. There are some recommendations in the system file about header caching - no results as well.

Is there somebody here who resolved this issue? How?

Thank you very much in advance.

---
Check out these 2 websites:
https://www.casarosa-bulgaria.com/en
https://www.yasendeyanov.com


YPD
Newbie

Posts

Joined
Fri Feb 16, 2024 11:25 pm


Post by Cue4cheap » Sat Feb 17, 2024 2:42 am

YPD wrote:
Fri Feb 16, 2024 11:42 pm
Hello,

on this website >> zajavka.bg I am using Journal 3 theme and OC 3.0.3.8. I have checked all payment modules. Activated the Pay on Delivery, but somehow I am not able to have it working properly and I always receive the error "warning - shipping method required".
What happens with the default theme?
Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by JNeuhoff » Sat Feb 17, 2024 10:24 pm

using Journal 3 theme and OC 3.0.3.8
You need to decide whether you want to use OpenCart, or the Journal3 framework. For the latter you have to contact the Journal support. The Journal3 framework has some known issues with its different single-page checkout.

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 xxvirusxx » Sat Feb 17, 2024 11:43 pm

CORS issue/htaccess redirect

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
Who is online

Users browsing this forum: No registered users and 5 guests