🔧 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>
37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
if ( ! defined( 'ABSPATH' ) ) { exit; }
|
|
|
|
$miraviaTable = new MiraviaTable([
|
|
'sccren' => 'miravia_rules'
|
|
]);
|
|
|
|
if(isset($_GET['action']) and $_GET['action'] == 'delete') {
|
|
if(current_user_can( 'manage_options' )){
|
|
MiraviaCore::delete_rule(sanitize_text_field( $_GET['id'] ));
|
|
wp_safe_redirect(admin_url("admin.php?page=miravia_settings&subpage=rules"));
|
|
}
|
|
}
|
|
$miraviaTable->custom_actions = array(
|
|
'edit' => sprintf('<a href="?page=%s&subpage=%s&action=%s&id=[id]">Editar</a>', sanitize_text_field($_REQUEST['page']), 'edit_rule', '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'),
|
|
);
|
|
$miraviaTable->columns = [
|
|
'id' => "ID",
|
|
'name' => "Name",
|
|
'created' => 'Created',
|
|
'updated' => 'Updated'
|
|
];
|
|
$miraviaTable->default_column_name = 'name_rule';
|
|
$rules = MiraviaCore::get_rules();
|
|
$miraviaTable->data_table = $rules;
|
|
$miraviaTable->total_elements = count($rules);
|
|
$miraviaTable->prepare_items();
|
|
?>
|
|
<div class="wrap">
|
|
<h1 class="wp-heading-inline">Rules</h1>
|
|
<a href="<?php echo admin_url('admin.php?page=miravia_settings&subpage=add-rule')?>" class="page-title-action">Create Rule</a>
|
|
<hr class="wp-header-end">
|
|
<?php
|
|
$miraviaTable->display();
|
|
?>
|
|
</div>
|