🔧 Bug Fixes: - Fixed product image structure to match Miravia API requirements - Updated MiraviaProduct.php getData() method to wrap images in {"Image": [...]} format - Updated MiraviaCombination.php getData() method to wrap SKU images properly - Resolved error "[4224] The Main image of the product is required" 📋 Changes: - Modified getData() methods to transform flat image arrays to nested structure - Product images: images[] → Images: {"Image": [...]} - SKU images: images[] → Images: {"Image": [...]} - Maintains backward compatibility for empty image arrays 🎯 Impact: - Product uploads will now pass Miravia's image validation - Both product-level and SKU-level images properly formatted - Complies with official Miravia API documentation structure 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
|
list($order, $items) = MiraviaCore::get_order_woocommerce($post->ID);
|
|
?>
|
|
<div id="miravia_order_gestion">
|
|
<?php
|
|
$package_data = get_post_meta($post->ID, '_miravia_packed_result', true);
|
|
if(isset($package_data['data']['pack_order_list'])){
|
|
$packages = [];
|
|
foreach ($package_data['data']['pack_order_list'] as $item){
|
|
if(isset($item['order_item_list'])){
|
|
foreach($item['order_item_list'] as $package){
|
|
$packages[$package['package_id']] = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach($packages as $p => $v) {
|
|
if($v) {
|
|
echo wp_kses('<a href="javascript:void(0)" class="miraviaprintLabel" data-id="'.$post->ID.'" data-package="'.$p.'"><i class="fa fa-print"></i> Print Shipping Label ['.$p.']</a>', wp_kses_allowed_html());
|
|
}
|
|
}
|
|
|
|
}else{
|
|
echo wp_kses(' <p>'.__('Ready to ship?','miraviawoo').'</p>
|
|
<button type="button" id="packOrderButton" data-id="'.$post->ID.'">Pack Order</button>', wp_kses_allowed_html());
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
</div>
|