0) { return 1; } if ($c['axis'] !== '') { return 2; } return 3; }; $ra = $rank($a); $rb = $rank($b); if ($ra !== $rb) { return $ra - $rb; } return $b['terms'] - $a['terms']; }); $counts = array('colour' => 0, 'size' => 0, 'off' => 0); foreach ($choices as $c) { if ($c['axis'] === 'colour') { $counts['colour']++; } elseif ($c['axis'] === 'size') { $counts['size']++; } else { $counts['off']++; } } ?> 'duplicate-simples-attributes', 'title' => __('Attributes', 'ai-eshop-optimizer'), 'description' => __('The difference between two duplicate products has to be nameable before they can become variations. These are your product attributes: mark the ones that describe a colour and the ones that describe a size, a quantity, a weight or a length. Their terms become the words this tool recognises in product titles.', 'ai-eshop-optimizer'), 'flush' => true, 'footer' => \Rooster\Admin\States::save_button('aieo-card-duplicate-simples-attributes-form'), )); echo $aieo_ds_open; ?> ' . '' . esc_html($feature['label']) . '' . '

' . esc_html($feature['why']) . '

' . '' . ' ' . ''; } $aieo_ds_wc = \Rooster\Admin\Ui::notice( esc_html__('These are WooCommerce features, switched off by default. Turning them on affects your whole shop, not only merged products.', 'ai-eshop-optimizer'), 'info', array( 'title' => __('WooCommerce can show these attributes better than it currently does.', 'ai-eshop-optimizer'), 'inline' => true, 'detail' => $aieo_ds_features, ) ); echo $aieo_ds_wc; ?> 'search', 'id' => 'aieo-ds-attr-filter', 'medium' => true, 'placeholder' => __('Filter attributes', 'ai-eshop-optimizer'))); ?>

__('you', 'ai-eshop-optimizer'), 'colour-flag' => __('swatch colour flag', 'ai-eshop-optimizer'), 'guess' => __('suggested', 'ai-eshop-optimizer'), 'none' => '—', ); $aieo_dsa_rows = array(); foreach ($choices as $c) { $aieo_dsa_rows[] = array( 'taxonomy' => (string) $c['taxonomy'], 'label' => (string) $c['label'], 'terms' => (int) $c['terms'], 'kind' => isset($c['kind']) ? (string) $c['kind'] : (string) $c['axis'], 'axis' => (string) $c['axis'], 'source' => isset($aieo_dsa_source_label[$c['source']]) ? $aieo_dsa_source_label[$c['source']] : (string) $c['source'], 'search' => mb_strtolower($c['label'] . ' ' . $c['taxonomy']), ); } ob_start(); echo ''; AIEO_Table::render(array( 'id' => 'aieo-ds-attr-table', 'page_id' => 'duplicate_simples', 'row_key' => 'taxonomy', 'sortable' => false, 'rows' => $aieo_dsa_rows, 'row_class' => static function () { return 'aieo-ds-attr-row'; }, 'row_data' => array( 'search' => 'search', 'hasaxis' => static function ($r) { return '' !== $r['axis'] ? '1' : '0'; }, ), 'columns' => array( array('key' => 'label', 'label' => __('Attribute', 'ai-eshop-optimizer'), 'type' => 'text'), array('key' => 'taxonomy', 'label' => __('Taxonomy', 'ai-eshop-optimizer'), 'type' => 'code', 'width' => '210px'), array('key' => 'terms', 'label' => __('Terms', 'ai-eshop-optimizer'), 'type' => 'integer', 'width' => '80px'), array( 'key' => 'kind', 'label' => __('Describes', 'ai-eshop-optimizer'), 'type' => 'control', 'width' => '190px', 'format' => array('render' => static function ($r) { $out = ''; }), ), array('key' => 'source', 'label' => __('Set by', 'ai-eshop-optimizer'), 'type' => 'text', 'tone' => 'secondary', 'width' => '150px'), ), )); echo AIEO_DMM_UI::card_form('aieo_dmm_dupsimple_attrs', 'duplicate_simples', 'aieo-card-duplicate-simples-attributes-form', (string) ob_get_clean()); ?>