|
@@ -8,8 +8,35 @@ This is a WordPress plugin that extends WooCommerce functionality to manage prin
|
|
|
|
|
|
|
|
**Plugin Details:**
|
|
**Plugin Details:**
|
|
|
- Text Domain: `studiou-wc-ord-print-statuses`
|
|
- Text Domain: `studiou-wc-ord-print-statuses`
|
|
|
-- Current Version: 1.3.1
|
|
|
|
|
|
|
+- Current Version: 1.3.2
|
|
|
- Requires: WordPress 5.8+, WooCommerce 3.0+, PHP 7.2+
|
|
- Requires: WordPress 5.8+, WooCommerce 3.0+, PHP 7.2+
|
|
|
|
|
+- Tested with: WordPress 6.8.3, WooCommerce 10.2.2
|
|
|
|
|
+
|
|
|
|
|
+## Recent Changes
|
|
|
|
|
+
|
|
|
|
|
+### Version 1.3.2 (2025-10-18)
|
|
|
|
|
+**Bug Fix: Empty prod_var_type column in CSV export**
|
|
|
|
|
+
|
|
|
|
|
+Fixed an issue where the `prod_var_type` column was always empty in the "Prepare to Printing Export" CSV file.
|
|
|
|
|
+
|
|
|
|
|
+**Root Cause:**
|
|
|
|
|
+The SQL query in `Studiou_DB_Manager::get_orders_for_printing()` was incorrectly using the `wc_product_attributes_lookup` table to retrieve product variation attributes. This table stores product-level attribute data (for parent products), not the specific attribute values for individual variations.
|
|
|
|
|
+
|
|
|
|
|
+**Solution:**
|
|
|
|
|
+Modified the query (lines 55-65 in `includes/class-db-manager.php`) to:
|
|
|
|
|
+1. Join with `wp_postmeta` table instead of `wc_product_attributes_lookup`
|
|
|
|
|
+2. Look for meta_key = 'attribute_pa_format' which stores the variation's format attribute value
|
|
|
|
|
+3. Join with `wp_terms` using the slug field (matching against meta_value) instead of term_id
|
|
|
|
|
+
|
|
|
|
|
+**Files Changed:**
|
|
|
|
|
+- `includes/class-db-manager.php` - Updated LEFT JOIN logic for product_variations_attr and product_variations_name tables
|
|
|
|
|
+
|
|
|
|
|
+**Impact:**
|
|
|
|
|
+The `prod_var_type` column in exported CSV files now correctly displays the Format attribute value (e.g., "A4", "A5") for each product variation.
|
|
|
|
|
+
|
|
|
|
|
+**Tested On:**
|
|
|
|
|
+- WordPress 6.8.3
|
|
|
|
|
+- WooCommerce 10.2.2
|
|
|
|
|
|
|
|
## Architecture
|
|
## Architecture
|
|
|
|
|
|
|
@@ -52,9 +79,9 @@ The export query in `Studiou_DB_Manager::get_orders_for_printing()` performs a c
|
|
|
- `wp_wc_orders` (order data)
|
|
- `wp_wc_orders` (order data)
|
|
|
- `wp_wc_order_product_lookup` (order products)
|
|
- `wp_wc_order_product_lookup` (order products)
|
|
|
- `wp_posts` (products and variations)
|
|
- `wp_posts` (products and variations)
|
|
|
-- `wp_wc_product_attributes_lookup` (product attributes, specifically 'pa_format')
|
|
|
|
|
-- `wp_terms` and `wp_term_taxonomy` (product categories)
|
|
|
|
|
-- `wp_postmeta` and `wp_posts` (product images)
|
|
|
|
|
|
|
+- `wp_postmeta` (product variation attributes - specifically 'attribute_pa_format')
|
|
|
|
|
+- `wp_terms` and `wp_term_taxonomy` (product categories and variation attribute values)
|
|
|
|
|
+- `wp_postmeta` (product images via '_thumbnail_id' meta)
|
|
|
|
|
|
|
|
This query extracts: order number, product category, product name, variation name, variation type, image URL, quantity, and customer email.
|
|
This query extracts: order number, product category, product name, variation name, variation type, image URL, quantity, and customer email.
|
|
|
|
|
|