🔧 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>
46 lines
1.6 KiB
PHP
46 lines
1.6 KiB
PHP
<?php
|
|
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
|
global $MIRAVIAWOO;
|
|
$jobs = MiraviaCore::get_jobs();
|
|
|
|
$miraviaTable = new MiraviaTable();
|
|
$data = array();
|
|
|
|
if($jobs) {
|
|
$token = $jobs[0];
|
|
$miraviaTable->custom_actions = array(
|
|
'detail' => sprintf('<a href="?page=%s&subpage=%s&id=[name]">Detail</a>', sanitize_text_field($_REQUEST['page']), 'detail-job' ),
|
|
'download' => sprintf('<a href="javascript:void(0);" class="checkJob" data-token="[token]" data-id="[name]">Check Status</a>', sanitize_text_field($_REQUEST['page']), sanitize_text_field($_REQUEST['subpage']), 'download', ),
|
|
'cancel' => sprintf('<a href="javascript:void(0);" class="cancelJob" data-token="[token]" data-id="[name]">Cancel Job</a>', sanitize_text_field($_REQUEST['page']), sanitize_text_field($_REQUEST['subpage']), 'download', ),
|
|
);
|
|
|
|
$miraviaTable->columns = [
|
|
'name' => 'Job',
|
|
'status' => 'Status',
|
|
'total' => 'Total Products',
|
|
'updated' => 'Updated',
|
|
];
|
|
foreach($jobs as $k => $p) {
|
|
$data[] = array(
|
|
'name' => $p['job_id'],
|
|
'status' => '<span class="status_result">...</span>',
|
|
'token' => $p['token'],
|
|
'total' => $p['total'],
|
|
'updated' => date('d-m-Y H:i:s', strtotime($p['updated'])),
|
|
);
|
|
}
|
|
|
|
}
|
|
// die('<pre>' . print_r($data, true) . '</pre>');
|
|
$miraviaTable->data_table = $data;
|
|
$miraviaTable->total_elements = count($data);
|
|
|
|
$miraviaTable->prepare_items();
|
|
|
|
|
|
?>
|
|
<div class="wrap">
|
|
<h2>Miravia Jobs</h2>
|
|
<?php echo $miraviaTable->display(); ?>
|
|
</div>
|