Jump to content

Edit History

Titi2

Titi2

On 2/8/2020 at 12:26 PM, Kogkalidis said:

There is better way to do so in 1.7.x versions.

You make a function in the respective controller

private function _getSession()
{
	return \PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance()->get('session');
}

And then where you need it, first you assign using

$this->_getSession()->set('yourVariableName', $wanted_value);

then where you need to get the value

$choice = $this->_getSession()->get('yourVariableName');

 

I'm facing the same problem. the hook i use is fired 3 times. It's not an elegant fix but atleast your solution it's working.

Thanks!

 

Titi2

Titi2

On 2/8/2020 at 12:26 PM, Kogkalidis said:

There is better way to do so in 1.7.x versions.

You make a function in the respective controller

private function _getSession()
{
	return \PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance()->get('session');
}

And then where you need it, first you assign using

$this->_getSession()->set('yourVariableName', $wanted_value);

then where you need to get the value

$choice = $this->_getSession()->get('yourVariableName');

I'm facing the same problem. the hook i use is fired 3 times. It's not an elegant fix but atleast your solution it's working.

Thanks!

Titi2

Titi2

On 2/8/2020 at 12:26 PM, Kogkalidis said:

There is better way to do so in 1.7.x versions.

You make a function in the respective controller

private function _getSession()
{
	return \PrestaShop\PrestaShop\Adapter\SymfonyContainer::getInstance()->get('session');
}

And then where you need it, first you assign using

$this->_getSession()->set('yourVariableName', $wanted_value);

then where you need to get the value

$choice = $this->_getSession()->get('yourVariableName');


I'm facing the same problem. the hook i use is fired 3 times. It's not an elegant fix but atleast your solution it's working.

Thanks!

 

×
×
  • Create New...