get_settings('comparison');
$is_show_in_single = isset($sett['show_on_single_page']['value']) ? ($sett['show_on_single_page']['value'] === 'yes') : true;
if($is_show_in_single === true) {
if($this->get_where_to($sett) == 'after') {
add_action('woocommerce_after_add_to_cart_button', [$this, 'print_the_button_in_single_page']);
} else {
add_action('woocommerce_before_add_to_cart_button', [$this, 'print_the_button_in_single_page']);
}
}
$is_show = isset($sett['show_on_archive_page']['value']) ? ($sett['show_on_archive_page']['value'] === 'yes') : true;
$show_in_archive = apply_filters('shopengine/module/wishlist/show_icon_in_shop_page', $is_show);
if($show_in_archive === true) {
add_filter('woocommerce_loop_add_to_cart_link', [$this, 'print_button_in_shop'], 10, 3);
}
add_action('wp_enqueue_scripts', [$this, 'enqueue']);
// Modal Wrapper
add_action( 'wp_footer', [$this, 'qc_modal_wrapper'] );
add_action( 'woocommerce_admin_process_product_object', [new Group_Meta(), 'index'], 10, 1 );
}
public function qc_modal_wrapper() {
?>
get_the_ID(),
'resturl' => get_rest_url(),
'rest_nonce' => wp_create_nonce('wp_rest'),
]);
}
public function get_where_to($settings = []) {
$position = !empty($settings['show_icon_where_to']['value']) ? $settings['show_icon_where_to']['value'] : 'after';
return apply_filters('shopengine/module/comparison/put_icon_in_side', $position);
}
private function is_exists_in_list($idd) {
if(empty($_COOKIE[Comparison::COOKIE_KEY])) {
return false;
}
$content = explode(',', sanitize_text_field( wp_unslash( $_COOKIE[Comparison::COOKIE_KEY] ) ) );
return in_array($idd, $content);
}
public function add_to_menu($menu_links) {
$logout = $menu_links['customer-logout'];
unset($menu_links['customer-logout']);
$menu_links['wishlist'] = 'Wishlist';
$menu_links['customer-logout'] = $logout;
return $menu_links;
}
public function print_the_button_in_single_page() {
$left_text = apply_filters('shopengine/module/wishlist/optional_text_left', '');
$right_text = apply_filters('shopengine/module/wishlist/optional_text_right', '');
$pid = get_the_ID();
$exist = $this->is_exists_in_list($pid);
$cls = $exist ? 'active' : 'inactive';
$compare_icon = '';
echo wp_kses($left_text, Helper::get_kses_array()); ?>
get_settings('comparison');
$left_text = apply_filters('shopengine/module/wishlist/optional_text_left', '');
$right_text = apply_filters('shopengine/module/wishlist/optional_text_right', '');
$pid = $product->get_id();
$exist = $this->is_exists_in_list($pid);
$cls = $exist ? 'active' : 'inactive';
$compare_icon = '';
$btn = $left_text .
'get_id() . '}\'' .
' class="' . self::ONCLICK_SELECTOR_CLS . ' shopengine-comparison badge se-btn ' . esc_attr($cls) . '"> ' . $compare_icon . ' ' .
$right_text;
if($this->get_where_to() == 'after') {
$before = '';
$after = $btn;
} else {
$before = $btn;
$after = '';
}
return $before . $add_to_cart_html . $after;
}
}