Message-ID: <984549466.377120.1711614964257.JavaMail.root@confluence-doc2-production> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_377119_412220858.1711614964257" ------=_Part_377119_412220858.1711614964257 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html Managing Cookies

Managing Cookies

Managing Cookies

PrestaShop uses encrypted cookies to store all the session information, = for visitors/clients as well as for employees/administrators.

The Cookie class (/classes/Cookie.php) is used to read and = write cookies.

In order to access the cookies from within PrestaShop code, you can use = this:

=20
$this-&g=
t;context->cookie;
=20

All the information stored within a cookie is available using this code:=

=20
$this-&g=
t;context->cookie->variable;
=20

If you need to access the PrestaShop cookie from non-PrestaShop code, yo= u can use this code:

=20
include_=
once('path_to_prestashop/config/config.inc.php');
include_once('path_to_prestashop/config/settings.inc.php');
include_once('path_to_prestashop/classes/Cookie.php');
$cookie =3D new Cookie('ps'); // Use "psAdmin" to read an employee's cookie=
.
=20

Data stored = in a visitor/client's cookie

Token Description
date_add The date and time the cookie was created (in YYY= Y-MM-DD HH:MM:SS format).
id_lang The ID of the selected language.
id_currency The ID of the selected currency.
last_visited_category The ID of the last visited category of product l= istings.
ajax_blockcart_display Whether the cart block is "expanded" or "collaps= ed".
viewed The IDs of recently viewed products as a comma-s= eparated list.
id_wishlist The ID of the current wishlist displayed in the = wishlist block.
checkedTOS Whether the "Terms of service" checkbox has been= ticked (1 if it has and 0 if it hasn't)
id_guest The guest ID of the visitor when not logged in.<= /td>
id_connections The connection ID of the visitor's current sessi= on.
id_customer The customer ID of the visitor when logged in.
customer_lastname The last name of the customer.
customer_firstname The first name of the customer.
logged Whether the customer is logged in.
passwd The MD5 hash of the _COOKIE_KEY_ in= config/settings.inc.php and the password the customer used to= log in.
email The email address that the customer used to log = in.
id_cart The ID of the current cart displayed in the cart= block.
checksum The Blowfish checksum used to determine whether = the cookie has been modified by a third party.
The customer will be logg= ed out and the cookie deleted if the checksum doesn't match.

Dat= a stored in an employee/administrator's cookie

Token Description
date_add The date and time the cookie was created (in YYY= Y-MM-DD HH:MM:SS format).
id_lang The ID of the selected language.
id_employee The ID of the employee.
lastname The last name of the employee.
firstname The first name of the employee.
email The email address the employee used to log in.
profile The ID of the profile that determines which tabs= the employee can access.
passwd The MD5 hash of the _COOKIE_KEY_ in= config/settings.inc.php and the password the employee used to= log in.
checksum The Blowfish checksum used to determine whether = the cookie has been modified by a third party.
If the checksum doesn't m= atch, the customer will be logged out and the cookie is deleted .
------=_Part_377119_412220858.1711614964257--