resolve_bar_items_config(); $chat_desktop_pos = $disp->resolve_chat_desktop_position(); } $heading = isset($settings['side_cart_heading']) ? (string) $settings['side_cart_heading'] : ''; $left_heading = isset($settings['side_cart_left_heading']) ? (string) $settings['side_cart_left_heading'] : ''; $border_enabled = !isset($settings['side_cart_card_border_enabled']) ? true : !empty($settings['side_cart_card_border_enabled']); $aieo_sc_picked = static function ($key) use ($settings) { return class_exists('AIEO_Side_Cart_Display') ? AIEO_Side_Cart_Display::colour($key, (string) ($settings[$key] ?? '')) : ''; }; $border_color = $aieo_sc_picked('side_cart_card_border_color'); $border_hover = $aieo_sc_picked('side_cart_card_border_hover'); $progress_style = (isset($settings['side_cart_progress_style']) && 'glass' === $settings['side_cart_progress_style']) ? 'glass' : 'line'; $theme_accent = ''; $aieo_pal = wp_get_global_settings(array('color', 'palette')); $aieo_pal = (isset($aieo_pal['theme']) || isset($aieo_pal['custom']) || isset($aieo_pal['default'])) ? array_merge((array) ($aieo_pal['theme'] ?? array()), (array) ($aieo_pal['custom'] ?? array()), (array) ($aieo_pal['default'] ?? array())) : (array) $aieo_pal; foreach ($aieo_pal as $aieo_c) { if (is_array($aieo_c) && ($aieo_c['slug'] ?? '') === 'accent' && !empty($aieo_c['color'])) { $theme_accent = (string) $aieo_c['color']; break; } } $accent_custom = '' !== $aieo_sc_picked('side_cart_accent_color'); $accent_color = $accent_custom ? $aieo_sc_picked('side_cart_accent_color') : $theme_accent; $reco_title_color = '' !== $aieo_sc_picked('side_cart_reco_title_color') ? $aieo_sc_picked('side_cart_reco_title_color') : $accent_color; $mbar_custom = !empty($settings['side_cart_mbar_custom']); $mbar_height = isset($settings['side_cart_mbar_height']) ? (int) $settings['side_cart_mbar_height'] : 58; $mbar_bg = $aieo_sc_picked('side_cart_mbar_bg'); $mbar_icon = $aieo_sc_picked('side_cart_mbar_icon'); $mbar_icon_active = $aieo_sc_picked('side_cart_mbar_icon_active'); $mbar_badge_bg = $aieo_sc_picked('side_cart_mbar_badge_bg'); $mbar_badge_fg = $aieo_sc_picked('side_cart_mbar_badge_fg'); $mbar_bubble = !isset($settings['side_cart_mbar_cart_bubble']) ? true : !empty($settings['side_cart_mbar_cart_bubble']); $mbar_glass = !empty($settings['side_cart_mbar_glass']); $mbar_opacity = isset($settings['side_cart_mbar_opacity']) ? (int) $settings['side_cart_mbar_opacity'] : 70; $mbar_blur = isset($settings['side_cart_mbar_blur']) ? (int) $settings['side_cart_mbar_blur'] : 12; $mbar_sel_enable = !empty($settings['side_cart_mbar_sel_enable']); $mbar_sel_def = array('bg' => '', 'fg' => '', 'bc' => ''); $mbar_sel = array(); foreach (array('nav', 'search', 'chat', 'consent', 'cart') as $sslug) { foreach (array('bg', 'fg', 'bc') as $spart) { $skey = 'side_cart_mbar_' . $sslug . '_sel_' . $spart; $mbar_sel[$sslug][$spart] = $aieo_sc_picked($skey); } } $fs_threshold = isset($settings['free_shipping']['free_shipping_threshold']) ? (float) $settings['free_shipping']['free_shipping_threshold'] : 0.0; $label_fields = array( 'side_cart_tab_bag' => array(__('Shopping bag tab', 'ai-eshop-optimizer'), __('SHOPPING BAG', 'ai-eshop-optimizer')), 'side_cart_tab_viewed' => array(__('Recently viewed tab', 'ai-eshop-optimizer'), __('RECENTLY VIEWED', 'ai-eshop-optimizer')), 'side_cart_continue' => array(__('Continue shopping', 'ai-eshop-optimizer'), __('Continue shopping', 'ai-eshop-optimizer')), 'side_cart_maylike_title' => array(__('You may also like…', 'ai-eshop-optimizer'), __('You may also like', 'ai-eshop-optimizer')), 'side_cart_subtotal_label' => array(__('Subtotal label', 'ai-eshop-optimizer'), __('SUBTOTAL:', 'ai-eshop-optimizer')), 'side_cart_coupon_link' => array(__('Coupon toggle link', 'ai-eshop-optimizer'), __('Have a Coupon?', 'ai-eshop-optimizer')), 'side_cart_btn_cart' => array(__('Cart button', 'ai-eshop-optimizer'), __('Cart', 'ai-eshop-optimizer')), 'side_cart_btn_checkout' => array(__('Checkout button', 'ai-eshop-optimizer'), __('Checkout', 'ai-eshop-optimizer')), 'side_cart_btn_addbag' => array(__('Add-to-bag button', 'ai-eshop-optimizer'), __('Add to bag', 'ai-eshop-optimizer')), 'side_cart_rv_empty' => array(__('Recently viewed empty state', 'ai-eshop-optimizer'), __('No recently viewed products.', 'ai-eshop-optimizer')), 'side_cart_quick_view_label' => array(__('Quick view button', 'ai-eshop-optimizer'), __('Discover it', 'ai-eshop-optimizer')), 'side_cart_qv_view_product' => array(__('Quick view "view product" link', 'ai-eshop-optimizer'), __('View product details', 'ai-eshop-optimizer')), 'side_cart_in_cart_label' => array(__('Already-in-bag indicator', 'ai-eshop-optimizer'), __('In bag', 'ai-eshop-optimizer')), ); $aieo_sc_save = static function ($form) { return class_exists('\Rooster\Admin\States') ? \Rooster\Admin\States::save_button($form) : ''; }; $aieo_sc_form = static function ($form, $html) { return AIEO_DMM_UI::card_form('aieo_dmm_side_cart_save_settings', 'side_cart', $form, $html); }; $aieo_sc_fields = static function (array $rows) { return '
' . implode('', $rows) . '
'; }; $aieo_sc_switch = static function ($name, $on, $label, $sentence, $help = '') { $id = 'aieo-sc-' . $name; return \Rooster\Admin\Ui::field_row(array( 'id' => $id, 'label' => $label, 'control' => \Rooster\Admin\Ui::toggle($name, (bool) $on, array('id' => $id, 'hidden' => false, 'label' => $sentence)), 'help' => $help, )); }; $aieo_sc_colour = static function ($name, $value, $label, $help = '') { $id = 'aieo-sc-' . $name; return \Rooster\Admin\Ui::field_row(array( 'id' => $id, 'label' => $label, 'control' => \Rooster\Admin\Fields::color($name, (string) $value, array('id' => $id, 'default' => '', 'label' => $label)), 'help' => $help, )); }; $aieo_sc_number = static function ($name, $value, $label, $unit, $min, $max) { $id = 'aieo-sc-' . $name; return \Rooster\Admin\Ui::field_row(array( 'id' => $id, 'label' => $label, 'control' => \Rooster\Admin\Ui::input($name, (string) (int) $value, array('id' => $id, 'type' => 'number', 'xs' => true, 'unit' => $unit, 'min' => $min, 'max' => $max, 'step' => 1)), )); }; $aieo_sc_text = static function ($name, $value, $label, $placeholder, $help = '') { $id = 'aieo-sc-' . $name; return \Rooster\Admin\Ui::field_row(array( 'id' => $id, 'label' => $label, 'control' => \Rooster\Admin\Ui::input($name, (string) $value, array('id' => $id, 'medium' => true, 'placeholder' => $placeholder)), 'help' => $help, )); }; $aieo_sc_select = static function ($name, array $options, $value, $label, $help = '') { $id = 'aieo-sc-' . $name; return \Rooster\Admin\Ui::field_row(array( 'id' => $id, 'label' => $label, 'control' => \Rooster\Admin\Ui::select($name, $options, (string) $value, array('id' => $id)), 'help' => $help, )); }; $aieo_sc_fact = static function ($label, $html) { return \Rooster\Admin\Ui::field_row(array( 'group' => true, 'label' => $label, 'control' => '

' . $html . '

', )); }; $aieo_sc_f = 'aieo-dmm-side-cart-form'; rooster_admin_band_open(array('cols' => 2)); list($aieo_sc_open, $aieo_sc_close) = AIEO_DMM_UI::card(array( 'anchor' => 'side-cart-floating-side-cart-mini-cart', 'icon' => 'panel-right', 'title' => __('Panel', 'ai-eshop-optimizer'), 'description' => __('Rey-style floating trigger + two-column side panel: shopping bag on the right, "you might like" recommendations + free-shipping progress on the left. Optimistic quantity updates with a 500 ms debounced AJAX keep it instant, and cart HTML is cached per cart_hash in the WC session (30 s TTL) to avoid recomputing on every open.', 'ai-eshop-optimizer'), 'col' => 1, 'footer' => $aieo_sc_save($aieo_sc_f), )); echo $aieo_sc_open; echo \Rooster\Admin\Ui::notice( esc_html__('If you keep om-free-shipping active with its own mini-cart enabled, you will get two panels. Disable om-free-shipping (or its mini-cart toggle) once this side cart is live.', 'ai-eshop-optimizer'), 'warning', array('title' => __('Important', 'ai-eshop-optimizer'), 'inline' => true) ); echo $aieo_sc_form($aieo_sc_f, $aieo_sc_fields(array( $aieo_sc_switch('side_cart_enabled', $enabled, __('Enabled', 'ai-eshop-optimizer'), __('Render the floating trigger + side cart on the frontend', 'ai-eshop-optimizer')), $aieo_sc_switch('side_cart_open_on_add', $open_on_add, __('Open on add to cart', 'ai-eshop-optimizer'), __('Auto-open the side cart panel every time a product is added to the cart', 'ai-eshop-optimizer'), __('When off, the cart counter just updates silently. When on, the panel slides open so the shopper can review what they just added.', 'ai-eshop-optimizer')), $aieo_sc_switch('side_cart_hide_zero', $hide_zero_on, __('Count at zero', 'ai-eshop-optimizer'), __('Hide the number on the cart icon while the cart is empty', 'ai-eshop-optimizer'), __('When off, the cart icon shows a 0 on an empty cart.', 'ai-eshop-optimizer')), $aieo_sc_switch('side_cart_quick_view_enabled', $quick_view_on, __('Quick view on archives', 'ai-eshop-optimizer'), __('Show a "Discover it" button under each shop-loop product', 'ai-eshop-optimizer'), __('Clicking it opens the side cart in quick-view mode: large image, title, price, and an add-to-cart button — all pulled from the archive card already on the page (no extra round-trip). The button label is configurable below under "Visible labels".', 'ai-eshop-optimizer')), $aieo_sc_switch('side_cart_rows_qty', $rows_qty_on, __('Quantity in Recently viewed and Favourites (test)', 'ai-eshop-optimizer'), __('A row\'s basket adds one and becomes − 1 + in its place', 'ai-eshop-optimizer'), __('As on delivery apps: the minus and the plus change the quantity in the bag, and the minus at one takes the product out and brings the basket back. Products with options open them first, as before. A test, in the Interactivity side cart.', 'ai-eshop-optimizer')), $aieo_sc_text('side_cart_heading', $heading, __('Panel heading', 'ai-eshop-optimizer'), __('Your Bag', 'ai-eshop-optimizer'), __('Top-right title of the slide-out panel. Leave empty for the default "Your Bag".', 'ai-eshop-optimizer')), $aieo_sc_text('side_cart_left_heading', $left_heading, __('Left column heading', 'ai-eshop-optimizer'), __('You might like', 'ai-eshop-optimizer'), __('Small header shown above the recommendations carousel in the left column.', 'ai-eshop-optimizer')), ))); if (!function_exists('is_plugin_active')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $ppe_active = is_plugin_active('om-product-page-essentials/om-product-page-essentials.php'); $aieo_table = $GLOBALS['wpdb']->prefix . 'aieo_wishlist'; $aieo_exists = (string) $GLOBALS['wpdb']->get_var($GLOBALS['wpdb']->prepare('SHOW TABLES LIKE %s', $aieo_table)) === $aieo_table; $aieo_sc_fs_text = html_entity_decode(wp_strip_all_tags(wc_price($fs_threshold)), ENT_QUOTES, 'UTF-8'); echo $aieo_sc_fields(array( $aieo_sc_fact( __('Free shipping progress', 'ai-eshop-optimizer'), sprintf( esc_html__('The progress bar at the top of the cart uses the threshold configured in the Free Shipping tab (currently %s). Messages also come from there.', 'ai-eshop-optimizer'), '' . esc_html($aieo_sc_fs_text) . '' ) ), $aieo_sc_fact(__('Recommendations source', 'ai-eshop-optimizer'), esc_html__('The "you might like" carousel pulls from the DMM product bundle endpoint (the same superset AJAX that powers single-product-page recommendations). The Recently Viewed tab reads from localStorage first, then falls back to the same bundle endpoint. No extra queries on panel open.', 'ai-eshop-optimizer')), $aieo_sc_fact( __('Favorites / wishlist', 'ai-eshop-optimizer'), sprintf( esc_html__('Side-cart Favorites tab persists to %1$s via the aieo_wishlist_toggle endpoint, sharing the %2$s cookie so toggles stay in sync with any other wishlist UI on the page.', 'ai-eshop-optimizer'), '' . esc_html($aieo_table) . '', 'woocommerce_items_in_cart_merchant_wishlist' ) . '

' . esc_html__('Schema:', 'ai-eshop-optimizer') . ' ' . ($aieo_exists ? \Rooster\Admin\Ui::badge(__('table is installed.', 'ai-eshop-optimizer'), 'success') : \Rooster\Admin\Ui::badge(__('table NOT installed yet — visit any frontend page or re-activate the plugin.', 'ai-eshop-optimizer'), 'destructive')) . ($ppe_active ? '

' . esc_html__('OM Product Essentials wishlist is also active. During this Phase-1 migration, hearts toggled in the side cart are written to BOTH tables for safety. Phase 2 will retire the PPE module.', 'ai-eshop-optimizer') . '' : '') ), )); echo $aieo_sc_close; $aieo_sc_f = 'aieo-card-side-cart-bottom-bar-items-form'; list($aieo_sc_open, $aieo_sc_close) = AIEO_DMM_UI::card(array( 'anchor' => 'side-cart-bottom-bar-items', 'description' => __('The items of the side cart\'s bottom bar on phones, in their order, and which of them show.', 'ai-eshop-optimizer'), 'icon' => 'list-ordered', 'title' => __('Bottom bar items (mobile)', 'ai-eshop-optimizer'), 'col' => 2, 'footer' => $aieo_sc_save($aieo_sc_f), )); echo $aieo_sc_open; $aieo_sc_trows = array(); $aieo_sc_bar_json = array(); foreach ($bar_items_config as $aieo_sc_bi) { $aieo_sc_slug = (string) $aieo_sc_bi['slug']; $aieo_sc_label = (string) $aieo_sc_bi['label']; $aieo_sc_bar_json[] = array('slug' => $aieo_sc_slug, 'enabled' => !empty($aieo_sc_bi['enabled'])); $aieo_sc_trows[] = array( '_id' => $aieo_sc_slug, '_name' => $aieo_sc_label, '_attrs' => array('data-slug' => $aieo_sc_slug), 'option' => $aieo_sc_label, 'visible' => array('html' => ''), ); } ob_start(); echo \Rooster\Admin\Guidance::text(__('Drag to reorder. Toggle each item to show or hide it. The order applies to the mobile bottom bar; on desktop only the cart trigger and the AI Chat launcher are visible (the rest of the desktop UI carries the navigator + search in the header).', 'ai-eshop-optimizer'), 'guidance', array('about' => __('Bottom bar items (mobile)', 'ai-eshop-optimizer'))); echo '

'; echo \Rooster\Admin\Ui::table( array( array('key' => 'option', 'label' => __('Option', 'ai-eshop-optimizer'), 'type' => 'text'), array('key' => 'visible', 'label' => __('Visible', 'ai-eshop-optimizer'), 'type' => 'html', 'align' => 'center'), ), $aieo_sc_trows, array( 'id' => 'aieo-sc-bar-items', 'caption' => __('Bottom bar items (mobile)', 'ai-eshop-optimizer'), 'move' => array('label' => __('Bottom bar items (mobile)', 'ai-eshop-optimizer')), ) ); echo '
'; echo ''; echo $aieo_sc_fields(array( $aieo_sc_select( 'side_cart_chat_desktop_position', array( 'left' => __('Bottom-left (symmetric to cart)', 'ai-eshop-optimizer'), 'above' => __('Stacked above cart (same right edge)', 'ai-eshop-optimizer'), ), $chat_desktop_pos, __('AI Chat on desktop', 'ai-eshop-optimizer'), __('Where the AI Chat launcher sits on desktop. Same 56×56 circle as the cart trigger; "above" stacks them with a 20px gap. Only takes effect when "AI Chat" is enabled in the bar items list above.', 'ai-eshop-optimizer') ), )); echo $aieo_sc_form($aieo_sc_f, (string) ob_get_clean()); echo $aieo_sc_close; rooster_admin_band_close(); $aieo_sc_f = 'aieo-card-side-cart-bottom-bar-look-form'; rooster_admin_band_open(array('cols' => 2)); list($aieo_sc_open, $aieo_sc_close) = AIEO_DMM_UI::card(array( 'anchor' => 'side-cart-bottom-bar-look', 'icon' => 'palette', 'title' => __('Mobile bottom bar look', 'ai-eshop-optimizer'), 'description' => __('Make the mobile sticky bottom bar look the same on any theme. These controls apply to mobile only — desktop keeps its own floating circle. The cart-count colours here can differ from desktop.', 'ai-eshop-optimizer'), 'col' => 1, 'footer' => $aieo_sc_save($aieo_sc_f), )); echo $aieo_sc_open; echo $aieo_sc_form($aieo_sc_f, $aieo_sc_fields(array( $aieo_sc_switch('side_cart_mbar_custom', $mbar_custom, __('Custom colours', 'ai-eshop-optimizer'), __('Use custom colours (make the bar theme-independent)', 'ai-eshop-optimizer'), __('When off, the bar inherits your theme’s accent (background) and text colours — the current look. Turn on to paint the colours chosen below regardless of theme.', 'ai-eshop-optimizer')), $aieo_sc_number('side_cart_mbar_height', $mbar_height, __('Bar height', 'ai-eshop-optimizer'), 'px', 40, 96), $aieo_sc_colour('side_cart_mbar_bg', $mbar_bg, __('Bar background', 'ai-eshop-optimizer')), $aieo_sc_colour('side_cart_mbar_icon', $mbar_icon, __('Icon colour', 'ai-eshop-optimizer')), $aieo_sc_colour('side_cart_mbar_icon_active', $mbar_icon_active, __('Selected icon colour', 'ai-eshop-optimizer'), __('The icon colour of the active/pressed button (e.g. Search while its panel is open) — a cue that tapping again closes it. Applies to menu, search, AI chat, cookies and cart.', 'ai-eshop-optimizer')), $aieo_sc_colour('side_cart_mbar_badge_fg', $mbar_badge_fg, __('Cart-count number', 'ai-eshop-optimizer')), $aieo_sc_colour('side_cart_mbar_badge_bg', $mbar_badge_bg, __('Cart-count circle', 'ai-eshop-optimizer')), $aieo_sc_switch('side_cart_mbar_glass', $mbar_glass, __('Glass effect', 'ai-eshop-optimizer'), __('Glass effect (transparent bar with backdrop blur)', 'ai-eshop-optimizer'), __('Renders the bar background semi-transparent so page content shows through, with a frosted-glass blur. Uses the bar background colour above (or your theme accent).', 'ai-eshop-optimizer')), $aieo_sc_number('side_cart_mbar_opacity', $mbar_opacity, __('Opacity', 'ai-eshop-optimizer'), '%', 0, 100), $aieo_sc_number('side_cart_mbar_blur', $mbar_blur, __('Blur', 'ai-eshop-optimizer'), 'px', 0, 40), $aieo_sc_switch('side_cart_mbar_cart_bubble', $mbar_bubble, __('Cart bubble', 'ai-eshop-optimizer'), __('When only the cart icon is enabled, show it as a floating bubble (like desktop) instead of a full-width bar', 'ai-eshop-optimizer'), __('Gives the clean desktop-style circle and fixes the single-icon left-alignment. With two or more icons enabled the full bar is always used; a single non-cart icon is centred.', 'ai-eshop-optimizer')), ))); echo $aieo_sc_close; $aieo_sc_f = 'aieo-card-side-cart-colours-form'; list($aieo_sc_open, $aieo_sc_close) = AIEO_DMM_UI::card(array( 'anchor' => 'side-cart-colours', 'description' => __('The border around the side cart\'s product cards and the accent colour of its highlights and progress bars.', 'ai-eshop-optimizer'), 'icon' => 'layers', 'title' => __('Card border and accent colours', 'ai-eshop-optimizer'), 'col' => 2, 'footer' => $aieo_sc_save($aieo_sc_f), )); echo $aieo_sc_open; echo $aieo_sc_form($aieo_sc_f, $aieo_sc_fields(array( $aieo_sc_switch('side_cart_card_border_enabled', $border_enabled, __('Card border', 'ai-eshop-optimizer'), __('Show a 1px border around recommendation / favorites / recently-viewed cards', 'ai-eshop-optimizer'), __('Default: brand gold (matches the active tab underline + CHECKOUT pill) with a darker tan on hover. Pick any colour or disable for a borderless flat-card look.', 'ai-eshop-optimizer')), $aieo_sc_colour('side_cart_card_border_color', $border_color, __('Border colour', 'ai-eshop-optimizer')), $aieo_sc_colour('side_cart_card_border_hover', $border_hover, __('Hover colour', 'ai-eshop-optimizer')), $aieo_sc_switch( 'side_cart_accent_custom', $accent_custom, __('Accent colours', 'ai-eshop-optimizer'), __('Use custom accent colours (otherwise the side-cart follows your theme accent automatically)', 'ai-eshop-optimizer'), sprintf(__('“Accent” drives the active tab underline, the count badge, the free-shipping progress bar and the gift-quantity label. “Recommendations title” is the left-column “You may like” heading (defaults to the accent). Leave the box unticked to follow your theme accent (%s).', 'ai-eshop-optimizer'), $theme_accent) ), $aieo_sc_colour('side_cart_accent_color', $accent_color, __('Accent', 'ai-eshop-optimizer')), $aieo_sc_colour('side_cart_reco_title_color', $reco_title_color, __('Recommendations title', 'ai-eshop-optimizer')), $aieo_sc_select( 'side_cart_progress_style', array( 'line' => __('Words above a thin line', 'ai-eshop-optimizer'), 'glass' => __('Words on the bar, centred, in glass', 'ai-eshop-optimizer'), ), $progress_style, __('Progress bars', 'ai-eshop-optimizer'), __('The free-shipping bar in the side cart and on the product page, and each gift offer\'s bar in the side cart. The thin line is drawn in your theme\'s text colour and turns to its success colour once the order qualifies; gifts are gold; a gift offer\'s own bar colours still win.', 'ai-eshop-optimizer') ), ))); echo $aieo_sc_close; rooster_admin_band_close(); $aieo_sc_f = 'aieo-card-side-cart-active-option-form'; rooster_admin_band_open(array('cols' => 1)); list($aieo_sc_open, $aieo_sc_close) = AIEO_DMM_UI::card(array( 'anchor' => 'side-cart-active-option', 'description' => __('How each option of the bottom bar is highlighted while its panel is open, with its own colours.', 'ai-eshop-optimizer'), 'icon' => 'toggle-left', 'title' => __('Active option colours', 'ai-eshop-optimizer'), 'footer' => $aieo_sc_save($aieo_sc_f), )); echo $aieo_sc_open; $aieo_sc_rows = array( $aieo_sc_switch('side_cart_mbar_sel_enable', $mbar_sel_enable, __('Highlight', 'ai-eshop-optimizer'), __('Style the selected (active) option', 'ai-eshop-optimizer'), __('Highlight each option while its panel/drawer is open — background, text/icon and border colour per option.', 'ai-eshop-optimizer')), ); $aieo_sc_parts = array( 'bg' => __('Background', 'ai-eshop-optimizer'), 'fg' => __('Text / icon', 'ai-eshop-optimizer'), 'bc' => __('Border', 'ai-eshop-optimizer'), ); foreach (array( 'nav' => __('Navigator', 'ai-eshop-optimizer'), 'search' => __('Search', 'ai-eshop-optimizer'), 'chat' => __('AI Chat', 'ai-eshop-optimizer'), 'consent' => __('Cookie settings', 'ai-eshop-optimizer'), 'cart' => __('Cart', 'ai-eshop-optimizer'), ) as $sslug => $slabel) { $aieo_sc_row_parts = array(); foreach ($aieo_sc_parts as $spart => $spart_label) { $aieo_sc_name = 'side_cart_mbar_' . $sslug . '_sel_' . $spart; $aieo_sc_row_parts[] = array( 'label' => $spart_label, 'id' => 'aieo-sc-' . $aieo_sc_name, 'control' => \Rooster\Admin\Fields::color($aieo_sc_name, (string) $mbar_sel[$sslug][$spart], array('id' => 'aieo-sc-' . $aieo_sc_name, 'default' => '', 'label' => $slabel . ', ' . $spart_label)), ); } $aieo_sc_rows[] = \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-sc-sel-' . $sslug, 'label' => $slabel, 'parts' => $aieo_sc_row_parts, )); } echo $aieo_sc_form($aieo_sc_f, $aieo_sc_fields($aieo_sc_rows)); echo $aieo_sc_close; rooster_admin_band_close(); $aieo_sc_foot = AIEO_Side_Cart_Display::foot_buttons($settings); $btn_show_cart = $aieo_sc_foot['cart']; $btn_show_save = $aieo_sc_foot['save']; $btn_save_label = isset($settings['side_cart_btn_save']) ? (string) $settings['side_cart_btn_save'] : ''; $btn_defs = array( 'cart' => array('label' => __('CART button', 'ai-eshop-optimizer'), 'desc' => __('The colours, corners and border of the side cart\'s CART button.', 'ai-eshop-optimizer'), 'bg' => '', 'color' => '', 'radius' => 24), 'checkout' => array('label' => __('CHECKOUT button', 'ai-eshop-optimizer'), 'desc' => __('The colours, corners and border of the side cart\'s CHECKOUT button.', 'ai-eshop-optimizer'), 'bg' => '', 'color' => '', 'radius' => 24), 'save' => array('label' => __('SAVE button (Saved Carts)', 'ai-eshop-optimizer'), 'desc' => __('The colours, corners and border of the side cart\'s SAVE button, for Saved Carts.', 'ai-eshop-optimizer'), 'bg' => '', 'color' => '', 'radius' => 24), ); $border_styles = array( 'none' => __('None (no border)', 'ai-eshop-optimizer'), 'solid' => __('Solid', 'ai-eshop-optimizer'), 'dashed' => __('Dashed', 'ai-eshop-optimizer'), 'dotted' => __('Dotted', 'ai-eshop-optimizer'), 'double' => __('Double', 'ai-eshop-optimizer'), ); $aieo_sc_f = 'aieo-card-side-cart-action-buttons-form'; rooster_admin_band_open(array('cols' => 2)); list($aieo_sc_open, $aieo_sc_close) = AIEO_DMM_UI::card(array( 'anchor' => 'side-cart-action-buttons', 'description' => __('Whether the side cart shows its CART and SAVE buttons, and the colours, corners and border of each button.', 'ai-eshop-optimizer'), 'icon' => 'rows-3', 'title' => __('Action buttons (CART / CHECKOUT)', 'ai-eshop-optimizer'), 'col' => 1, 'footnote' => __('Leave a colour empty to use the theme\'s: CART and SAVE in its quiet surface, CHECKOUT in its button colour. Border style "None" omits the border entirely; any other style uses the chosen width + colour.', 'ai-eshop-optimizer'), 'footer' => $aieo_sc_save($aieo_sc_f), )); echo $aieo_sc_open; ob_start(); echo ''; foreach ($btn_defs as $which => $def) { $bg = $aieo_sc_picked('side_cart_btn_' . $which . '_bg'); $color = $aieo_sc_picked('side_cart_btn_' . $which . '_color'); $bstyle = isset($settings['side_cart_btn_' . $which . '_border_style']) ? (string) $settings['side_cart_btn_' . $which . '_border_style'] : 'none'; $bcolor = $aieo_sc_picked('side_cart_btn_' . $which . '_border_color'); $bwidth = isset($settings['side_cart_btn_' . $which . '_border_width']) ? (int) $settings['side_cart_btn_' . $which . '_border_width'] : 0; $radius = isset($settings['side_cart_btn_' . $which . '_radius']) ? (int) $settings['side_cart_btn_' . $which . '_radius'] : (int) $def['radius']; $aieo_sc_rows = array(); if ('cart' === $which) { $aieo_sc_rows[] = $aieo_sc_switch('side_cart_show_cart_btn', $btn_show_cart, __('Visible', 'ai-eshop-optimizer'), __('Show the CART button', 'ai-eshop-optimizer'), __('A link to the cart page, where the SAVE button is off. The side cart is the cart already, so it is off by default.', 'ai-eshop-optimizer')); } elseif ('save' === $which) { $aieo_sc_rows[] = $aieo_sc_switch('side_cart_show_save_btn', $btn_show_save, __('Visible', 'ai-eshop-optimizer'), __('Show the SAVE button (Saved Carts) — takes the CART button’s slot', 'ai-eshop-optimizer'), __('Lets shoppers save & share their cart straight from the side-cart (auto-copies the share link). Style it below.', 'ai-eshop-optimizer')); $aieo_sc_rows[] = \Rooster\Admin\Ui::field_row(array( 'id' => 'aieo-sc-btn-save-text', 'label' => __('SAVE button text', 'ai-eshop-optimizer'), 'control' => \Rooster\Admin\Ui::input('side_cart_btn_save', $btn_save_label, array('id' => 'aieo-sc-btn-save-text', 'medium' => true, 'placeholder' => __('Save cart', 'ai-eshop-optimizer'))), )); } $aieo_sc_rows[] = $aieo_sc_colour('side_cart_btn_' . $which . '_bg', $bg, __('Background', 'ai-eshop-optimizer')); $aieo_sc_rows[] = $aieo_sc_colour('side_cart_btn_' . $which . '_color', $color, __('Text colour', 'ai-eshop-optimizer')); $aieo_sc_rows[] = $aieo_sc_select('side_cart_btn_' . $which . '_border_style', $border_styles, $bstyle, __('Border', 'ai-eshop-optimizer')); $aieo_sc_rows[] = $aieo_sc_number('side_cart_btn_' . $which . '_border_width', $bwidth, __('Border width', 'ai-eshop-optimizer'), 'px', 0, 8); $aieo_sc_rows[] = $aieo_sc_colour('side_cart_btn_' . $which . '_border_color', $bcolor, __('Border colour', 'ai-eshop-optimizer')); $aieo_sc_rows[] = $aieo_sc_number('side_cart_btn_' . $which . '_radius', $radius, __('Corner radius', 'ai-eshop-optimizer'), 'px', 0, 48); list($aieo_sc_sub_open, $aieo_sc_sub_close) = AIEO_DMM_UI::card(array( 'anchor' => 'side-cart-action-buttons-' . $which, 'level' => 3, 'title' => $def['label'], 'description' => $def['desc'], )); echo $aieo_sc_sub_open . $aieo_sc_fields($aieo_sc_rows) . $aieo_sc_sub_close; } echo $aieo_sc_form($aieo_sc_f, (string) ob_get_clean()); echo $aieo_sc_close; $aieo_sc_f = 'aieo-card-side-cart-visible-labels-form'; list($aieo_sc_open, $aieo_sc_close) = AIEO_DMM_UI::card(array( 'anchor' => 'side-cart-visible-labels', 'icon' => 'languages', 'title' => __('Visible labels', 'ai-eshop-optimizer'), 'description' => __('Override the wording shown to shoppers. Leave any field empty to use the default (which still goes through the translation files).', 'ai-eshop-optimizer'), 'col' => 2, 'footer' => $aieo_sc_save($aieo_sc_f), )); echo $aieo_sc_open; ob_start(); foreach (array( 'panel' => array(__('In the side cart', 'ai-eshop-optimizer'), array('side_cart_tab_bag', 'side_cart_tab_viewed', 'side_cart_continue', 'side_cart_maylike_title', 'side_cart_subtotal_label', 'side_cart_coupon_link', 'side_cart_btn_cart', 'side_cart_btn_checkout', 'side_cart_rv_empty'), __('The words the side cart shows on its tabs, links, headings and subtotal line.', 'ai-eshop-optimizer')), 'cards' => array(__('Quick view and product cards', 'ai-eshop-optimizer'), array('side_cart_btn_addbag', 'side_cart_quick_view_label', 'side_cart_qv_view_product', 'side_cart_in_cart_label'), __('The words on the product cards\' buttons and labels and in the quick view window.', 'ai-eshop-optimizer')), ) as $aieo_sc_group => $aieo_sc_def) { $aieo_sc_rows = array(); foreach ($aieo_sc_def[1] as $key) { $aieo_sc_rows[] = $aieo_sc_text($key, isset($settings[$key]) ? (string) $settings[$key] : '', $label_fields[$key][0], $label_fields[$key][1]); } list($aieo_sc_sub_open, $aieo_sc_sub_close) = AIEO_DMM_UI::card(array( 'anchor' => 'side-cart-visible-labels-' . $aieo_sc_group, 'level' => 3, 'title' => $aieo_sc_def[0], 'description' => $aieo_sc_def[2], )); echo $aieo_sc_sub_open . $aieo_sc_fields($aieo_sc_rows) . $aieo_sc_sub_close; } echo $aieo_sc_form($aieo_sc_f, (string) ob_get_clean()); echo $aieo_sc_close; ?> 'side-cart-how-it-works', 'icon' => 'circle-question-mark', 'title' => __('How the side cart refreshes', 'ai-eshop-optimizer'), 'description' => __('+/- updates the line and progress bar instantly, AJAX debounced 500 ms; the panel HTML stays cached in the WC session until an add, remove, coupon or clear.', 'ai-eshop-optimizer'), 'col' => 2, )); echo $aieo_sc_open; ?>