[SOLVED] Locale object not available

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
boettner
Advanced
Posts: 136
Joined: 09 Feb 2015, 17:49

[SOLVED] Locale object not available

Post by boettner » 10 Oct 2019, 14:54

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.
Last edited by boettner on 10 Oct 2019, 15:47, edited 1 time in total.

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: Locale object not available

Post by aimeos » 10 Oct 2019, 15:08

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?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

boettner
Advanced
Posts: 136
Joined: 09 Feb 2015, 17:49

Re: Locale object not available

Post by boettner » 10 Oct 2019, 15:10

The Aimeos static TS and our custom TS for Aimeos is present on the root page.

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: Locale object not available

Post by aimeos » 10 Oct 2019, 15:41

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();
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

boettner
Advanced
Posts: 136
Joined: 09 Feb 2015, 17:49

Re: Locale object not available

Post by boettner » 10 Oct 2019, 15:46

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!

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: [SOLVED] Locale object not available

Post by aimeos » 10 Oct 2019, 15:53

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?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

boettner
Advanced
Posts: 136
Joined: 09 Feb 2015, 17:49

Re: [SOLVED] Locale object not available

Post by boettner » 11 Oct 2019, 05:59

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.

Post Reply