# PrestaShop

> E-commerce solution for online stores.

- Category: E-Commerce & Business
- Difficulty: beginner
- Components: prestashop, mysql
- Tags: prestashop, ecommerce, shop, php
- Source: https://docker.recipes/ecommerce/prestashop

## Overview

PrestaShop is an open-source e-commerce platform built on PHP that enables businesses to create professional online stores with comprehensive product management, order processing, and payment integration capabilities. Originally launched in 2007, PrestaShop has evolved into a feature-rich solution supporting over 300,000 merchants worldwide, offering multilingual and multi-currency support, extensive customization options through themes and modules, and robust inventory management tools that make it suitable for businesses ranging from small startups to large enterprises.

This Docker stack combines PrestaShop with MySQL 8.0 to create a complete e-commerce environment where PrestaShop handles the web storefront, administrative interface, and business logic while MySQL provides the relational database backend for storing product catalogs, customer data, orders, and configuration settings. The MySQL InnoDB storage engine ensures ACID compliance for financial transactions, while PrestaShop's modular architecture allows integration with payment gateways, shipping providers, and marketing tools through its extensive marketplace ecosystem.

This configuration is ideal for developers building e-commerce solutions, digital agencies deploying client stores, and businesses seeking a self-hosted alternative to SaaS platforms like Shopify. The combination provides complete control over data, unlimited customization possibilities, and the ability to integrate with existing business systems while avoiding monthly subscription fees and transaction-based pricing models typical of hosted e-commerce solutions.

## Features

- Multi-store management allowing multiple shops from single PrestaShop installation with shared or separate inventories
- Advanced product catalog system with unlimited categories, attributes, combinations, and digital product support
- Built-in SEO optimization tools including friendly URLs, meta tags management, and sitemap generation
- Comprehensive order management workflow with customizable statuses, automated emails, and invoice generation
- MySQL 8.0 JSON data type support for flexible product attribute storage and complex catalog structures
- Integrated customer relationship management with segmentation, loyalty programs, and purchase history tracking
- Extensive payment gateway ecosystem with 250+ payment modules including PayPal, Stripe, and regional providers
- Multi-currency and multi-language support with automatic currency conversion and localized checkout processes

## Use cases

- Small to medium businesses launching their first online store with professional e-commerce features
- Digital agencies developing custom e-commerce solutions for clients requiring specific integrations
- Retail businesses migrating from hosted platforms to gain full control over their online presence
- B2B companies needing wholesale pricing, customer-specific catalogs, and bulk ordering capabilities
- Multi-brand retailers managing multiple storefronts with shared inventory and centralized administration
- International businesses requiring multi-currency support and localized shopping experiences
- Developers prototyping e-commerce applications or testing payment gateway integrations

## Prerequisites

- Minimum 2GB RAM recommended for PrestaShop with MySQL 8.0 for optimal performance
- Port 8080 available on host system for accessing PrestaShop web interface
- Basic understanding of e-commerce concepts like product attributes, tax rules, and payment flows
- MySQL administration knowledge for database maintenance and performance optimization
- SSL certificate and domain configuration knowledge for production deployment
- Familiarity with PrestaShop module system for extending functionality

## docker-compose.yml

```yaml
services:
  prestashop:
    image: prestashop/prestashop:latest
    container_name: prestashop
    restart: unless-stopped
    environment:
      DB_SERVER: mysql
      DB_NAME: ${DB_NAME}
      DB_USER: ${DB_USER}
      DB_PASSWD: ${DB_PASSWORD}
    volumes:
      - prestashop_data:/var/www/html
    ports:
      - "8080:80"
    depends_on:
      - mysql
    networks:
      - prestashop

  mysql:
    image: mysql:8.0
    container_name: prestashop-mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
      MYSQL_DATABASE: ${DB_NAME}
      MYSQL_USER: ${DB_USER}
      MYSQL_PASSWORD: ${DB_PASSWORD}
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - prestashop

volumes:
  prestashop_data:
  mysql_data:

networks:
  prestashop:
    driver: bridge
```

## .env

```bash
DB_ROOT_PASSWORD=rootpassword
DB_NAME=prestashop
DB_USER=prestashop
DB_PASSWORD=changeme
```

## Usage notes

- Docs: https://docs.prestashop-project.org/
- Access at http://localhost:8080 - complete installation wizard
- IMPORTANT: Delete /install folder after setup for security
- Admin panel at /admin-dev (or renamed admin folder)
- Modules marketplace for payments, shipping, themes
- Auto-generated admin folder name shown during install

## Troubleshooting

- PrestaShop installation wizard shows database connection error: Verify DB_SERVER environment variable matches MySQL container name and ensure both containers are on same network
- MySQL container fails to start with 'data directory not empty': Remove mysql_data volume or ensure MYSQL_ROOT_PASSWORD matches existing database configuration
- PrestaShop admin panel shows 'For security reasons, you cannot connect to the admin panel': Delete or rename the /install directory from prestashop_data volume after completing setup wizard
- Product images not displaying correctly: Check file permissions in prestashop_data volume and ensure img/ directory is writable by web server
- Performance issues during peak traffic: Increase MySQL InnoDB buffer pool size and enable PrestaShop's built-in cache system through Performance settings
- Email notifications not sending from PrestaShop: Configure SMTP settings in Advanced Parameters > E-mail or set up mail server container in the stack

