Page 1 of 2

Joomla 5 Compatability

Posted: 16 Oct 2024, 16:41
by landed
I am wondering if I have a template issue or phoca cart issue after upgrading to Joomla 5. Mostly everything is ok just the /shop/checkout page is giving me an error

[EDIT] Not sure why I am still on 4.0.11 version of the component. I see only a Beta so kicking myself for not waiting longer to upgrade.

Any ideas how I can temporarily suspend the store until a fix?

Code: Select all

0 Joomla\CMS\Event\Model\FormEvent::onSetData(): Argument #1 ($value) must be of type object|array, bool given, called in /home/u799547071/domains/bestantigua.com/public_html/libraries/src/Event/AbstractEvent.php on line 227
Thank You

Code: Select all

#	Function	Location
1	()	JROOT/libraries/src/Event/Model/FormEvent.php:116
2	Joomla\CMS\Event\Model\FormEvent->onSetData()	JROOT/libraries/src/Event/AbstractEvent.php:227
3	Joomla\CMS\Event\AbstractEvent->setArgument()	JROOT/libraries/src/Event/AbstractEvent.php:115
4	Joomla\CMS\Event\AbstractEvent->__construct()	JROOT/libraries/src/Event/AbstractImmutableEvent.php:51
5	Joomla\CMS\Event\AbstractImmutableEvent->__construct()	JROOT/libraries/src/Event/Model/FormEvent.php:56
6	Joomla\CMS\Event\Model\FormEvent->__construct()	JROOT/libraries/src/MVC/Model/FormBehaviorTrait.php:198
7	Joomla\CMS\MVC\Model\FormModel->preprocessForm()	JROOT/components/com_phocacart/models/checkout.php:510
8	PhocaCartModelCheckout->loadFormGuest()	JROOT/components/com_phocacart/models/checkout.php:466
9	PhocaCartModelCheckout->getFormGuest()	JROOT/libraries/src/MVC/View/AbstractView.php:159
10	Joomla\CMS\MVC\View\AbstractView->get()	JROOT/components/com_phocacart/views/checkout/view.html.php:233
11	PhocaCartViewCheckout->display()	JROOT/libraries/src/MVC/Controller/BaseController.php:697
12	Joomla\CMS\MVC\Controller\BaseController->display()	JROOT/components/com_phocacart/controller.php:53
13	PhocaCartController->display()	JROOT/libraries/src/MVC/Controller/BaseController.php:730
14	Joomla\CMS\MVC\Controller\BaseController->execute()	JROOT/components/com_phocacart/phocacart.php:18
15	require_once()	JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
16	Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}()	JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
17	Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch()	JROOT/libraries/src/Component/ComponentHelper.php:361
18	Joomla\CMS\Component\ComponentHelper::renderComponent()	JROOT/libraries/src/Application/SiteApplication.php:218
19	Joomla\CMS\Application\SiteApplication->dispatch()	JROOT/libraries/src/Application/SiteApplication.php:261
20	Joomla\CMS\Application\SiteApplication->doExecute()	JROOT/libraries/src/Application/CMSApplication.php:306
21	Joomla\CMS\Application\CMSApplication->execute()	JROOT/includes/app.php:58
22	require_once()	JROOT/index.php:32

Re: Joomla 5 Compatability

Posted: 17 Oct 2024, 00:30
by Jan
Hi, update to latest 5.0.0 Beta, it is only marked as Beta, as the only one feature (Order status and Joomla Email templating) is not ready yet.

Re: Joomla 5 Compatability

Posted: 17 Oct 2024, 13:48
by landed
Thank you. What is this meaning - Order status and Joomla Email templating as I use status for emailing different emails depending on status of payment.

Re: Joomla 5 Compatability

Posted: 17 Oct 2024, 13:55
by landed
I tried it on my dev site and it's better but now the following error:
0 Invalid address: (From):
Call Stack
# Function Location
1 () JROOT/libraries/vendor/phpmailer/phpmailer/src/PHPMailer.php:1331
2 PHPMailer\PHPMailer\PHPMailer->setFrom() JROOT/libraries/src/Mail/Mail.php:203


Do you use this mailer or is this some old legacy muck? TY

Re: Joomla 5 Compatability

Posted: 17 Oct 2024, 16:22
by Jan
Hi, Phoca extensions don't use own mailer, mails are send by Joomla methods.

Which version of Joomla do you run? Which version of Phoca Cart?

Order status: order statuses send emails per Joomla methods, and you can set the content of the email. With new Joomla feature - Email Templates - there will be more features to set email layouts.

Jan

Re: Joomla 5 Compatability

Posted: 17 Oct 2024, 17:31
by landed
Hi Jan
Joomla version is 5.2.0
PC v is 5.0.0Beta79

preprocessForm() from your checkout model seems to be what is instigating it.

() JROOT/libraries/vendor/phpmailer/phpmailer/src/PHPMailer.php:1331 this looks like it could be what Joomla is using.

1331 is this line - throw new Exception($error_message);

public function setFrom($address, $name = '', $auto = true)
{
$address = trim((string)$address);
$name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
//Don't validate now addresses with IDN. Will be done in send().
$pos = strrpos($address, '@');
if (
(false === $pos)
|| ((!$this->has8bitChars(substr($address, ++$pos)) || !static::idnSupported())
&& !static::validateAddress($address))
) {
$error_message = sprintf(
'%s (From): %s',
$this->lang('invalid_address'),
$address
);
$this->setError($error_message);
$this->edebug($error_message);
if ($this->exceptions) {
throw new Exception($error_message);
}

return false;
}
$this->From = $address;
$this->FromName = $name;
if ($auto && empty($this->Sender)) {
$this->Sender = $address;
}

return true;
}

Re: Joomla 5 Compatability

Posted: 17 Oct 2024, 17:55
by Jan
Do you have whole trace to see which Phoca Cart function calls it?

Jan

Re: Joomla 5 Compatability

Posted: 17 Oct 2024, 18:55
by landed
0 Invalid address: (From):
Call Stack
# Function Location
1 () JROOT/libraries/vendor/phpmailer/phpmailer/src/PHPMailer.php:1331
2 PHPMailer\PHPMailer\PHPMailer->setFrom() JROOT/libraries/src/Mail/Mail.php:203
3 Joomla\CMS\Mail\Mail->setSender() JROOT/administrator/components/com_phocacart/libraries/phocacart/email/mail.php:116
4 PhocacartEmailMail->sendMailA() JROOT/administrator/components/com_phocacart/libraries/phocacart/email/email.php:104
5 PhocacartEmail::sendEmail() JROOT/administrator/components/com_phocacart/libraries/phocacart/order/status.php:764
6 PhocacartOrderStatus::changeStatus() JROOT/administrator/components/com_phocacart/libraries/phocacart/order/order.php:1234
7 PhocacartOrder->saveOrderMain() JROOT/components/com_phocacart/controllers/checkout.php:953
8 PhocaCartControllerCheckout->order() JROOT/libraries/src/MVC/Controller/BaseController.php:730
9 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/components/com_phocacart/phocacart.php:18
10 require_once() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
11 Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
12 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
13 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:218
14 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:261
15 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:306
16 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:58
17 require_once() JROOT/index.php:32

Re: Joomla 5 Compatability

Posted: 18 Oct 2024, 02:40
by jks88
I had the same issue. It seems like the guest checkout is responsible for the problem. Specifically, this model: /components/com_phocacart/models/checkout.php. I modified the loadFormData and loadFormDataGuest methods to ensure they always return an array or object, not false. Here's how you can adjust the methods:

Code: Select all

protected function loadFormData() {
    $formData = (array) Factory::getApplication()->getUserState('com_phocacart.checkout.data', array());

    if (empty($formData)) {
        $formData = $this->getItem();
        if (empty($formData)) {
            $formData = array();
        }
    }

    return $formData;
}

protected function loadFormDataGuest() {
    $formData = (array) Factory::getApplication()->getUserState('com_phocacart.checkout.data', array());

    if (empty($formData)) {
        $formData = $this->getItemGuest();
        if (empty($formData)) {
            $formData = array();
        }
    }

    return $formData;
}

Re: Joomla 5 Compatability

Posted: 18 Oct 2024, 12:41
by landed
Thanks, maybe mine has a different issue. Trying yours gave me a 500 error without any debug.