Skip to main content

Initial Configuration

Complete the initial setup after installing GSM Middleware.

Quick Start Checklist

After installation, complete these steps:

  • Configure database environment
  • Set up Business Central API connection
  • Configure global settings
  • Add your first site
  • Set up cron jobs
  • Test order sync

Estimated time: 30-45 minutes

Step 1: Database Configuration

Choose Database Type

Option A: Use WordPress Database (Development/Testing)

  • Simpler setup
  • Good for testing
  • Limited scalability

Option B: Use External Database (Production)

  • Better performance
  • Scalable
  • Recommended for production

Configure Database Environment

  1. Go to GSM Middleware → Settings
  2. Click "DB Environments" tab
  3. Click "Add Environment"

For external database:

Name: Production Database
Environment: live
Host: db-server.example.com
Port: 3306
Database: gsm_middleware
Username: gsm_user
Password: [secure password]
  1. Click "Test Connection"
  2. If successful, click "Activate"
  3. Click "Save"

Tables will be created automatically on first activation.

See Database Environments Guide for detailed instructions.

Step 2: Business Central API Connection

Gather BC Credentials

From your Business Central administrator, get:

  • OData URL
  • API username
  • API password

URL format:

https://bc-server.example.com:7048/BC180/ODataV4/Company('YourCompany')

Configure API Connection

  1. Go to GSM Middleware → API Connections
  2. Click "Add Connection"

Fill in form:

Name: Navision Production
Type: Basic Authentication
Environment: live
URL: [OData URL from above]
Username: [API username]
Password: [API password]
  1. Click "Test Connection"
  2. If successful, click "Activate"
  3. Click "Save"

See API Connections Guide for detailed instructions.

Step 3: Global Settings

Configure Tax Settings

  1. Go to GSM Middleware → Settings
  2. Scroll to "Tax Configuration"

States to Tax:

CA,TX,FL,NY,PA,IL,OH,GA,NC,MI

Add/remove states based on your tax requirements

Configure Blocked Item Statuses

Blocked Item Statuses:

BLOCKED,DISCONTINUED,OBSOLETE

Orders with these item statuses will be rejected

Test Mode (Optional)

For testing, enable test mode:

  • Toggle "Use Test Credentials"
  • Enter test BC URL and credentials
  • This allows switching between test and production

Save Settings

Scroll to bottom and click "Save Settings"

See Settings Guide for all options.

Step 4: Add Your First Site

Prepare Site Credentials

For BigCommerce:

  • Store hash
  • Client ID
  • Access token

For WooCommerce:

  • Consumer key
  • Consumer secret

Add Site

  1. Go to GSM Middleware → Control Panel
  2. Click "Add Site" button
  3. Select platform (BigCommerce or WooCommerce)
  4. Fill in site details

Example BigCommerce Site:

Site Name: Main Store
Platform: BigCommerce
Site URL: https://mainstore.com
Store Hash: abc123xyz

Client ID: abc123def456...
Access Token: xyz789ghi012...

☑ Enable Order Sync
☑ Enable Inventory Sync
☑ Enable Tracking Sync
  1. Click "Test Connection"
  2. If successful, click "Save"

See First Site Setup for detailed walkthrough.

Step 5: Configure Cron Jobs

Set Up Server Cron

Add to crontab:

# Edit crontab
crontab -e

# Add these lines
# Order Sync - Every hour
0 * * * * /usr/bin/php /path/to/wp-content/plugins/gsm-middleware/cron/order-sync.php >> /var/log/gsm-middleware/order-sync.log 2>&1

# Inventory Sync - Every 30 minutes
*/30 * * * * /usr/bin/php /path/to/wp-content/plugins/gsm-middleware/cron/inventory-sync.php >> /var/log/gsm-middleware/inventory-sync.log 2>&1

# Tracking Sync - Every 30 minutes
*/30 * * * * /usr/bin/php /path/to/wp-content/plugins/gsm-middleware/cron/tracking-sync.php >> /var/log/gsm-middleware/tracking-sync.log 2>&1

# BC Insert - Every 15 minutes
*/15 * * * * /usr/bin/php /path/to/wp-content/plugins/gsm-middleware/cron/bc-insert-items.php >> /var/log/gsm-middleware/bc-insert.log 2>&1

# BC Verify - Every 15 minutes
*/15 * * * * /usr/bin/php /path/to/wp-content/plugins/gsm-middleware/cron/bc-verify-items.php >> /var/log/gsm-middleware/bc-verify.log 2>&1

See Cron Setup Guide for detailed instructions.

Step 6: Test Order Sync

Manual Test

  1. Create a test order on your e-commerce site
  2. Note the order number
  3. Go to GSM Middleware → Test Order
  4. Select your site
  5. Enter order number
  6. Click "Test Order Import"
  7. Review results

Verify in Database

-- Check if order synced
SELECT * FROM rm_order WHERE number = 'YOUR-ORDER-NUMBER';

-- Check line items
SELECT * FROM rm_lineitems WHERE number = 'YOUR-ORDER-NUMBER';

Check Platform Status

BigCommerce:

  • Order status should change to "Awaiting Shipment"
  • Staff note added

WooCommerce:

  • Order meta sumatra_wc_integrator_exported = 1

Verification Checklist

After configuration, verify:

Database

  • Database connection active
  • Tables created (rm_sites, rm_order, etc.)
  • Can query tables without errors

API Connections

  • Business Central connection tests successfully
  • Can fetch items from BC OData
  • Connection marked as active

Site Configuration

  • Site connection tests successfully
  • Site marked as active
  • All sync types enabled

Cron Jobs

  • Cron jobs added to crontab
  • Log files created
  • No errors in logs

Test Order

  • Test order synced successfully
  • Order in rm_order table
  • Line items in rm_lineitems
  • Platform status updated

Common Configuration Issues

Can't Connect to Database

Check:

  • Database server running
  • Credentials correct
  • Firewall allows connection
  • Database exists

Solution:

# Test connection manually
mysql -h HOST -u USER -pPASSWORD DATABASE_NAME

BC API Connection Fails

Check:

  • URL format correct
  • Company name URL-encoded
  • User has Web Services Access
  • Firewall allows HTTPS

Solution: Test URL in browser - should prompt for credentials

Site Connection Fails

BigCommerce:

  • Store hash correct
  • API credentials valid
  • Required OAuth scopes granted

WooCommerce:

  • REST API enabled
  • Pretty permalinks enabled
  • API keys not revoked

Cron Jobs Not Running

Check:

# Verify crontab
crontab -l

# Check cron service
sudo systemctl status cron

# Check logs
tail -f /var/log/gsm-middleware/*.log

Test Order Fails

Check:

  • Order exists on platform
  • Order status correct
  • SKUs exist in Business Central
  • All previous steps completed

Performance Optimization

For High-Volume Sites

Increase batch sizes:

Settings → Performance
Order Sync Batch Size: 200
Inventory Sync Batch Size: 500

Increase PHP limits:

// wp-config.php
define('WP_MEMORY_LIMIT', '512M');
define('WP_MAX_EXECUTION_TIME', 300);

More frequent syncs:

# Every 15 minutes instead of hourly
*/15 * * * * /usr/bin/php cron/order-sync.php

For Low-Volume Sites

Reduce cron frequency:

# Every 2 hours
0 */2 * * * /usr/bin/php cron/order-sync.php

Lower batch sizes:

Settings → Performance
Order Sync Batch Size: 50

Security Recommendations

Credentials

  • Use strong, unique passwords
  • Rotate credentials every 90 days
  • Never commit credentials to version control
  • Use environment variables for sensitive data

Database

  • Use dedicated database user
  • Grant minimum required permissions
  • Enable SSL for remote connections
  • Regular backups

API Access

  • Use read-only scopes where possible
  • Monitor API usage
  • Set up alerts for unusual activity
  • Regularly review API logs

Backup Configuration

Export Settings

  1. Go to Settings
  2. Scroll to bottom
  3. Click "Export Settings"
  4. Save JSON file securely

Backup Database

# Backup middleware database
mysqldump -h HOST -u USER -pPASSWORD gsm_middleware > backup_$(date +%Y%m%d).sql

# Compress
gzip backup_$(date +%Y%m%d).sql

Document Configuration

Keep record of:

  • Database credentials
  • API credentials
  • Cron schedule
  • Custom settings
  • Site configurations

Next Steps

Now that configuration is complete:

  1. Add More Sites - Configure additional stores
  2. Monitor Operations - Watch sync operations
  3. Review Documentation - Explore all features

Getting Help

If you encounter issues during configuration:

  1. Check Troubleshooting Guide
  2. Review FAQ
  3. Check log files
  4. Contact system administrator