Shopware 5 Cache / Price

60 views Asked by At

Good morning,

I change the customer group in the session on Enlight_Controller_Action_PreDispatch.

if ('private' === $customerGroup) {
  $this->session->offsetSet('sUserGroup', 'EK');
  $this->session->offsetSet('sOutputNet', 0);
  $this->session->offsetSet('sUserGroupData', ['id' => 1, 'groupkey' => 'EK']);
} else {
  $this->session->offsetSet('sUserGroup', 'H');
  $this->session->offsetSet('sOutputNet', 1);
  $this->session->offsetSet('sUserGroupData', ['id' => 2, 'groupkey' => 'H']);
}

In the frontend is a form where you can chooose between gross and net. Without httpCache it works.

With cache you have to load the page 2 times. Then it works, too.

I have added a cache cookie (https://developers.shopware.com/developers-guide/http-cache/#cache-cookie). The X-Content-Digest value changes. But the result is same. I have to load the page 2 times.

Does anyone have an idea?

Thx, ottscho

0

There are 0 answers