# cookies in shopware

**URL:** <https://forum.shopware.com/t/cookies-in-shopware/28794>\
**Category:** Allgemein\
**Created:** [10. Juli 2015 um 16:00 UTC](https://forum.shopware.com/t/cookies-in-shopware/28794 "2015-07-10T16:00:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kerstin83](https://avatars.discourse-cdn.com/v4/letter/k/49beb7/32.png) [@Kerstin83](https://forum.shopware.com/u/Kerstin83)\
**Post date:** [10. Juli 2015 um 16:00 UTC](https://forum.shopware.com/t/cookies-in-shopware/28794/1 "2015-07-10T16:00:40Z")

</div>

Liebes Forum 🙂 🙂 wie verwendet man cookies shopware-conform. Wie kann man sie setzen und wie kann man sie einlesen (evtl. auch die von shopware ohnehin gesetzten) ? Gibt es so etwas wie shopware() … -\>setCookie() und shopware() … -\>getCookie() ? Wie ist die Syntax? Ist das vielleicht irgendwo dokumentiert) Liebe Grüße Kerstin

---

<div class="post-metadata">

**Author:** ![Creatixx](https://avatars.discourse-cdn.com/v4/letter/c/c67d28/32.png) [@Creatixx](https://forum.shopware.com/u/Creatixx)\
**Post date:** [10. Juli 2015 um 18:04 UTC](https://forum.shopware.com/t/cookies-in-shopware/28794/2 "2015-07-10T18:04:05Z")

</div>

Hi Kerstin, hast du [das](http://forum.shopware.com/programmierung-f103/if-no-cookie-set-redirect-t27074.html#p118489) schon gesehen? Gruß

---

<div class="post-metadata">

**Author:** ![Kerstin83](https://avatars.discourse-cdn.com/v4/letter/k/49beb7/32.png) [@Kerstin83](https://forum.shopware.com/u/Kerstin83)\
**Post date:** [10. Juli 2015 um 19:45 UTC](https://forum.shopware.com/t/cookies-in-shopware/28794/3 "2015-07-10T19:45:33Z")

</div>

danke, ist ja schon mal ein Anfang. Wie wird denn der value des cookies ausgelesen ? Und wie ist die Syntax für das Setzen eines cookies? Liebe Grüße Kerstin

---

<div class="post-metadata">

**Author:** ![Shopwareianer](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Shopwareianer](https://forum.shopware.com/u/Shopwareianer)\
**Post date:** [10. Juli 2015 um 20:16 UTC](https://forum.shopware.com/t/cookies-in-shopware/28794/4 "2015-07-10T20:16:44Z")

</div>

> [@Kerstin83](#):
>
> danke, ist ja schon mal ein Anfang. Wie wird denn der value des cookies ausgelesen ? Und wie ist die Syntax für das Setzen eines cookies? Liebe Grüße Kerstin

---

<div class="post-metadata">

**Author:** ![\_chuuuing](https://avatars.discourse-cdn.com/v4/letter/_/dec6dc/32.png) [@\_chuuuing](https://forum.shopware.com/u/_chuuuing)\
**Post date:** [8. Dezember 2017 um 14:49 UTC](https://forum.shopware.com/t/cookies-in-shopware/28794/5 "2017-12-08T14:49:23Z")

</div>

habe&nbsp;reine&nbsp;PHP function genutzt, ohne Shopware()-\>…

\> to set cookie:

```
setCookie('newsletter_popup', $this->datetime, time()+3600*24*30);

```

\> to get cookie:

```
$newsletter_popup = $_COOKIE[$newsletter_popup];      

```

&nbsp;

---

<div class="post-metadata">

**Author:** ![\_chuuuing](https://avatars.discourse-cdn.com/v4/letter/_/dec6dc/32.png) [@\_chuuuing](https://forum.shopware.com/u/_chuuuing)\
**Post date:** [8. Dezember 2017 um 14:51 UTC](https://forum.shopware.com/t/cookies-in-shopware/28794/6 "2017-12-08T14:51:18Z")

</div>

und in Smarty wird cookie zugegriffen und als Array ausgegeben(zu testen wenn es nötig)&nbsp;durch:

```
{print_r($smarty.cookies)}

```

&nbsp;

> [@\_chuuuing\_ schrieb:](https://forum.shopware.com/profile/26053/_chuuuing_ "\_chuuuing\_")
> 
> habe&nbsp;reine&nbsp;PHP function genutzt, ohne Shopware()-\>…
> 
> \> to set cookie:
> 
> setCookie(‚newsletter\_popup‘, $this-\>datetime, time()+3600_24_30);
> 
> \> to get cookie:
> 
> $newsletter\_popup = $\_COOKIE[$newsletter\_popup];
> 
> &nbsp;
