Skip to content

Latest commit

 

History

History
99 lines (68 loc) · 2.23 KB

File metadata and controls

99 lines (68 loc) · 2.23 KB

🏪 Power PC Store - Setup Guide

Quick Start (Without Database)

If you want to test the store immediately without setting up PostgreSQL, the system will work using localStorage (browser storage). The favorites, cart, and user features will work, but orders won't be saved to a database.

Complete Setup (With Database)

1. Install PostgreSQL

# Windows: Download from https://www.postgresql.org/download/
# macOS: brew install postgresql
# Linux: sudo apt install postgresql postgresql-contrib

2. Create Database

# Connect to PostgreSQL
psql -U postgres

# Create database
CREATE DATABASE powerpc_db;

# Connect to database
\c powerpc_db

3. Run Database Schema

# Run the SQL schema
psql -U postgres -d powerpc_db -f database.sql

4. Configure PHP

Edit api/db_config.php with your database credentials:

define('DB_HOST', 'localhost');
define('DB_PORT', '5432');
define('DB_NAME', 'powerpc_db');
define('DB_USER', 'postgres');          // Your PostgreSQL username
define('DB_PASS', 'your_password');     // Your PostgreSQL password

5. Test User Account

Features Available

✅ Working Without Database:

  • User registration/login (stored in browser)
  • Product catalog browsing
  • Add to cart/favorites
  • Favorites management
  • Cart management
  • Checkout flow

✅ Working With Database:

  • All above features
  • Orders saved to database
  • Order history
  • Real authentication
  • User profiles
  • Order tracking

Troubleshooting

500 Internal Server Error

If you get a 500 error when trying to place an order:

  1. Check if PostgreSQL is running
  2. Verify database credentials in api/db_config.php
  3. Ensure database and tables exist
  4. Check api/debug.log for specific errors

Common Issues:

  • "function year() doesn't exist" → Fixed in latest version
  • "connection refused" → PostgreSQL not running or wrong credentials
  • "relation does not exist" → Database tables not created

Development Notes

The system automatically falls back to localStorage if:

  • Database connection fails
  • API is unreachable
  • User chooses not to setup database

This allows testing the frontend without backend setup.