Skip to main content

Getting Started with Development

Guide for setting up a local development environment for TenPoint Crossbows.

Prerequisites

Required Software

  • PHP: 7.2.5 or higher
    • Extensions: allow_url_fopen, cURL with OpenSSL+zlib, mbstring, mysqli, zip
  • MySQL/MariaDB: 5.6 or higher
  • Web Server: Apache or Nginx
  • Node.js: 14.x or higher (for asset compilation)
  • Composer: Latest version
  • Git: For version control
  • Laravel Herd: Local PHP development environment (currently in use)
  • TablePlus/Sequel Pro: Database management
  • VS Code: Code editor with PHP and WordPress extensions
  • WP-CLI: WordPress command-line interface

Local Environment Setup

Option 1: Laravel Herd (Current Setup)

Location: Z:\Herd\tenpointcrossbows

Herd Configuration:

  • Automatic PHP version management
  • Built-in web server
  • Database management
  • SSL support

Access:

  • Local URL: http://tenpointcrossbows.test (or configured domain)
  • Database: MySQL via Herd's database service

Option 2: Traditional LAMP/MAMP/WAMP Stack

  1. Install web server stack:

    • Windows: XAMPP, WAMP
    • macOS: MAMP, Laravel Valet
    • Linux: LAMP stack
  2. Configure virtual host:

    <VirtualHost *:80>
    ServerName tenpoint.local
    DocumentRoot "C:/path/to/tenpointcrossbows"
    <Directory "C:/path/to/tenpointcrossbows">
    AllowOverride All
    Require all granted
    </Directory>
    </VirtualHost>
  3. Add to hosts file:

    127.0.0.1 tenpoint.local

Database Setup

Create Database

CREATE DATABASE wp_tenpoint CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp_tenpoint'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wp_tenpoint.* TO 'wp_tenpoint'@'localhost';
FLUSH PRIVILEGES;

Import Database

# From production export
mysql -u wp_tenpoint -p wp_tenpoint < production-export.sql

# Or use WP-CLI
wp db import production-export.sql

Update Site URLs

# Using WP-CLI
wp search-replace 'https://tenpointcrossbows.com' 'http://tenpoint.local' --all-tables

# Or SQL
UPDATE wp_options SET option_value = 'http://tenpoint.local'
WHERE option_name IN ('siteurl', 'home');

WordPress Configuration

wp-config.php

<?php
// Database credentials
define('DB_NAME', 'wp_tenpoint');
define('DB_USER', 'wp_tenpoint');
define('DB_PASSWORD', 'your_password');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');

// Security keys (generate at: https://api.wordpress.org/secret-key/1.1/salt/)
define('AUTH_KEY', 'your-unique-key-here');
define('SECURE_AUTH_KEY', 'your-unique-key-here');
define('LOGGED_IN_KEY', 'your-unique-key-here');
define('NONCE_KEY', 'your-unique-key-here');
// ... etc

// WordPress database table prefix
$table_prefix = 'wp_';

// Development mode
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
define('SCRIPT_DEBUG', true);

// Disable caching for development
define('WP_CACHE', false);

// Disable automatic updates
define('AUTOMATIC_UPDATER_DISABLED', true);

// Memory limit
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');

// That's all, stop editing!
require_once ABSPATH . 'wp-settings.php';

Plugin Dependencies

Install Composer Dependencies

Epicor Integration Plugin:

cd wp-content/plugins/tenpoint-epicor-integration
composer install

Tenpoint Integrator:

cd wp-content/plugins/tenpoint-integrator
composer install

Required Plugins

Core Plugins (must be active):

  • WooCommerce 4.0+
  • Elementor Pro
  • Advanced Custom Fields Pro
  • Gravity Forms

Custom Rhino Group Plugins:

  • suma-blocks
  • suma-cross-sells
  • suma-dealer-locator
  • suma-downloads
  • suma-faqs
  • suma-videos
  • suma-woo-emails
  • tenpoint-epicor-integration
  • tenpoint-integrator

Payment Gateways:

  • woocommerce-ebizcharge-gateway
  • woocommerce-paypal-payments
  • paytomorrow

Search & Filtering:

  • facetwp (+ addons)
  • wp-search-with-algolia

Theme Setup

Theme Location

wp-content/themes/elementor/

Install Node Dependencies

cd wp-content/themes/elementor
npm install

Compile Assets

Development Build:

npm run dev

Production Build:

npm run production

Watch Mode (auto-compile on file changes):

npm run watch

Gulp Tasks (if applicable)

# Install Gulp globally
npm install -g gulp-cli

# Run default tasks
gulp

# Watch mode
gulp watch

Epicor Integration Setup

Sandbox Configuration

  1. Navigate to: WP Admin → Epicor Integration → Settings

  2. Configure Sandbox Environment:

    • Epicor URL: https://sandbox-erp.tenpointcrossbows.com
    • Instance: kineticpilot_sandbox
    • API Version: v1
    • Username: api_sandbox_user
    • Password: sandbox_password
    • Company Code: TENPOINT
  3. Service Configuration:

    • Orders Service: Erp.BO.SalesOrderSvc
    • Parts Service: Erp.BO.PartSvc
    • Inventory BAQ: KP-AVAILINV
    • Revisions BAQ: KP-REVS
  4. Feature Toggles:

    • ✅ Detailed Logs
    • ✅ Send to Epicor (for testing)
    • ✅ Change Order Status
    • ✅ Disable SSL Verify (sandbox only, if needed)
  5. Generate REST API Token:

    • Click "Generate New Token" button
    • Copy token for external cron testing
  6. Test Connection:

    • Click "Test Connection" button
    • Verify successful connection to sandbox

Test Order Generation

  1. Navigate to: Epicor Integration → Tools

  2. Generate Test Orders:

    • Batch size: 5-10 orders
    • Coupon type: (optional) percent or free_shipping
    • Click "Generate Orders"
  3. Verify Orders Created:

    • Go to: WooCommerce → Orders
    • Check for new orders with status wc-processing
  4. Test Manual Export:

    • Go to: Epicor Integration → Order Sync Logs
    • Click "Run Order Sync Now"
    • Review log entries for success/errors

External Services Configuration

Development API Keys

PayPal Sandbox:

  • Client ID: (from PayPal Developer Dashboard)
  • Secret: (from PayPal Developer Dashboard)
  • Mode: Sandbox

PayTomorrow Test:

  • Merchant ID: (from PayTomorrow)
  • API Key: (test credentials)

Bazaar Voice Staging:

// In theme inc/class-bazaar-voice.php
// Use staging token instead of production

Klaviyo Test Account:

  • API Key: (test account)
  • List ID: (test list)

Algolia Development:

  • Application ID: (from Algolia dashboard)
  • Search-Only API Key: (public key)
  • Admin API Key: (for indexing)

Debug Tools

Enable WordPress Debug Mode

Already configured in wp-config.php (see above).

View Logs:

wp-content/debug.log

Enable Query Monitor

Install Plugin:

wp plugin install query-monitor --activate

Features:

  • Database queries (count, time, duplicates)
  • HTTP requests
  • Hook execution
  • Template usage
  • PHP errors

WooCommerce Logging

Location: WooCommerce → Status → Logs

Available Logs:

  • Payment gateway logs
  • Shipping logs
  • Fatal errors

Epicor Integration Logs

File Logs: /wp-content/uploads/suma-tenpoint-epicor-integration/

  • order/{date}.log
  • inventory/{date}.log
  • epicor/{date}.log

Database Logs: WP Admin → Epicor Integration → Order Sync Logs / Inventory Sync Logs

Development Workflow

Typical Development Cycle

  1. Pull latest code from repository
  2. Update database (if schema changes)
  3. Install/update dependencies:
    composer install
    npm install
  4. Compile assets:
    npm run dev
  5. Enable debug mode (wp-config.php)
  6. Make code changes
  7. Test locally
  8. Commit and push to version control
  9. Deploy to staging for QA
  10. Deploy to production after approval

Git Workflow

Branches:

  • main — Production-ready code
  • staging — Staging environment
  • develop — Development branch
  • feature/* — Feature branches
  • bugfix/* — Bug fix branches

Commit Message Format:

type(scope): subject

body (optional)

footer (optional)

Types: feat, fix, docs, style, refactor, test, chore

Example:

feat(epicor): add batch request optimization

Implement OData $batch requests to reduce HTTP calls from 40 to 1 per order export.

Closes #123

Testing

Manual Testing Checklist

E-Commerce Flow:

  • Product browsing
  • Search functionality
  • Faceted filtering
  • Add to cart
  • Cart updates
  • Checkout process
  • Payment processing (test mode)
  • Order confirmation

Epicor Integration:

  • Generate test orders
  • Manual order export
  • Manual inventory sync
  • Review sync logs
  • Verify order meta
  • Check Epicor sales orders (sandbox)

Theme Features:

  • Responsive design (mobile, tablet, desktop)
  • Elementor page builder
  • Product pages
  • Category archives
  • Dealer locator
  • Video library
  • Downloads center
  • FAQs

Browser Testing

Required Browsers:

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest, macOS/iOS)
  • Edge (latest)

Responsive Breakpoints:

  • Mobile: 320px - 767px
  • Tablet: 768px - 1023px
  • Desktop: 1024px+

Common Development Tasks

Clear All Caches

# WordPress object cache
wp cache flush

# WooCommerce transients
wp transient delete --all

# Elementor cache
wp elementor flush-css

# Rewrite rules
wp rewrite flush

# Or use admin panel:
# Epicor Integration → Settings → (Clear Cache button)

Regenerate Product Data

# Reindex Algolia search
# WP Admin → Algolia Search → Re-index

# Regenerate FacetWP indexes
# WP Admin → Settings → FacetWP → Rebuild Index

# Regenerate thumbnails
wp media regenerate --yes

Export/Import Data

# Export database
wp db export backup-$(date +%Y%m%d).sql

# Export specific tables
wp db export backup.sql --tables=wp_posts,wp_postmeta

# Import database
wp db import backup.sql

Update URLs After Database Import

wp search-replace 'https://tenpointcrossbows.com' 'http://tenpoint.local' --all-tables --dry-run
wp search-replace 'https://tenpointcrossbows.com' 'http://tenpoint.local' --all-tables

Troubleshooting Development Issues

White Screen of Death (WSOD)

  1. Check wp-content/debug.log
  2. Enable WP_DEBUG_DISPLAY temporarily
  3. Review PHP error logs
  4. Check file permissions (755 for directories, 644 for files)

Plugin Conflicts

  1. Deactivate all plugins
  2. Activate one by one to identify conflict
  3. Check for plugin updates
  4. Review plugin compatibility

Theme Issues

  1. Switch to default theme (Twenty Twenty-Four)
  2. If issue persists, it's not theme-related
  3. Regenerate Elementor CSS
  4. Clear browser cache

Database Connection Errors

  1. Verify database credentials in wp-config.php
  2. Check database server is running
  3. Test connection with MySQL client
  4. Check database user permissions

Asset Compilation Errors

  1. Delete node_modules/ and run npm install
  2. Clear npm cache: npm cache clean --force
  3. Check Node.js version compatibility
  4. Review webpack/mix configuration

Performance Optimization for Development

Disable Unnecessary Features

wp-config.php:

// Disable automatic updates
define('AUTOMATIC_UPDATER_DISABLED', true);
define('WP_AUTO_UPDATE_CORE', false);

// Disable post revisions
define('WP_POST_REVISIONS', 3);

// Disable trash auto-empty
define('EMPTY_TRASH_DAYS', 0);

// Disable cron
define('DISABLE_WP_CRON', true);

Optimize Database Queries

  • Use Query Monitor to identify slow queries
  • Add indexes to frequently queried meta keys
  • Limit post revisions
  • Clean up transients regularly

Next Steps

Support & Resources

Documentation:

Internal Resources:

  • Rhino Group GitLab
  • Internal wiki
  • Team Slack channels

Contact: