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>
This commit is contained in:
2026-07-09 11:39:11 +02:00
parent 6a541de9e6
commit 0aff5cf6d8
5 changed files with 655 additions and 5 deletions

View File

@@ -135,7 +135,7 @@ $tabs = array(
value="<?php echo esc_attr( get_option( 'wbc_company_name', '' ) ); ?>"
class="regular-text" placeholder="e.g. TRADE FORCE BRANS" />
<p class="description">
<?php esc_html_e( 'Exact company name in Business Central (used for custom OData endpoints like ItemByLocation and ListaPrecios).', 'woo-business-central' ); ?>
<?php esc_html_e( 'Exact company name in Business Central (used for custom OData endpoints like ItemByLocation, ListaPrecios, ReferenciasArticulo and ItemCategoryHierarchy).', 'woo-business-central' ); ?>
</p>
</td>
</tr>
@@ -214,6 +214,32 @@ $tabs = array(
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="wbc_category_filter"><?php esc_html_e( 'Category Filter', 'woo-business-central' ); ?></label>
</th>
<td>
<input type="text" id="wbc_category_filter" name="wbc_category_filter"
value="<?php echo esc_attr( get_option( 'wbc_category_filter', '' ) ); ?>"
class="regular-text" placeholder="e.g. HAIRCARE,SKINCARE" />
<p class="description">
<?php esc_html_e( 'Optional. Comma-separated BC item category codes. Only products whose BC item category is in this list will be synced. Leave empty to sync all categories.', 'woo-business-central' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row"><?php esc_html_e( 'Enable Brand/Category Sync', 'woo-business-central' ); ?></th>
<td>
<label>
<input type="checkbox" name="wbc_enable_brand_sync" value="yes"
<?php checked( get_option( 'wbc_enable_brand_sync', 'no' ), 'yes' ); ?> />
<?php esc_html_e( 'Sync BC item category to the product_brand taxonomy, and its parent category to the WooCommerce product category', 'woo-business-central' ); ?>
</label>
<p class="description">
<?php esc_html_e( 'Requires the custom ItemCategoryHierarchy OData endpoint and the WooCommerce Brands plugin (product_brand taxonomy).', 'woo-business-central' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<label for="wbc_regular_price_list"><?php esc_html_e( 'Regular Price List Code', 'woo-business-central' ); ?></label>