Page 1 of 1
[SOLVED] Locale object not available
Posted: 10 Oct 2019, 14:54
by boettner
Hi all,
when logging out of TYPO3 (9.5.9, aimeos 18.10.9) I get a
Code: Select all
(1/1) Aimeos\MShop\Exception
Locale object not available
in /var/www/clients/client18/web67/web/typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/lib/mshoplib/src/MShop/Context/Item/Standard.php line 354
*/
public function getLocale()
{
if( !isset( $this->locale ) ) {
throw new \Aimeos\MShop\Exception( sprintf( 'Locale object not available' ) );
}
return $this->locale;
}
This doesn´t happen when I´m logging out from a page with shop plugins installed on. Is it a problem with my setup or have I found a real issue?
Best
Robert.
Re: Locale object not available
Posted: 10 Oct 2019, 15:08
by aimeos
Seems to be introduced by this contribution:
https://github.com/aimeos/aimeos-typo3/ ... 6323c75de8
There's probably the Aimeos configuration missing on the other pages. Does assigning the Aimeos TS to the root page fixes the problem?
Re: Locale object not available
Posted: 10 Oct 2019, 15:10
by boettner
The Aimeos static TS and our custom TS for Aimeos is present on the root page.
Re: Locale object not available
Posted: 10 Oct 2019, 15:41
by aimeos
Does is work if you replace the logout function (
https://github.com/aimeos/aimeos-typo3/ ... e.php#L271) using this code:
Code: Select all
$context = self::getContext( self::getConfig() );
$context->setLocale( self::getLocale( $context ) );
\Aimeos\Controller\Frontend::create( $context, 'basket' )->clear();
Re: Locale object not available
Posted: 10 Oct 2019, 15:46
by boettner
Yes, but for 18.10.9 it has to be:
Code: Select all
$context = self::getContext( self::getConfig() );
$context->setLocale( self::getLocale( $context ) );
\Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' )->clear();
Thanks for your ultra-fast help!
Re: [SOLVED] Locale object not available
Posted: 10 Oct 2019, 15:53
by aimeos
Ultra fast e-commerce, ultra fast help
I've seen that there's already another fix for that in 2018.10 branch using that code:
Code: Select all
$session = self::getContext( self::getConfig() )->getSession();
foreach( $session->get( 'aimeos/basket/cache', [] ) as $key => $value ) {
$session->set( $key, null );
}
foreach( $session->get( 'aimeos/basket/list', [] ) as $key => $value ) {
$session->set( $key, null );
}
Can you use 2018.10.x-dev and test if that works too?
Re: [SOLVED] Locale object not available
Posted: 11 Oct 2019, 05:59
by boettner
Yes, can confirm it working with the the snippet only.
I will yet have to do a test with the whole 2018.10.x-dev package though. Will report back when done but it will be next week. This is just for a quick reply.