# Setup Instructions — Noble Collectable

Complete guide for getting the store running locally and deploying to production.

---

## Part 1: Local Development (Phase 2)

### Prerequisites
- Docker & Docker Compose installed
- Git (for version control)
- ~20 minutes

### Step 1: Start Docker Environment

```bash
cd noblecollectable
docker-compose up -d
```

Docker will:
- Start MySQL database container
- Start WordPress PHP 8.2 container
- Create the database `noblecollectable`
- Mount local `wp-content` directory for live editing

**Access WordPress:**
- Admin: `http://localhost:8000/wp-admin`
- Site: `http://localhost:8000`

### Step 2: Complete WordPress Setup

1. Visit `http://localhost:8000`
2. Choose language (English recommended)
3. Fill in database details:
   - Database: `noblecollectable`
   - User: `wordpress`
   - Password: `wordpress_dev_password`
   - Host: `db`
4. Set site title, admin user, password, email
5. Finish setup

### Step 3: Install Required Plugins

Via WordPress Admin:

1. **WooCommerce**
   - Plugins → Add New
   - Search "WooCommerce"
   - Install & Activate
   - Complete WooCommerce setup wizard

2. **Polylang** (Bilingual support)
   - Plugins → Add New
   - Search "Polylang"
   - Install & Activate
   - Languages → Add French & English

3. **Stripe for WooCommerce** (Payments)
   - Plugins → Add New
   - Search "Stripe"
   - Install & Activate

4. **WP Smush** (Image optimization)
   - Plugins → Add New
   - Search "WP Smush"
   - Install & Activate

5. **Noble Collectable Setup** (Auto-configuration)
   - Via FTP/SFTP or File Manager: Upload `wp-content/plugins/noblecollectable-setup/`
   - Activate plugin
   - Plugin automatically:
     - Creates product attributes (Grade, Grader, Condition, Edition Type)
     - Creates 10 sample products
     - Shows setup complete notice

### Step 4: Activate Noble Collectable Theme

1. Appearance → Themes
2. Look for "Noble Collectable"
3. Click "Activate"
4. Customize → Site Identity
   - Upload logo from `brand/logo/noblecollectable-logo-primary.svg`
   - Set tagline: "Graded & Authenticated Football Cards"

### Step 5: Configure WooCommerce

Navigate to **WooCommerce** → **Settings**:

**General:**
- Store address
- Store currency (EUR, USD, GBP, etc.)

**Products:**
- Product images (standard sizes)
- Reviews: Enable (optional)

**Shipping:**
- Add zones:
  - "EU Standard" (EUR countries, €10, 5-7 days)
  - "EU Express" (EUR countries, €20, 1-2 days)
  - "Worldwide" (all countries, €25, 14-21 days)

**Tax:**
- Set up VAT if applicable (EU: 17-27%)

**Payments:**
- Later in Step 6

### Step 6: Configure Stripe (Test Mode)

1. Create free Stripe account: https://stripe.com
2. Get test API keys (don't use live keys locally!)
3. WooCommerce → Settings → Payments → Stripe
4. Enter test API keys
5. Enable "Test Mode"
6. Save

**Test card:** `4242 4242 4242 4242`, any future date, any CVC

### Step 7: Set Up Bilingual (FR/EN)

1. Languages → Settings
2. Add French
3. Set URL structure: "/fr/" prefix
4. Translate strings:
   - Strings → Scan for untranslated
   - Translate common UI strings to French

### Step 8: Verify Everything Works

- [ ] Visit shop: `http://localhost:8000/shop`
- [ ] Click product, add to cart
- [ ] Proceed to checkout
- [ ] Test Stripe with test card
- [ ] Switch to French: `http://localhost:8000/fr`
- [ ] Verify bilingual site works

---

## Part 2: Prepare for Production (Phase 3)

### Create Backup

```bash
# Database export
docker exec noblecollectable_db mysqldump -u wordpress -pwordpress_dev_password noblecollectable > backup-local.sql

# Files backup
cp -r wp-content backup-wp-content-$(date +%Y%m%d)
```

### Prepare cPanel Hosting

1. Sign up for cPanel hosting (or use existing)
2. Create new account/domain (e.g., `noblecollectable.com`)
3. Get cPanel login credentials
4. Note database access info

### Export from Local to cPanel

**On your local machine:**

```bash
# Export database
docker exec noblecollectable_db mysqldump -u wordpress -pwordpress_dev_password noblecollectable > wordpress-export.sql

# Zip wp-content
zip -r wp-content-export.zip wp-content/
```

**On cPanel:**

1. Create new MySQL database
2. Import database via phpMyAdmin
3. Upload WordPress files to `public_html/`
4. Upload `wp-content/` (themes, plugins, media)
5. Update `wp-config.php` with new database credentials
6. Update site URLs (see Section below)

### Update Site URLs for Production

```sql
-- Run in phpMyAdmin after import
UPDATE wp_options SET option_value='https://noblecollectable.com' WHERE option_name='siteurl';
UPDATE wp_options SET option_value='https://noblecollectable.com' WHERE option_name='home';

-- Update internal links
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://localhost:8000', 'https://noblecollectable.com');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://localhost:8000', 'https://noblecollectable.com');
```

Or use plugin: **Better Search & Replace** (WP admin)

---

## Part 3: Production Deployment (Phase 4)

### Checklist Before Go-Live

- [ ] HTTPS/SSL certificate installed (AutoSSL on cPanel)
- [ ] WooCommerce configured with production settings
- [ ] Stripe/PayPal live credentials configured (switch from test mode)
- [ ] Email notifications enabled (orders, confirmations)
- [ ] Backup scheduled (daily via cPanel)
- [ ] Admin password changed from default
- [ ] Plugins updated to latest versions
- [ ] Database backed up
- [ ] DNS pointing to cPanel host

### Go-Live Steps

1. **Test thoroughly on staging subdomain first** (e.g., `staging.noblecollectable.com`)
2. **Switch domain** pointing from old host to cPanel
3. **Monitor** first 24 hours for errors
4. **Email customers** announcement
5. **Update social media** with new site

### Post-Launch Monitoring

**First week:**
- Check admin dashboard daily
- Monitor orders coming in
- Test a few checkout flows
- Verify payment settlements
- Check for errors in logs

**Ongoing:**
- Daily: Brief site check
- Weekly: Review orders and updates
- Monthly: Check WordPress updates, backup integrity
- Quarterly: Security audit, prune old data

---

## Troubleshooting

### Docker Issues

**Port 8000 already in use:**
```bash
docker-compose down
lsof -i :8000
# Kill the process using port 8000, then restart
docker-compose up -d
```

**Database won't connect:**
```bash
# Check database logs
docker logs noblecollectable_db

# Restart containers
docker-compose down
docker-compose up -d
```

### WordPress Issues

**Theme not showing:**
- Clear browser cache
- Ensure "Noble Collectable" theme is activated (Appearance → Themes)

**Products not appearing:**
- WooCommerce → Settings → Products → Ensure shop page is set
- Ensure "noblecollectable-setup" plugin is activated (creates sample products)

**Bilingual not working:**
- Polylang → Languages → Ensure French is added and active
- Check language switcher is displayed (usually in footer)

### Payment Issues

**Stripe test mode:**
- Ensure "Test Mode" is enabled in settings
- Use test card: `4242 4242 4242 4242`
- Check Stripe Dashboard for rejected payments

**Live mode:**
- Never use test keys in production!
- Test thoroughly on staging first
- Monitor Stripe Dashboard for failed charges

---

## File Structure

```
noblecollectable/
├── docker-compose.yml              ← Start Docker
├── SETUP.md                         (this file)
├── docs/
│   ├── PROJECT_OVERVIEW.md
│   ├── TECH_STACK.md
│   ├── INFORMATION_ARCHITECTURE.md
│   ├── BRAND_GUIDE.md
│   ├── ADMIN_GUIDE.md              ← Share with client
│   ├── DEPLOYMENT.md               ← Hosting details
│   └── ROADMAP.md                  ← Project phases
├── brand/
│   └── logo/                        ← All logo files (SVG)
├── wp-content/
│   ├── themes/
│   │   └── noblecollectable-child/  ← Theme files
│   └── plugins/
│       └── noblecollectable-setup/  ← Setup plugin
└── artifact.html                    ← Reference design
```

---

## Next Steps

1. **Follow Part 1** to get local WordPress running
2. **Test everything locally** (products, checkout, payments)
3. **Follow Part 2** when ready to push to production
4. **Follow Part 3** for final deployment

Questions? Refer to [`docs/ADMIN_GUIDE.md`](./docs/ADMIN_GUIDE.md) or [`docs/DEPLOYMENT.md`](./docs/DEPLOYMENT.md).

---

**Version:** 1.0  
**Last Updated:** August 2026  
**Status:** Ready for implementation
