🔧 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>
38 lines
1.3 KiB
PHP
38 lines
1.3 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_account(sanitize_text_field( $_GET['id'] ));
|
|
wp_safe_redirect(admin_url("admin.php?page=miravia_settings&subpage=accounts"));
|
|
}
|
|
}
|
|
$miraviaTable = new MiraviaTable();
|
|
|
|
$miraviaTable->custom_actions = array(
|
|
'delete' => sprintf('<a href="admin.php?page=%s&subpage=%s&action=%s&id=[id]">Delete</a>', sanitize_text_field($_REQUEST['page']), sanitize_text_field($_REQUEST['subpage']), 'delete'),
|
|
);
|
|
$miraviaTable->columns = [
|
|
'name' => 'Name',
|
|
'lang' => 'Language',
|
|
'userid' => 'User ID',
|
|
'created' => 'Created',
|
|
'updated' => 'Updated'
|
|
];
|
|
|
|
$miraviaTable->data_table = $accounts = MiraviaCore::get_accounts();
|
|
$miraviaTable->total_elements = count($accounts);
|
|
$miraviaTable->prepare_items();
|
|
?>
|
|
<div class="wrap">
|
|
<form method="post" action="<?php echo admin_url('admin-ajax.php?action=miravia_authorize')?>">
|
|
<h1 class="wp-heading-inline">Miravia Seller Accounts</h1>
|
|
<input type="submit" name="authorize" class="page-title-action" value="Add Account" />
|
|
</form>
|
|
<hr class="wp-header-end">
|
|
<?php
|
|
$miraviaTable->display();
|
|
?>
|
|
</div>
|