0, 'units' => 0, 'turnover' => 0, 'recoverable' => 0, 'recoverable_pess' => 0, 'recoverable_opt' => 0, 'window_days' => 0); $gap_win = (int) (!empty($totals['window_days']) ? $totals['window_days'] : (isset($gap_recency) ? $gap_recency : 60)); $ch_pct = isset($channel_pct) ? (int) $channel_pct : 17; $ch_r = $ch_pct / 100.0; $gap_statuses = isset($gap_statuses) && is_array($gap_statuses) ? $gap_statuses : array('draft', '__needs_creation__'); $gap_excludes = isset($gap_excludes) && is_array($gap_excludes) ? $gap_excludes : array(); $gap_excluded = isset($gap_excluded) && is_array($gap_excluded) ? $gap_excluded : array(); $has_status = static function ($k) use ($gap_statuses) { return in_array($k, $gap_statuses, true); }; $n_excl = count($gap_excludes) + count($gap_excluded); $aieo_mhs_price = static function ($v) { return function_exists('wc_price') ? html_entity_decode(wp_strip_all_tags(wc_price((float) $v)), ENT_QUOTES, 'UTF-8') : number_format_i18n((float) $v, 2); }; ?> 0; if ($aieo_mhs_band) { rooster_admin_band_open(array('cols' => $aieo_mhs_two ? 2 : 1)); } $aieo_mhs_form_id = 'aieo-card-missing-hot-sellers-overview-form'; list($aieo_mhs_open, $aieo_mhs_close) = AIEO_DMM_UI::card(array( 'anchor' => 'missing-hot-sellers-overview', 'icon' => 'sliders-horizontal', 'title' => __('Minimum units and exclusions', 'ai-eshop-optimizer'), 'description' => __('SKUs selling well in the physical stores that are NOT live in the eshop yet — auto-imported drafts that still need images / description / categories / brand (or products that don’t exist online at all). Publish the top of this list first.', 'ai-eshop-optimizer'), 'tools' => '', 'footer' => \Rooster\Admin\States::save_button($aieo_mhs_form_id), 'col' => 1, )); echo $aieo_mhs_open; $aieo_mhs_ranked = sprintf( esc_html__('Ranked by in-store turnover in the last %d days', 'ai-eshop-optimizer'), $gap_win ) . (!empty($data_asof) ? ' — ' . esc_html__('data through', 'ai-eshop-optimizer') . ' ' . esc_html($data_asof) . '' : '') . '.'; echo \Rooster\Admin\Guidance::text('', 'guidance', array('html' => $aieo_mhs_ranked)); echo \Rooster\Admin\Ui::notice(esc_html__('Offers you took offline (private) and any dismissed/excluded items are not counted in the list or the totals below — adjust “Include” and the exclude patterns to keep the estimate realistic.', 'ai-eshop-optimizer'), 'info', array('inline' => true)); $aieo_mhs_status_options = array( 'draft' => __('Drafts to complete', 'ai-eshop-optimizer'), '__needs_creation__' => __('Not in eshop at all', 'ai-eshop-optimizer'), 'private' => __('Private (offers taken offline)', 'ai-eshop-optimizer'), 'pending' => __('Pending', 'ai-eshop-optimizer'), ); $aieo_mhs_status_on = array(); foreach (array_keys($aieo_mhs_status_options) as $aieo_mhs_k) { if ($has_status($aieo_mhs_k)) { $aieo_mhs_status_on[] = $aieo_mhs_k; } } ob_start(); ?>
'mhs-gap_min_units', 'label' => __('Min units sold', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::input('gap_min_units', (string) $gap_min_units, array('id' => 'mhs-gap_min_units', 'type' => 'number', 'min' => 1, 'max' => 999, 'xs' => true)), )); echo $aieo_mhs_row; $aieo_mhs_row = \Rooster\Admin\Ui::field_row(array( 'id' => 'mhs-gap_recency', 'label' => __('Over last (days)', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::input('gap_recency', (string) $gap_recency, array('id' => 'mhs-gap_recency', 'type' => 'number', 'min' => 3, 'max' => 365, 'xs' => true)), )); echo $aieo_mhs_row; $aieo_mhs_row = \Rooster\Admin\Ui::field_row(array( 'id' => 'mhs-gap_statuses', 'label' => __('Include:', 'ai-eshop-optimizer'), 'group' => true, 'control' => '' . \Rooster\Admin\Ui::checks('gap_statuses', $aieo_mhs_status_options, $aieo_mhs_status_on), )); echo $aieo_mhs_row; ?>
'mhs-gap_excludes', 'label' => __('Exclude by name / SKU pattern', 'ai-eshop-optimizer'), 'help' => __('One per line. Any product whose name OR SKU contains the text is removed from the list AND the totals — now and for future imports (e.g. recurring offers, coupons, gift vouchers, catch-all accounting SKUs).', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::textarea('gap_name_excludes', implode("\n", $gap_excludes), array('id' => 'mhs-gap_excludes', 'rows' => 4, 'code' => true, 'placeholder' => "Προσφορά\nΔωροεπιταγή\nΔΙΑΦΟΡΑ ΕΙΔΗ\n9.99.")), )); echo $aieo_mhs_row; ?>
$aieo_mhs_name, 'name' => $aieo_mhs_name, 'sku' => (string) $x['sku'], 'actions' => array( array( 'label' => __('Restore', 'ai-eshop-optimizer'), 'attrs' => array('data-aieo-mhs-restore' => (string) $x['sku_norm']), ), ), ); } $aieo_mhs_caption = sprintf(__('Dismissed items (%s)', 'ai-eshop-optimizer'), number_format_i18n(count($gap_excluded))); echo '

' . esc_html($aieo_mhs_caption) . '

'; echo \Rooster\Admin\Ui::table( array( array('key' => 'name', 'label' => __('Product', 'ai-eshop-optimizer'), 'type' => 'text'), array('key' => 'sku', 'label' => __('SKU', 'ai-eshop-optimizer'), 'type' => 'code'), array('key' => 'actions', 'label' => __('Actions', 'ai-eshop-optimizer'), 'type' => 'actions'), ), $aieo_mhs_dismissed, array( 'id' => 'aieo-mhs-dismissed', 'caption' => $aieo_mhs_caption, 'dense' => true, ) ); ?> (bool) $n_excl, 'meta' => $n_excl ? ' (' . esc_html(number_format_i18n($n_excl)) . ')' : '', ) ); ?> 'missing-hot-sellers-in-store-sales-we-are-missing-online', 'icon' => 'building-2', 'title' => __('In-store sales missing online', 'ai-eshop-optimizer'), 'description' => __('Net in-store revenue over the window for SKUs that are not live online, plus an estimate of what publishing them would recover.', 'ai-eshop-optimizer'), 'footnote' => sprintf(__('Net physical-store revenue (ex-VAT) in the last %1$d days, for SKUs not live in the eshop yet — the sales we are missing by not having these products online. The recoverable estimate applies the eshop\'s channel share (%2$d%%) to that in-store demand.', 'ai-eshop-optimizer'), $gap_win, $ch_pct), 'col' => 2, )); echo $aieo_mhs_open; ?>
0) { $aieo_mhs_recov = \Rooster\Admin\Ui::stat( sprintf(__('Est. recoverable online sales if published · last %d days', 'ai-eshop-optimizer'), $gap_win), '≈ ' . $aieo_mhs_price($totals['recoverable']), array( 'hint' => __('pessimistic', 'ai-eshop-optimizer') . ' ' . $aieo_mhs_price($totals['recoverable_pess']) . ' · ' . __('optimistic', 'ai-eshop-optimizer') . ' ' . $aieo_mhs_price($totals['recoverable_opt']), 'attrs' => array('title' => sprintf(__('Estimate of the online sales we would capture if these products went live = their in-store sales (last %1$d days) x the eshop\'s share of total demand (%2$d%%). Optimistic reflects the eshop\'s national reach (~6,000 visitors/day) beyond the 4 stores\' catchment. An estimate, not a guarantee.', 'ai-eshop-optimizer'), $gap_win, $ch_pct)), ) ); echo $aieo_mhs_recov; } ?>
0) : list($aieo_mhs_open, $aieo_mhs_close) = AIEO_DMM_UI::card(array( 'anchor' => 'missing-hot-sellers-published-from-this-list-what-it-earned-onli', 'icon' => 'banknote', 'title' => __('Revenue from products you published', 'ai-eshop-optimizer'), 'description' => __('Online sales each SKU published from this list has earned since its publish date, net of cancelled and refunded orders, beside its in-store demand at publish.', 'ai-eshop-optimizer'), 'flush' => true, )); echo $aieo_mhs_open; ?>
(string) ($pe['image_url'] ?? ''), 'name' => $pe['product_name'] ?: ($pe['name'] ?: ($pe['sku'] ?: ('#' . $pe_pid))), 'edit_url' => $pe_pid > 0 ? admin_url('post.php?post=' . $pe_pid . '&action=edit') : '', 'sku' => (string) ($pe['sku'] ?? ''), 'unpublished' => !empty($pe['unpublished_at']), 'published' => (string) $pe['published_at'], 'demand' => (float) ($pe['phys_turnover_recent_at_publish'] ?? 0), 'earned' => (float) ($pe['eshop_turnover_since'] ?? 0), 'earned_units' => rtrim(rtrim((string) ($pe['eshop_units_since'] ?? 0), '0'), '.'), ); } AIEO_Table::render(array( 'id' => 'aieo-mhs-published', 'page_id' => 'missing_hot_sellers', 'sortable' => false, 'rows' => $aieo_mhs_pub_rows, 'cap' => 50, 'capped' => count($pub_events) > 50, 'total' => count($pub_events), 'columns' => array( array('key' => 'image', 'label' => '', 'sr_label' => __('Product image', 'ai-eshop-optimizer'), 'type' => 'image', 'width' => '34px', 'format' => array('size' => 30)), array( 'key' => 'name', 'label' => __('Product / SKU', 'ai-eshop-optimizer'), 'type' => 'link', 'format' => array('href' => 'edit_url', 'external' => true), 'subline' => 'sku', 'suffix' => static function ($r) { return !empty($r['unpublished']) ? __('unpublished', 'ai-eshop-optimizer') : ''; }, ), array('key' => 'published', 'label' => __('Published', 'ai-eshop-optimizer'), 'type' => 'date', 'format' => array('tz' => 'utc'), 'nowrap' => true), array( 'key' => 'demand', 'label' => __('In-store demand', 'ai-eshop-optimizer'), 'type' => 'money', 'header_tip' => __('In-store net turnover this product had when it was published', 'ai-eshop-optimizer'), ), array( 'key' => 'earned', 'label' => __('Online earned since', 'ai-eshop-optimizer'), 'type' => 'money', 'tone' => 'success', 'nowrap' => true, 'header_tip' => __('Online sales earned since it went live', 'ai-eshop-optimizer'), 'suffix' => static function ($r) { return '· ' . $r['earned_units'] . ' ' . __('u', 'ai-eshop-optimizer'); }, ), ), )); } echo $aieo_mhs_close; ?> 'missing-hot-sellers-priority-list', 'heading' => 'h2', 'description' => __('SKUs selling well in your physical stores that are still drafts or missing from the eshop, in the order to deal with them.', 'ai-eshop-optimizer'), 'title' => __('Priority list', 'ai-eshop-optimizer'), 'meta' => AIEO_DMM_UI::title_badge(number_format_i18n((int) $totals['count'])), )); } ?>