1)); $aieo_mav_form_id = 'aieo-card-problematic-variations-multi-attribute-variations-form'; list($aieo_mav_open, $aieo_mav_close) = AIEO_DMM_UI::card(array( 'anchor' => 'problematic-variations-multi-attribute-variations', 'title' => __('Block a second variation axis', 'ai-eshop-optimizer'), 'description' => __('Some variable products use MORE THAN ONE attribute for their variations (e.g. Colour × Size). That is correct for shops such as clothing, but for many catalogues it is an accident that multiplies into hundreds of combinations and leaves an “Any …” axis. Use the switch below to decide whether this store should block saving such products.', 'ai-eshop-optimizer'), 'meta' => \Rooster\Admin\States::status('on', array('attrs' => array('data-mav-status' => 'on', 'hidden' => $block_enabled ? null : true))) . \Rooster\Admin\States::status('off', array('attrs' => array('data-mav-status' => 'off', 'hidden' => $block_enabled ? true : null))), 'footer' => \Rooster\Admin\States::save_button($aieo_mav_form_id), )); echo $aieo_mav_open; $aieo_mav_switch = \Rooster\Admin\Ui::toggle('block', $block_enabled, array('id' => 'aieo-mav-block', 'hidden' => false, 'label' => __('Block products that use more than one attribute for variations', 'ai-eshop-optimizer'), 'label_hidden' => true)); $aieo_mav_row = \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-mav-block', 'label' => __('Block products that use more than one attribute for variations', 'ai-eshop-optimizer'), 'control' => $aieo_mav_switch, 'help' => __('ON: the product editor prevents saving a variable product with more than one “Used for variations” attribute (with a non-destructive server-side backstop). Turn OFF for stores that legitimately sell on two axes — e.g. clothing (colour × size) — where the list below becomes informational only.', 'ai-eshop-optimizer'), )); echo AIEO_DMM_UI::card_form('aieo_dmm_mav_save', 'problematic_variations', $aieo_mav_form_id, '
' . $aieo_mav_row . '
'); echo $aieo_mav_close; ?> 'problematic-variations-affected-products', 'title' => __('Affected products', 'ai-eshop-optimizer'), 'description' => __('Variable products that use more than one attribute for their variations are listed here, each with a link to its attributes.', 'ai-eshop-optimizer'), )); echo $aieo_mav_open; $aieo_mav_clean = \Rooster\Admin\States::state('all-done', array('title' => __('Every variable product uses exactly one attribute for its variations.', 'ai-eshop-optimizer'), 'compact' => true)); echo $aieo_mav_clean; echo $aieo_mav_close; ?> $aieo_mav_pid, 'name' => (string) $r['name'], 'sku' => (string) ($r['sku'] ?? ''), 'edit' => add_query_arg(array('post' => $aieo_mav_pid, 'action' => 'edit', 'aieo_focus_attributes' => 1), admin_url('post.php')), 'attrs' => (array) $r['attrs'], 'count' => (int) $r['count'], ); } AIEO_Table::card(array( 'anchor' => 'problematic-variations-affected-products', 'heading' => 'h2', 'title' => __('Affected products', 'ai-eshop-optimizer'), 'description' => number_format_i18n($count) . ' ' . ($block_enabled ? __('product(s) use multiple variation attributes — review / fix', 'ai-eshop-optimizer') : __('product(s) use multiple variation attributes — allowed (informational)', 'ai-eshop-optimizer')), 'page_id' => 'problematic_variations', 'row_key' => 'id', 'rows' => $aieo_mav_rows, 'cap' => 1000, 'columns' => array( array( 'key' => 'name', 'label' => __('Product', 'ai-eshop-optimizer'), 'type' => 'link', 'format' => array('href' => 'edit', 'external' => true), 'subline' => 'sku', ), array('key' => 'attrs', 'label' => __('Attributes used for variations', 'ai-eshop-optimizer'), 'type' => 'list', 'sortable' => false), array('key' => 'count', 'label' => __('Count', 'ai-eshop-optimizer'), 'type' => 'integer', 'width' => '60px'), ), 'actions' => array( array( 'id' => 'open_attributes', 'label' => __('Open attributes →', 'ai-eshop-optimizer'), 'external' => true, 'href' => static function ($r) { return $r['edit']; }, ), ), )); ?>