Commit Graph

9 Commits

Author SHA1 Message Date
5ac5c626f3 fix: run product sync in background batches to avoid 502 on large catalogs
Manual and scheduled sync previously processed every WooCommerce product
inline in a single PHP request/AJAX call, with several sequential BC API
calls per product. At real catalog sizes this exceeds PHP's
max_execution_time and the proxy's read timeout, surfacing as a 502 Bad
Gateway on "Sync Now".

Adds WBC_Batch_Sync, which queues the catalog in chunks of 25 via Action
Scheduler (bundled with WooCommerce) and processes them asynchronously.
The manual sync AJAX call now returns immediately after queuing, and the
admin UI polls for progress instead of waiting on one long request.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 13:19:11 +02:00
0aff5cf6d8 feat: category filter, item reference SKU lookup, brand sync, and on-demand BC write-back
- Filter product sync to an allow-list of BC item category codes
- Look up items by ReferenciasArticulo item reference before falling back to GTIN/item number
- Sync BC item category to product_brand and parent category to product_cat via a new ItemCategoryHierarchy endpoint
- Add on-demand push of product name/photo back to BC (product edit meta box + bulk action), including binary PATCH support for item pictures

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 11:39:11 +02:00
6bc70afaf1 fix: use English enum value 'Active' for Status filter
BC OData filter options are in English (Draft/Active/Inactive),
not the localized display values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:48:04 +01:00
7cbbf3dec1 fix: use Asset_No instead of Product_No for ListaPrecios filter
Product_No doesn't exist on NAV.ListaPrecios, the correct field
is Asset_No (field 8).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:45:47 +01:00
d6987c110c fix: simplify ListaPrecios filter to price list code + active status
Remove Source_Type filter to allow flexible assignment types per
price list in BC.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:40:31 +01:00
7ce028b7b8 fix: correct ListaPrecios OData field names and enum values
Source_Type (not Assign_to_Type), Status='Activo' and
Source_Type='Todos los clientes' (Spanish enum values from BC).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:38:25 +01:00
2495b82e66 feat: integrate custom OData endpoints for stock and price sync
Replace broken itemLedgerEntries approach with custom ItemByLocation
OData V4 endpoint for location-specific stock. Add ListaPrecios
endpoint for price list sync (B2C regular, B2C_OF sale price) with
filters for active status and all-customers assignment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 13:14:15 +01:00
2c36344932 feat: WooCommerce-first sync + location code filter
Reversed the product sync direction: instead of pulling all 60k+ items
from BC and matching against WooCommerce (600+ paginated API calls that
timeout), now iterates the ~100 WooCommerce products and queries BC for
each one by GTIN/item number (1-2 API calls per product).

Added Location Code setting (e.g. "ICP") to filter stock by BC location.
Uses Item Ledger Entries endpoint to sum per-location stock. Falls back
to total inventory if the endpoint is unavailable.

Also registered wbc_location_code in sync settings group and uninstall.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 10:26:02 +01:00
b64397dcd3 feat: WooCommerce Business Central integration plugin
Native PHP plugin (no Composer) that syncs:
- Product stock and pricing from BC to WooCommerce (scheduled cron)
- Orders from WooCommerce to BC (on payment received)
- Auto-creates customers in BC from WooCommerce billing data

Product matching: WooCommerce SKU → BC Item Number, fallback to GTIN (EAN).
OAuth2 client credentials auth with encrypted secret storage.
Admin settings page with connection test, manual sync, and log viewer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:59:53 +01:00