🔧 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>
50 lines
1.5 KiB
PHP
50 lines
1.5 KiB
PHP
<?php
|
|
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
|
global $MIRAVIAWOO;
|
|
$id = sanitize_text_field($_GET['id']);
|
|
$jobs = MiraviaCore::get_job_detail($id);
|
|
$miraviaTable = new MiraviaTable();
|
|
|
|
$data = array();
|
|
// MiraviaCore::debug($jobs);
|
|
if($jobs) {
|
|
$token = $jobs[0];
|
|
$miraviaTable->custom_actions = array(
|
|
'download' => sprintf('<a href="/wp-admin/post.php?post=[id_woocommerce]&action=edit" target="_blank">Edit</a>' ),
|
|
'view' => '<a href="https://www.miravia.es/p/i[id_miravia].html" target="_blank">View on Miravia</a>',
|
|
);
|
|
$miraviaTable->columns = [
|
|
'name' => 'SKU',
|
|
'id_miravia' => 'ID Miravia',
|
|
'id_woocommerce' => 'ID WooCommerce',
|
|
'lastError' => 'Last Error',
|
|
'created' => 'Created',
|
|
'updated' => 'Updated',
|
|
'status_text' => 'Status'
|
|
];
|
|
foreach($jobs as $k => $p) {
|
|
$data[] = array(
|
|
'name' => $p['sku'],
|
|
'id_miravia' => $p['id_miravia'],
|
|
'id_woocommerce' => $p['id_woocommerce'],
|
|
'lastError' => $p['lastError'],
|
|
'created' => date('d-m-Y H:i:s', strtotime($p['created'])),
|
|
'updated' => date('d-m-Y H:i:s', strtotime($p['updated'])),
|
|
'status_text' => $p['status_text']
|
|
);
|
|
}
|
|
|
|
}
|
|
// die('<pre>' . print_r($data, true) . '</pre>');
|
|
$miraviaTable->data_table = $data;
|
|
$miraviaTable->total_elements = count($data);
|
|
|
|
$miraviaTable->prepare_items();
|
|
|
|
|
|
?>
|
|
<div class="wrap">
|
|
<h2>Job Detail</h2>
|
|
<?php echo $miraviaTable->display(); ?>
|
|
</div>
|