🔧 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>
39 lines
1.5 KiB
PHP
39 lines
1.5 KiB
PHP
<?php
|
|
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
|
global $MIRAVIAWOO;
|
|
|
|
if(isset($_GET['action']) and $_GET['action'] == 'delete') {
|
|
if(current_user_can( 'manage_options' )){
|
|
MiraviaCore::delete_profile(sanitize_text_field( $_GET['id'] ));
|
|
wp_safe_redirect(admin_url("admin.php?page=miravia_settings&subpage=profiles"));
|
|
}
|
|
}
|
|
|
|
$miraviaTable = new MiraviaTable([
|
|
'sccren' => 'miravia_profiles'
|
|
]);
|
|
$miraviaTable->custom_actions = array(
|
|
'edit' => sprintf('<a href="?page=%s&subpage=%s&action=%s&id=[id]">Editar</a>', sanitize_text_field($_REQUEST['page']), 'edit_profile', 'edit', ),
|
|
'delete' => sprintf('<a href="?page=%s&subpage=%s&action=%s&id=[id]">Eliminar</a>', sanitize_text_field($_REQUEST['page']), sanitize_text_field($_REQUEST['subpage']), 'delete'),
|
|
'upload' => '<a href="javascript:void(0)" data-profile="[id]" class="sendProductsMiravia">Upload products</a>'
|
|
);
|
|
$miraviaTable->columns = [
|
|
'id' => "ID",
|
|
'name' => "Name",
|
|
'created' => 'Created',
|
|
'updated' => 'Updated',
|
|
'sync' => 'Status Sync'
|
|
];
|
|
$profiles = MiraviaCore::get_profiles();
|
|
$miraviaTable->data_table = $profiles;
|
|
$miraviaTable->total_elements = count($profiles);
|
|
$miraviaTable->prepare_items();
|
|
?>
|
|
<div class="wrap">
|
|
<h1 class="wp-heading-inline">Mapping Profiles</h1>
|
|
<a href="<?php echo admin_url('admin.php?page=miravia_settings&subpage=create_profile')?>" class="page-title-action">Create Profile</a>
|
|
<hr class="wp-header-end">
|
|
<?php
|
|
$miraviaTable->display();
|
|
?>
|
|
</div>
|