...
Code Block |
---|
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 = new Cookie('ps'); |
Change 'ps'
to 'psAdmin'
to read the employee cookie.
Customer Cookie
The following table contains the public variables in PrestaShop's customer cookie, which are related to the current visitor on your website:
Variable | Description |
---|---|
date_add | The date and time the cookie was created (in YYYY-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 listings. |
ajax_blockcart_display | Whether the cart block is "expanded" or "collapsed". |
Viewed | The IDs of recently viewed products as a comma-separated 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. |
id_connections | The connection ID of the visitor's current session. |
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. |
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. |
There are also variables for product customisation. For example, pictures_1 contains the filenames of the images the customer has uploaded to product 1 (in the upload directory) and textfields_1 contains the text the customer has uploaded to product 1. Use the following code to get the customisation files and textfields of product 1:
Code Block |
---|
$files = $cookie->getFamily('pictures_1');
$textFields = $cookie->getFamily('textFields_1');
|
Employee Cookie
The following table contains the public variables in PrestaShop's employee cookie, which relates to the employee who is currently logged in to the Back Office:
Variable | Description |
---|---|
date_add | The date and time the cookie was created (in YYYY-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. |
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. |
There are also pagination and filter variables stored in the employee cookie so that the state of the tables is saved. For example, the order_pagination variable stores how many orders are displayed per page and orderFilter_id_order stores the filter applied to the id_order column of the orders table.
Private Variables
These private cookie variables cannot be accessed directly like the public variables above.
Variable | Description |
---|---|
_name | The unique name of the cookie (the MD5 hash of "ps" for customer cookie or "psAdmin" for employee cookie and _COOKIE_KEY_ in config/settings.inc.php). |
_expire | The expiry date of the cookie. It can be changed using the setExpire function in classes/Cookie.php. By default, PrestaShop cookies expire after 1728000 seconds (or 20 days). This can be changed on line 65 (in PrestaShop v1.4.2) of classes/Cookie.php. |
_domain | The domain name of the website where the cookie was created. For example, yoursite.com. |
_path | The path of the website where the cookie was created. For example, /prestashop/. |
_bf | The Blowfish instance used to encrypt and decrypt the cookie. |
_key | The encrypted cookie key that is used by Blowfish to decrypt the cookie. |
_iv | The encrypted cookie iv that is used by Blowfish to decrypt the cookie. |
Database Structure
Here are descriptions of the database tables in PrestaShop v1.4.2. By default, each table has a prefix of ps_. When you install PrestaShop, you have the option of changing this prefix, which lets you install PrestaShop multiple times in the same database, and also helps to prevent table name conflicts with other shopping carts installed in the same database. The table names are all lowercase and use underscores between words, and include the types of objects in the table. For example, the ps_product table contains all the product information. Tables that end with _lang contain translations for the object. For example, ps_product_lang contains all the product translations. When a table links together two types of objects, both objects are included in the table name. For example, ps_category_product links products to categories. The ID of each table starts with id_ followed by the object name. For example, the ID of the ps_product table is id_product.
Table Name | Description | Primary Key |
---|---|---|
ps_access | The employee profile permissions. | id_profile, id_tab |
ps_accessory | Product accessories. | id_product_1, id_product_2 |
ps_address | Customer, manufacturer and supplier addresses. | id_address |
ps_address_format | Address format for each country. | id_country |
ps_alias | Search keyword alias | id_alias |
ps_attachment | Product attachments. | id_attachment |
ps_attachment_lang | Product attachment names and descriptions. | id_attachment, id_lang |
ps_attribute | Product attributes. | id_attribute |
ps_attribute_group | Product attribute groups. | id_attribute_group |
ps_attribute_group_lang | Product attribute group names. | id_attribute_group, id_lang |
ps_attribute_impact | Product attribute price and weight impacts. | id_attribute_impact |
ps_attribute_lang | Product attribute names. | id_attribute, id_lang |
ps_carrier | Carriers. | id_carrier |
ps_carrier_group | Carrier customer group restrictions. | id_carrier, id_group |
ps_carrier_lang | Carrier transit time messages. | id_carrier |
ps_carrier_zone | Zones each carrier is available | id_carrier, id_zone |
ps_cart | Customer and guest carts. | id_cart |
ps_cart_discount | Voucher codes used in carts. | id_cart, id_discount |
ps_cart_product | Products in customer carts. | id_cart, id_product, id_product_attribute |
ps_category | Product categories. | id_category |
ps_category_group | Product category customer group restrictions. | id_category, id_group |
ps_category_lang | Product category names and descriptions. | id_category, id_lang |
ps_category_product | Products in each category. | id_category, id_product |
ps_cms | CMS pages. | id_cms |
ps_cms_block | CMS blocks. | id_cms_block |
ps_cms_block_lang | CMS block names. | id_cms_block, id_lang |
ps_cms_block_page | CMS block pages. | id_cms_block_page |
ps_cms_category | CMS categories. | id_cms_category |
ps_cms_category_lang | CMS category names. | id_cms_category, id_lang |
ps_cms_lang | CMS page content. | id_cms, id_lang |
ps_configuration | Configuration settings. | id_configuration |
ps_configuration_lang | Configuration setting translations. | id_configuration, id_lang |
ps_connections | Visitor IP addresses, referrers and pages visited. | id_connections |
ps_connections_page | Start and end times of page visits. | id_connections, id_page, time_start |
ps_connections_source | Visitor referrers and search engine keywords. | id_connections_source |
ps_contact | Contact form subjects. | id_contact |
ps_contact_lang | Contact form subject names. | id_contact, id_lang |
ps_country | Countries. | id_country |
ps_country_lang | Country names. | id_country, id_lang |
ps_county | Counties | id_county |
ps_county_zip_code | County zip codes. | id_county, from_zip_code, to_zip_code |
ps_currency | Currencies. | id_currency |
ps_customer | Customers. | id_customer |
ps_customer_group | Customer groups. | id_customer, id_group |
ps_customer_message | Customer messages through contact form. | id_customer_message |
ps_customer_thread | Threads of messages through contact form. | id_customer_thread |
ps_customization | Customised product data in cart. | id_customization, id_cart, id_product |
ps_customization_field | Product customisation fields. | id_customization_field |
ps_customization_field_lang | Product customisation field names. | id_customization_field, id_lang |
ps_customized_data | Customised product data entered by customers. | id_customization, type, index |
ps_date_range | Page view date ranges. | id_date_range |
ps_delivery | Carrier delivery prices. | id_delivery |
ps_discount | Vouchers. | id_discount |
ps_discount_category | Voucher category restrictions. | id_category, id_discount |
ps_discount_lang | Voucher descriptions. | id_discount, id_lang |
ps_discount_type | Voucher types. | id_discount_type |
ps_discount_type_lang | Voucher type names. | id_discount_type, id_lang |
ps_editorial | Homepage logo links. | id_editorial |
ps_editorial_lang | Homepage text. | id_editorial, id_lang |
ps_employee | Back Office employees. | id_employee |
ps_feature | Product features. | id_feature |
ps_feature_lang | Product feature names. | id_feature, id_lang |
ps_feature_product | Links feature values to products. | id_feature, id_product |
ps_feature_value | Product feature values. | id_feature_value |
ps_feature_value_lang | Product feature value names. | id_feature_value, id_lang |
ps_group | Customer groups and reductions. | id_group |
ps_group_lang | Customer group names. | id_group, id_lang |
ps_group_reduction | Customer group category reductions. | id_group_reduction |
ps_guest | Guests. | id_guest |
ps_help_access | Viewed help articles and versions. | id_help_access |
ps_hook | Module hook names and descriptions. | id_hook |
ps_hook_module | Position of modules in each hook. | id_module, id_hook |
ps_hook_module_exceptions | Page exceptions for each module. | id_hook_module_exceptions |
ps_image | Product images. | id_image |
ps_image_lang | Product image legends. | id_image, id_lang |
ps_image_type | Product image thumbnail sizes. | id_image_type |
ps_import_match | Saved CSV import configurations. | id_import_match |
ps_lang | Languages. | id_lang |
ps_log | Log of PHP errors and warnings. | id_log |
ps_manufacturer | Manufacturers. | id_manufacturer |
ps_manufacturer_lang | Manufacturer descriptions. | id_manufacturer, id_lang |
ps_memcached_servers | Memcached servers. | id_memcached_server |
ps_message | Order messages. | id_message |
ps_message_readed | Order messages that have been marked as read. | id_message, id_employee |
ps_meta | Page names. | id_meta |
ps_meta_lang | Page meta information. | id_meta, id_lang |
ps_module | Modules directories. | id_module |
ps_module_country | Module country restrictions. | id_module, id_country |
ps_module_currency | Module currency restrictions. | id_module, id_currency |
ps_module_group | Module customer group restrictions. | id_module, id_group |
ps_operating_system | Recognised operating systems. | id_operating_system |
ps_orders | Orders. | id_order |
ps_order_detail | Order products. | id_order_detail |
ps_order_discount | Order vouchers. | id_order_discount |
ps_order_history | Order status history. | id_order_history |
ps_order_message | Predefined order messages. | id_order_message |
ps_order_message_lang | Predefined order message names. | id_order_message, id_lang |
ps_order_return | Merchandise returns. | id_order_return |
ps_order_return_detail | Merchandise return products. | id_order_return, id_order_detail, id_customization |
ps_order_return_state | Merchandise return statuses. | id_order_return_state |
ps_order_return_state_lang | Merchandise return status names. | id_order_return_state, id_lang |
ps_order_slip | Credit slips | id_order_slip |
ps_order_slip_detail | Credit slip products. | id_order_slip, id_order_detail |
ps_order_state | Order statuses. | id_order_state |
ps_order_state_lang | Order status names. | id_order_state, id_lang |
ps_pack | Product packs. | id_product_pack, id_product_item |
ps_page | Pages. | id_page |
ps_pagenotfound | Page not found data. | id_pagenotfound |
ps_page_type | Page names. | id_page_type |
ps_page_viewed | Viewed pages. | id_page, id_date_range |
ps_payment_cc | Credit card information. | id_payment_cc |
ps_product | Product information. | id_product |
ps_product_attribute | Product attribute information. | id_product_attribute |
ps_product_attribute_combination | Product attribute combinations. | id_attribute, id_product_attribute |
ps_product_attribute_image | Product attribute images. | id_product_attribute, id_image |
ps_product_country_tax | Product country taxes. | id_product, id_country, id_tax |
ps_product_download | Downloadable products. | id_product_download |
ps_product_group_reduction_cache | Product customer group reductions. | id_product, id_group |
ps_product_lang | Product names and descriptions. | id_product, id_lang |
ps_product_sale | Product sale data. | id_product |
ps_product_tag | Product tags. | id_product, id_tag |
ps_profile | Employee profile. | id_profile |
ps_profile_lang | Employee profile name. | id_profile, id_lang |
ps_quick_access | Back Office quick accesses. | id_quick_access |
ps_quick_access_lang | Back Office quick access names. | id_quick_access, id_lang |
ps_range_price | Carrier price ranges. | id_range_price |
ps_range_weight | Carrier weight ranges. | id_range_weight |
ps_referrer | Affiliate program accounts. | id_referrer |
ps_referrer_cache | Affiliate program referrals. | id_connections_source, id_referrer |
ps_required_field | Required fields. | id_required_field |
ps_scene | Category page product banners. | id_scene |
ps_scene_category | Links product banners to categories. | id_scene, id_category |
ps_scene_lang | Category page product banner names. | id_scene, id_lang |
ps_scene_products | Category page banner products. | id_scene, id_product, x_axis, y_axis |
ps_search_engine | Recognised search engines. | id_search_engine |
ps_search_index | PrestaShop search engine keyword index. | id_product, id_word |
ps_search_word | PrestaShop search engine keywords. | id_word |
ps_sekeyword | External search engine keywords. | id_sekeyword |
ps_specific_price | Specific prices. | id_specific_price |
ps_specific_price_priority | Specific price priorities. | id_specific_price_priority, id_product |
ps_state | States. | id_state |
ps_statssearch | PrestaShop search engine statistics. | id_statssearch |
ps_stock_mvt | Stock movements. | id_stock_mvt |
ps_stock_mvt_reason | Stock movement reasons. | id_stock_mvt_reason |
ps_stock_mvt_reason_lang | Stock movement reason names. | id_stock_mvt_reason, id_lang |
ps_store | Store addresses. | id_store |
ps_subdomain | Cookie subdomains. | id_subdomain |
ps_supplier | Suppliers. | id_supplier |
ps_supplier_lang | Supplier names. | id_supplier, id_lang |
ps_tab | Back Office tabs. | id_tab |
ps_tab_lang | Back Office tab names. | id_tab, id_lang |
ps_tag | Product tags used in tag cloud. | id_tag |
ps_tax | Taxes. | id_tax |
ps_tax_lang | Tax names. | id_tax, id_lang |
ps_tax_rule | Tax rules. | id_tax_rule |
ps_tax_rules_group | Tax rule names. | id_tax_rules_group |
ps_timezone | Timezones. | id_timezone |
ps_webservice_account | Webservice accounts. | id_webservice_account |
ps_webservice_permission | Webservice permissions. | id_webservice_permission |
ps_web_browser | Recognised web browsers | id_web_browser |
ps_zone | Carrier zones. | id_zone |