### PHP Configuration Settings for PrestaShop
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/what-you-need-to-get-started
Essential PHP settings for PrestaShop 1.6 installation, configured in the php.ini file. Includes directives for URL fetching, global variables, security, and file uploads.
```php
allow_url_fopen = On
register_globals = Off
magic_quotes_* = Off
safe_mode = Off
upload_max_filesize = "16M"
```
--------------------------------
### PrestaShop CLI Installation with Arguments
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop-using-the-command-line-script
This example demonstrates how to perform a PrestaShop installation using the command-line script with essential arguments. It specifies the domain, database server, database name, username, and password for the installation.
```shell
$ php index_cli.php --domain=example.com --db_server=sql.example.com --db_name=prestashop --db_user=root --db_password=123456789
```
--------------------------------
### Install PHP cURL Extension (Linux/Mac)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
This command demonstrates how to install the cURL extension for PHP on Linux or macOS systems using the apt package manager. This is a prerequisite for utilizing the PrestaShop web service library.
```bash
sudo apt-get install php5-curl
```
--------------------------------
### Launching PrestaShop Auto-Installer
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop
This snippet shows how to access the PrestaShop auto-installer through a web browser. It covers both direct access to the '/install' folder and accessing it via a local web server. The installer automatically detects if PrestaShop is not yet installed.
```text
http://www.example.com/prestashop_folder/install
http://127.0.0.1/prestashop
```
--------------------------------
### Apache Module Settings for PrestaShop
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/what-you-need-to-get-started
Configuration settings for Apache web server modules necessary for PrestaShop 1.6. This includes enabling URL rewriting and disabling security or authentication modules.
```apache
mod_rewrite enabled
mod_security disabled
mod_auth_basic disabled
```
--------------------------------
### File Permissions CHMOD Examples
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop
Demonstrates how to change file and folder permissions on Unix/Linux systems using the CHMOD command or FTP clients. Explains common permission codes like 755, 775, and 777, along with security recommendations.
```Shell
chmod 755 folder_name
chmod 664 file_name
chmod 777 temp_folder
```
--------------------------------
### Required PHP Extensions for PrestaShop
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/what-you-need-to-get-started
A list of mandatory PHP extensions required for PrestaShop 1.6 to function correctly. These extensions need to be enabled in the php.ini configuration file.
```php
PDO_MySQL
cURL
SimpleXML
mcrypt
GD
OpenSSL
DOM
SOAP
Zip
```
--------------------------------
### Instantiate PrestaShopWebservice Object
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
This PHP code demonstrates how to create an instance of the `PrestaShopWebservice` class. It requires the store's root URL, an authentication key, and a boolean for debug mode.
```php
$webService = new PrestaShopWebservice('http://example.com/', 'ZR92FNY5UFRERNI3O9Z5QDHWKTP3YIIT', false);
```
--------------------------------
### Example XML Response for Customers
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
This is an example of the XML structure returned by the PrestaShop web service when requesting the 'customers' resource. It shows a root 'prestashop' element containing a 'customers' element, which in turn holds individual 'customer' elements with their IDs.
```xml
customer ID
customer ID
customer ID
...Other customer tags
```
--------------------------------
### Specify Resource for Web Service Call
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
This PHP code shows how to define the resource you want to interact with (in this case, 'customers') using an associative array as a parameter for the `get()` method.
```php
// The key-value array
$opt['resource'] = 'customers';
```
--------------------------------
### Include PrestaShop WebService Library
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
This PHP code snippet shows how to include the PrestaShop WebService Library file in your project. Ensure the `PSWebServiceLibrary.php` file is in the same directory or provide the correct path.
```php
require_once( './PSWebServiceLibrary.php' );
```
--------------------------------
### PHP Configuration Settings
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop
Highlights essential PHP configuration directives found in the php.ini file that affect PrestaShop functionality. This includes enabling/disabling specific features and ensuring proper server environment compatibility.
```INI
; allow_url_fopen = On
; register_globals = Off
; magic_quotes_gpc = Off
; extension=php_pdo_mysql.so
```
--------------------------------
### Execute PrestaShop CLI Installer
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop-using-the-command-line-script
This command initiates the PrestaShop command-line installer. After navigating to the '/install' or '/install-dev' directory via your terminal, this command will display available installation options and their default values.
```shell
$ php index_cli.php
```
--------------------------------
### Retrieve XML Data using get() Method
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
This PHP code snippet illustrates calling the `get()` method of the `PrestaShopWebservice` object with specified options to retrieve XML data from the web service.
```php
Retrieving the XML data
$xml = $webService->get($opt);
```
--------------------------------
### Local PrestaShop Access via Loopback Address
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop-on-your-computer
Demonstrates how to access a locally installed PrestaShop instance using loopback addresses. It shows the base URL and the installation URL, assuming PrestaShop is in a subfolder.
```text
http://localhost
http://127.0.0.1
http://localhost/prestashop
http://127.0.0.1/prestashop
http://localhost/prestashop/install
http://127.0.0.1/prestashop/install
```
--------------------------------
### Retrieve All Customers via PrestaShop Web Service
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
This PHP code snippet demonstrates how to retrieve a list of all customers from a PrestaShop store using the web service. It includes instantiation of the service object and a `try-catch` block for error handling.
```php
try {
// creating web service access
$webService = new PrestaShopWebservice('http://example.com/', 'ZR92FNY5UFRERNI3O9Z5QDHWKTP3YIIT', false);
// call to retrieve all customers
$xml = $webService->get(array('resource' => 'customers'));
}
catch (PrestaShopWebserviceException $ex) {
// Shows a message related to the error
echo 'Other error: ' . $ex->getMessage();
}
```
--------------------------------
### Retrieve Customers from XML
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
Retrieves customer resources from an XML object obtained via the PrestaShop web service. Assumes the XML structure has a 'customers' tag with customer data as children.
```php
$resources = $xml->customers->children();
```
--------------------------------
### Ruby Commands for Sass/Compass Installation and Usage
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/designer-guide/bootstrap-sass-and-compass-in-prestashop-1.6/using-sass
Provides essential Ruby command-line instructions for setting up Sass and Compass, including installation and project compilation. Assumes Ruby is already installed.
```ruby
gem install compass
```
```ruby
compass create
```
```ruby
compass watch
```
--------------------------------
### PrestaShop Store Naming Convention
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop
Provides a guideline for naming a PrestaShop store, specifically advising against the use of colons. It suggests using a dash as an alternative for separating parts of the store's title to avoid potential issues with features like email sending.
```Text
MyStore – The best place for items to buy
```
--------------------------------
### Basic PrestaShop install() Method Implementation
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/creating-a-prestashop-module/creating-a-first-module
Provides the minimal implementation for the `install()` method in a PrestaShop module. It ensures the parent class's installation process is called and returns a boolean indicating success or failure.
```php
public function install()
{
if (!parent::install()) {
return false;
}
return true;
}
```
--------------------------------
### Retrieve All Customers via HTTP GET Request
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-one-page-documentation
This example shows how to retrieve a list of all customers using a direct HTTP GET request to the PrestaShop API. It requires the API key and the base URL, returning the same XML data as the PHP webservice method.
```http
http://UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX@example.com/api/customers/
```
--------------------------------
### Connecting to MySQL with User Credentials
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/system-administrator-guide
This demonstrates how to connect to a MySQL server using command-line arguments for username and password.
```bash
mysql -u USERNAME -p PASSWORD
```
--------------------------------
### Web Service Setup and Access
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-one-page-documentation
Steps to enable the PrestaShop web service, generate an API key, and access the API endpoint from a browser.
```APIDOC
## Web Service Setup and Access
### Description
This section details the process of enabling the PrestaShop web service, creating an API access key, and accessing the API endpoint using a web browser. It covers necessary configurations and authentication methods.
### Method
N/A (Browser-based access)
### Endpoint
`http://your-shop.com/api/` or `http://your-shop.com/subfolder/api/`
### Parameters
#### Query Parameters
- **key** (string) - Required - Your generated API key for authentication.
### Request Example
**Accessing with API key in the URL:**
`http://[API_KEY]@[your-shop.com]/api/`
**Accessing with API key in a subfolder:**
`http://[API_KEY]@[your-shop.com]/prestashop/api/`
### Response
#### Success Response (200)
- XML response containing store data or resource lists.
#### Response Example
```xml
```
#### Error Response Example
```xml
```
```
--------------------------------
### PrestaShop Friendly URL Example
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/user-guide/understanding-the-preferences/seo-and-urls-preferences
Shows an example of a 'friendly URL' in PrestaShop, which is more informative for users and search engines.
```text
http://www.myprestashop.com/2-music-players/27-ipod-nano-green
```
--------------------------------
### PrestaShop Module Installation Process
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/creating-a-prestashop-module/creating-a-first-module
Describes the automatic actions taken by PrestaShop during module installation. This includes creating a 'config.xml' file for configuration and adding an entry to the 'ps_module' SQL table.
```text
PrestaShop automatically creates a small `config.xml` file in the module's folder.
PrestaShop also adds a row to the `ps_module` SQL table during the module installation.
```
--------------------------------
### Iterate and Display Customer IDs
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
Iterates through customer resources obtained from the web service and displays their attributes (typically IDs) as HTML line breaks. This is useful for listing customer identifiers.
```php
foreach ($resources as $resource)
echo $resource->attributes() . ' ';
```
--------------------------------
### Common phpMyAdmin Access URLs
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop-on-your-computer
Lists typical URLs used to access the phpMyAdmin tool for managing MySQL databases, depending on the AMP package installed. These URLs direct to the web-based interface for database operations.
```text
http://127.0.0.1/phpmyadmin
```
```text
http://127.0.0.1/mysql
```
--------------------------------
### Enable PHP cURL Extension (Windows)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
This snippet shows the configuration needed in the `php.ini` file to enable the cURL extension on a Windows system. cURL is a dependency for making HTTP requests to the PrestaShop web service.
```php
extension=php_curl.dll
```
--------------------------------
### PrestaShop 1.6 Image Thumbnail Example
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/designer-guide/bootstrap-sass-and-compass-in-prestashop-1.6/using-bootstrap
Provides an example of how to use PrestaShop 1.6 CSS classes to style images as thumbnails within a grid layout. Each thumbnail includes an image, caption, and description.
```html
label
description...
label
description...
```
--------------------------------
### PHP Web Service Error Handling Structure
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-3-first-steps-accessing-the-web-service-and-listing-customers
This PHP code outlines the basic structure for handling errors when interacting with the PrestaShop web service using `try-catch` blocks. Errors occurring within the `try` block are caught and handled in the `catch` block.
```php
try {
// Execution ( if an error occurs in this code, stops and goes in the catch block)
}
catch {
// Error handling (tries to catch the error or the error display)
}
```
--------------------------------
### Local Web Server Root Folders
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop-on-your-computer
Provides the default directory paths for the root folder of the local web server across different AMP packages. These are the locations where application files should be placed for local access.
```text
C:\easyphp\www
```
```text
/Applications/MAMP/htdocs/
```
```text
C:\wamp\www
```
```text
C:\xampp\htdocs
```
```text
/Applications/xampp/htdocs
```
--------------------------------
### Tracking URL Example
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/user-guide/managing-shipping/managing-carriers
An example of a tracking URL format provided by a carrier, where a placeholder '@' is used for the tracking number. This URL allows customers to track their shipments.
```text
http://www.colissimo.fr/portail_colissimo/suivreResultat.do?parcelnumber=@
```
--------------------------------
### MySQL Default Credentials
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop-on-your-computer
Specifies the common default username and password for the MySQL database server used by most AMP packages. This information is crucial for connecting to the database during application installation.
```text
User: root
Password: (empty)
```
--------------------------------
### PrestaShop Database Configuration Settings (PHP)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/system-administrator-guide
Defines the essential database connection parameters for a PrestaShop installation. These constants are used to establish a connection to the MySQL database server, specifying the server address, database name, username, password, and table prefix.
```php
define('_DB_SERVER_', '``sql.domainname.com``');
define('_DB_NAME_', 'prestashop');
define('_DB_USER_', 'PS-user');
define('_DB_PASSWD_', 'djsf15');
define('_DB_PREFIX_', 'ps_');
```
--------------------------------
### PrestaShop Core Controller Example
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/diving-into-prestashop-core-development/controllers-within-prestashop
Illustrates the file path and class naming convention for a core PrestaShop controller, specifically the Category controller.
```php
File: /controllers/CategoryController.php
Class: CategoryControllerCore
```
--------------------------------
### Accessing Localhost
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/getting-started/installing-prestashop-on-your-computer
This demonstrates how to access the local web server through a browser using the loopback address '127.0.0.1' or 'localhost'. These addresses point to the root folder of your local web server.
```text
http://127.0.0.1
```
--------------------------------
### Available HTTP Methods
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-reference
Details the supported HTTP methods (GET, POST, PUT, DELETE, HEAD) for various resources and notes exceptions.
```APIDOC
## Available HTTP Methods
### Description
Most methods support RESTful interactions using GET, POST, PUT, DELETE, and HEAD. Some resources have limited method support:
- `search`: Supports GET and HEAD only.
- `stock_availables`: Supports GET, POST, and HEAD only.
- `stock_movements`: Supports GET and HEAD only.
- `stocks`: Supports GET and HEAD only.
- `supply_order_details`: Supports GET and HEAD only.
- `supply_order_histories`: Supports GET and HEAD only.
- `supply_order_receipt_histories`: Supports GET and HEAD only.
- `supply_order_states`: Supports GET and HEAD only.
- `supply_orders`: Supports GET and HEAD only.
- `warehouse_product_locations`: Supports GET and HEAD only.
- `warehouses`: Supports GET, POST, PUT, and HEAD.
### Optional URL Parameters
- `?blank`: Returns a blank XML tree of the chosen object.
- `?synopsis`: Returns a blank XML tree with expected value formats and indicators (required status, max character size).
```
--------------------------------
### Fetch All Customers with Error Handling (PHP)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-one-page-documentation
A complete example of fetching all customers using the PrestaShop webservice. It includes initializing the connection within a try block and displaying any caught PrestaShopWebserviceException messages.
```php
try {
// creating webservice access
$webService = new PrestaShopWebservice('http://example.com/', 'UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX', false);
// call to retrieve all clients
$xml = $webService->get(array('resource' => 'customers'));
}
catch (PrestaShopWebserviceException $ex) {
// Shows a message related to the error
echo 'Other error: ' . $ex->getMessage();
}
```
--------------------------------
### PrestaShop Default URL Example
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/user-guide/understanding-the-preferences/seo-and-urls-preferences
Illustrates a default, uninformative PrestaShop URL for a product page, highlighting the need for friendly URLs.
```text
http://www.myprestashop.com/product.php?id_product=27
```
--------------------------------
### Advanced PrestaShop install() Method with Checks and Configuration
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/creating-a-prestashop-module/creating-a-first-module
Illustrates an expanded `install()` method for PrestaShop modules. This version includes checks for PrestaShop features like Multistore, registers module hooks (`leftColumn`, `header`), and sets a configuration value (`MYMODULE_NAME`).
```php
public function install()
{
if (Shop::isFeatureActive()) {
Shop::setContext(Shop::CONTEXT_ALL);
}
if (!parent::install() ||
!$this->registerHook('leftColumn') ||
!$this->registerHook('header') ||
!Configuration::updateValue('MYMODULE_NAME', 'my friend')
) {
return false;
}
return true;
}
```
--------------------------------
### PrestaShop Feature URL Examples
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/user-guide/managing-the-catalog/managing-product-features
Examples of how product variation URLs are formed using feature values in PrestaShop. These URLs help customers share specific product variations and improve search engine visibility.
```plaintext
#/color-metal
```
```plaintext
#/disk_space-16gb/color-green
```
--------------------------------
### Dashboard Module Install Method (PHP)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/creating-a-prestashop-module/1.6-specific-developer-documentation/creating-a-dashboard-module
Installs a PrestaShop dashboard module by calling the parent install method and registering specific dashboard hooks like 'dashboardZoneTwo' and 'dashboardData'. Returns false if any registration fails.
```PHP
public function install()
{
if (!parent::install()
|| !$this->registerHook('dashboardZoneTwo')
|| !$this->registerHook('dashboardData'))
return false;
return true;
}
```
--------------------------------
### PrestaShop 1.6 Button Styling Examples
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/designer-guide/bootstrap-sass-and-compass-in-prestashop-1.6/using-bootstrap
Provides examples of various button styles in PrestaShop 1.6, including disabled states, different appearances (default), and link-like buttons. Uses standard Bootstrap button classes.
```html
{l s='Add to cart'}{l s='More'}
```
--------------------------------
### Create a New Compass Project
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/designer-guide/bootstrap-sass-and-compass-in-prestashop-1.6/using-compass
Initializes a new project with the necessary configuration files for Compass. This command should be run within the theme's folder in your PrestaShop installation.
```ruby
compass create
```
--------------------------------
### Install Compass
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/designer-guide/bootstrap-sass-and-compass-in-prestashop-1.6/using-compass
Installs the Compass framework globally using Ruby's gem package manager. Compass is a CSS Authoring Framework that makes your stylesheets more readable, easier to maintain, and easier to scale.
```ruby
gem install compass
```
--------------------------------
### Instantiate the DB Class - PrestaShop
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/best-practices-of-the-db-class
Demonstrates the recommended way to get an instance of the PrestaShop Db class for database operations. It also shows an alternative for connecting to MySQL slave servers for read-only queries.
```php
$db = Db::getInstance();
```
```php
$db = Db::getInstance(_PS_USE_SQL_SLAVE_);
```
--------------------------------
### Recommended PHP Configuration Settings for PrestaShop
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/system-administrator-guide
These PHP settings are recommended for optimal performance and security in PrestaShop. Ensure these directives are set correctly in your php.ini file or via server configuration.
```ini
register_globals = Off
magic_quotes_gpc = Off
allow_url_include = Off
safe_mode = Off
safe_mode_gid = Off
```
--------------------------------
### PrestaShop renderForm() Method using HelperForm (PHP)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/creating-a-prestashop-module/1.6-specific-developer-documentation/making-your-module-work-with-bootstrap
This PHP code snippet shows the modern `renderForm()` method, which uses the HelperForm class to build a form in a more structured, portable, and responsive manner.
```php
public function renderForm()
{
$fields_form = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'switch',
'label' => $this->l('Ajax cart'),
'name' => 'PS_BLOCK_CART_AJAX',
'is_bool' => true,
'desc' => $this->l('Activate AJAX mode for cart (compatible with the default theme)'),
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'active_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
)
),
'submit' => array(
'title' => $this->l('Save'),
'class' => 'btn btn-default pull-right')
),
);
$helper = new HelperForm();
```
--------------------------------
### PrestaShop 1.6 Navigation Tabs Example
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/designer-guide/bootstrap-sass-and-compass-in-prestashop-1.6/using-bootstrap
Illustrates the implementation of navigation tabs using PrestaShop 1.6 CSS classes. This example includes a dropdown menu functionality for one of the tabs, requiring JavaScript for toggling.
```html
```
--------------------------------
### PrestaShop Commit Message Examples
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/contributing-to-prestashop/how-to-write-a-commit-message
Examples demonstrating the correct formatting for commit messages in PrestaShop, covering different categories like Back Office (BO), Front Office (FO), and Modules (MO).
```git commit
BO: Fixed bug while updating images in AdminProduct
```
```git commit
FO: You can now buy products without TVA
```
```git commit
MO: New RSS Feed module
```
--------------------------------
### Get XML Synopsis for Resource (URL)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-one-page-documentation
This URL retrieves an XML document containing a synopsis for a specified resource (e.g., manufacturers). It includes indications of the expected value for each tag, aiding in the creation of new entries.
```url
http://UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX@example.com/api/manufacturers?schema=synopsis
```
--------------------------------
### Customers API
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-tutorial/chapter-2-discovery-testing-your-access-to-the-web-service-with-the-browser
Provides endpoints for managing customer data. Supports GET, PUT, POST, and DELETE operations.
```APIDOC
## GET /api/customers
### Description
Retrieves a list of all customers.
### Method
GET
### Endpoint
/api/customers
### Parameters
#### Query Parameters
- **schema** (string) - Optional - Specifies the schema to retrieve (e.g., 'blank', 'synopsis').
### Response
#### Success Response (200)
- **prestashop** (object) - Contains a list of customer elements.
- **customers** (object)
- **customer** (array) - List of customer objects, each with an 'id' and an 'xlink:href'.
### Response Example
```xml
...
```
```
```APIDOC
## GET /api/customers/{id}
### Description
Retrieves detailed information for a specific customer by their ID.
### Method
GET
### Endpoint
/api/customers/{id}
### Parameters
#### Path Parameters
- **id** (integer) - Required - The unique identifier of the customer.
### Response
#### Success Response (200)
- **prestashop** (object) - Contains the customer's detailed information.
- **customer** (object)
- **id** (integer) - The customer's ID.
- **lastname** (string) - The customer's last name.
- **firstname** (string) - The customer's first name.
- **email** (string) - The customer's email address.
- ... (other customer attributes)
### Response Example
```xml
...
```
```
```APIDOC
## POST /api/customers
### Description
Creates a new customer.
### Method
POST
### Endpoint
/api/customers
### Parameters
#### Request Body
- **customer** (object) - Required - The customer data to create.
- **lastname** (string) - Required - The customer's last name.
- **firstname** (string) - Required - The customer's first name.
- **email** (string) - Required - The customer's email address.
- **passwd** (string) - Required - The customer's password.
- ... (other customer attributes)
### Request Example
```json
{
"customer": {
"lastname": "Smith",
"firstname": "Jane",
"email": "jane.smith@example.com",
"passwd": "securepassword123"
}
}
```
### Response
#### Success Response (201 Created)
- **prestashop** (object) - Contains the created customer's information, including its new ID and self-link.
- **customer** (object)
- **id** (integer) - The ID of the newly created customer.
- **xlink:href** (string) - The URL to access the newly created customer.
#### Response Example
```xml
```
```
```APIDOC
## PUT /api/customers/{id}
### Description
Updates an existing customer's information.
### Method
PUT
### Endpoint
/api/customers/{id}
### Parameters
#### Path Parameters
- **id** (integer) - Required - The unique identifier of the customer to update.
#### Request Body
- **customer** (object) - Required - The updated customer data.
- **lastname** (string) - Optional - The customer's last name.
- **firstname** (string) - Optional - The customer's first name.
- **email** (string) - Optional - The customer's email address.
- ... (other customer attributes)
### Request Example
```json
{
"customer": {
"email": "jane.smith.updated@example.com"
}
}
```
### Response
#### Success Response (200 OK)
- **prestashop** (object) - Confirms the update, often returning the updated customer's ID and self-link.
- **customer** (object)
- **id** (integer) - The ID of the updated customer.
- **xlink:href** (string) - The URL to access the updated customer.
#### Response Example
```xml
```
```
```APIDOC
## DELETE /api/customers/{id}
### Description
Deletes a specific customer by their ID.
### Method
DELETE
### Endpoint
/api/customers/{id}
### Parameters
#### Path Parameters
- **id** (integer) - Required - The unique identifier of the customer to delete.
### Response
#### Success Response (200 OK or 204 No Content)
- A successful deletion typically returns a 200 OK or 204 No Content status code, with no response body or a minimal confirmation message.
#### Response Example
(No response body expected for a successful deletion, or a simple confirmation)
```xml
```
```
--------------------------------
### Basic HTML Content
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/creating-a-prestashop-module/displaying-content-on-the-front-office
A simple HTML snippet representing raw text content displayed on a page. This is a basic example of what might be output before theme integration.
```html
Welcome to this page!
```
--------------------------------
### PrestaShop 1.6 DB Backup Tool Example
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/updating-prestashop/making-and-restoring-your-own-backup
This section describes using PrestaShop's native DB Backup tool to create a database backup archive. The tool generates a compressed SQL file.
```text
1. Read the disclaimer, and click on the "I have read the disclaimer - Create a new backup". PrestaShop creates a zip archive of all your database tables.
2. Click on the latest backup file in the table below the disclaimer. This should make your browser download the backup archive, typically named like "`1349964600-71d48cfe.sql.bz2`". Save that file in your backup folder.
```
--------------------------------
### PrestaShop displayForm() Method (PHP)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/creating-a-prestashop-module/1.6-specific-developer-documentation/making-your-module-work-with-bootstrap
This PHP code snippet shows the original `displayForm()` method in the blockcart module, which generates an HTML form using raw HTML strings.
```php
public function displayForm()
{
return '
';
}
```
--------------------------------
### PHP CodeSniffer Command Line Usage (Linux)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/coding-standards/php-coding-standards/pre-1.6
Illustrates how to install and use PHP CodeSniffer from the command line on Linux systems, including setting up the PrestaShop standard and running validation checks.
```bash
$> apt-get install php-pear
```
```bash
$> pear install PHP_CodeSniffer
```
```bash
$> git clone "https://github.com/PrestaShop/PrestaShop-norm-validator" /usr/share/php/PHP/CodeSniffer/Standards/Prestashop
```
```bash
$> phpcs --config-set default_standard Prestashop
```
```bash
$> phpcs --standard=/path/to/norm/Prestashop /folder/or/fileToCheck
```
```bash
$> phpcs --standard=/path/to/norm/Prestashop --warning-severity=99 /folder/or/fileToCheck
```
--------------------------------
### Get Blank or Synopsis Schema for Resource
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/developer-tutorials/using-the-prestashop-web-service/web-service-one-page-documentation
Obtain a blank or synopsis XML schema for a resource to help in creating new entries or updating existing ones.
```APIDOC
## GET /api/[resource]?schema=[blank|synopsis]
### Description
Retrieve a blank or synopsis XML schema for a specified resource.
### Method
GET
### Endpoint
http://[API_KEY]@[HOST]/api/[resource]?schema=[blank|synopsis]
### Parameters
#### Query Parameters
- **schema** (string) - Required - Specifies the type of schema to retrieve ('blank' or 'synopsis').
### Request Example
```
// Get blank schema for manufacturers
http://UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX@example.com/api/manufacturers?schema=blank
// Get synopsis schema for manufacturers
http://UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX@example.com/api/manufacturers?schema=synopsis
```
### Response
#### Success Response (200)
- **xml** - An XML document representing the requested schema.
#### Response Example
(XML content will vary based on the resource and schema type)
```
--------------------------------
### PrestaShop getContent() Before Refactoring (PHP)
Source: https://docs.prestashop-project.org/1-6-documentation/english-documentation/developer-guide/creating-a-prestashop-module/1.6-specific-developer-documentation/making-your-module-work-with-bootstrap
This PHP code snippet shows the original `getContent()` method of the blockcart module before integration with Bootstrap. It directly outputs HTML and calls `displayForm()`.
```php
public function getContent()
{
$output = '
'.$this->displayName.'
';
if (Tools::isSubmit('submitBlockCart'))
{
$ajax = Tools::getValue('cart_ajax');
if ($ajax != 0 && $ajax != 1)
$output .= '