Ejemplo n.º 1
1
 /**
  * Retrieve the number of products in the wishlist.
  * 
  * @return int
  * @since 1.0.0
  */
 function yith_wcwl_count_products()
 {
     return YITH_WCWL()->count_products();
 }
function roen_woocommerce_get_wishlist($add_wishlist = '', $just_added = '', $view_wishlist = '', $tooltip = true)
{
    global $product;
    $url = YITH_WCWL()->get_wishlist_url();
    $product_type = $product->product_type;
    $default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
    if (!empty($default_wishlists)) {
        $default_wishlist = $default_wishlists[0]['ID'];
    } else {
        $default_wishlist = false;
    }
    $exists = YITH_WCWL()->is_product_in_wishlist($product->id, $default_wishlist);
    $label = '';
    $icon = '';
    if ($tooltip) {
        $classes = 'class="add_to_wishlist woo-show-tooltip"';
    } else {
        $classes = 'class="add_to_wishlist"';
    }
    //$classes = get_option( 'yith_wcwl_use_button' ) == 'yes' ? 'class=" product-details add_to_wishlist single_add_to_wishlist"' : 'class="add_to_wishlist product-details"';
    $html = '<div class="yith-wcwl-add-to-wishlist add-to-wishlist-' . $product->id . '">';
    $html .= '<div class="yith-wcwl-add-button';
    // the class attribute is closed in the next row
    $html .= $exists ? ' hide" style="display:none;"' : ' show"';
    $html .= '><a href="' . esc_url(YITH_WCWL()->get_addtowishlist_url()) . '" data-product-id="' . $product->id . '" title="' . __('Add to wishlist', 'ROEN') . '" data-product-type="' . $product_type . '" ' . $classes . ' ><i class="fa fa-heart-o"></i>' . $add_wishlist . '<div class="ajax-loading" style="visibility:hidden"><i class="fa fa-spinner fa-spin"></i></div></a>';
    $html .= '</div>';
    $html .= '<div class="yith-wcwl-wishlistaddedbrowse hide" style="display:none;"><a href="' . esc_url($url) . '"><i class="fa fa-heart"></i>' . $just_added . '</a></div>';
    $html .= '<div class="yith-wcwl-wishlistexistsbrowse ' . ($exists ? 'show' : 'hide') . '" style="display:' . ($exists ? 'block' : 'none') . '"><a href="' . esc_url($url) . '"><i class="fa fa-heart"></i>' . $view_wishlist . '</a></div>';
    $html .= '<div class="yith-wcwl-wishlistaddresponse"></div>';
    $html .= '</div>';
    return $html;
}
Ejemplo n.º 3
0
 function yith_wishlist_constructor()
 {
     load_plugin_textdomain('yith-woocommerce-wishlist', false, dirname(plugin_basename(__FILE__)) . '/languages/');
     // Load required classes and functions
     require_once YITH_WCWL_INC . 'functions.yith-wcwl.php';
     require_once YITH_WCWL_INC . 'class.yith-wcwl.php';
     require_once YITH_WCWL_INC . 'class.yith-wcwl-init.php';
     require_once YITH_WCWL_INC . 'class.yith-wcwl-install.php';
     if (is_admin()) {
         require_once YITH_WCWL_INC . 'class.yith-wcwl-admin-init.php';
     }
     if (get_option('yith_wcwl_enabled') == 'yes') {
         require_once YITH_WCWL_INC . 'class.yith-wcwl-ui.php';
         require_once YITH_WCWL_INC . 'class.yith-wcwl-shortcode.php';
     }
     // Let's start the game!
     /**
      * @deprecated
      */
     global $yith_wcwl;
     $yith_wcwl = YITH_WCWL();
 }
Ejemplo n.º 4
0
							                <?php 
    $url = get_permalink(get_option('woocommerce_myaccount_page_id'));
    ?>
							                <li><a href="<?php 
    echo esc_url($url);
    ?>
"><i class="fa fa-user"></i> <?php 
    esc_html_e('My Account', 'edo');
    ?>
</a></li>
							            <?php 
}
?>
							            <?php 
if (edo_is_wc() && edo_is_wl() && is_user_logged_in()) {
    $wishlist_url = YITH_WCWL()->get_wishlist_url();
    ?>
							                <li><a href="<?php 
    echo esc_url($wishlist_url);
    ?>
"><i class="fa fa-heart-o"></i> <?php 
    esc_html_e('My Wishlist', 'edo');
    ?>
</a></li>
							            <?php 
}
?>
							            <?php 
if (edo_is_wc()) {
    ?>
							                <?php 
 function pbo_mtw_print_link_to_wishlist_page()
 {
     $tmpl_fn_base = 'link-to-wishlist-page.php';
     $tmpl_fn = locate_template('pbo-move-to-wishlist/' . $tmpl_fn_base);
     if (empty($tmpl_fn)) {
         $tmpl_fn = untrailingslashit(plugin_dir_path(__FILE__)) . '/templates/' . $tmpl_fn_base;
     }
     $wishlist_url = YITH_WCWL()->get_wishlist_url();
     $wishlist_url_label = esc_html(get_option('pbo_mtw_view_wishlist_label', __('View Wishlist', 'pbo-move-to-wishlist')));
     include_once $tmpl_fn;
 }
Ejemplo n.º 6
0
function thb_wishlist_button()
{
    global $product;
    if (class_exists('YITH_WCWL_UI')) {
        $url = YITH_WCWL()->get_wishlist_url();
        $product_type = $product->product_type;
        $exists = YITH_WCWL()->is_product_in_wishlist($product->id);
        $classes = get_option('yith_wcwl_use_button') == 'yes' ? 'class="add_to_wishlist single_add_to_wishlist"' : 'class="add_to_wishlist"';
        $html = '<div class="yith-wcwl-add-to-wishlist">';
        $html .= '<div class="yith-wcwl-add-button';
        // the class attribute is closed in the next row
        $html .= $exists ? ' hide" style="display:none;"' : ' show"';
        $html .= '><a href="' . htmlspecialchars(YITH_WCWL()->get_addtowishlist_url()) . '" data-product-id="' . $product->id . '" data-product-type="' . $product_type . '" ' . $classes . ' ><i class="fa fa-heart-o"></i><span class="text">' . __("Add to wishlist", THB_THEME_NAME) . '</span></a>';
        $html .= '</div>';
        $html .= '<div class="yith-wcwl-wishlistaddedbrowse hide" style="display:none;"> <a href="' . $url . '" class="add_to_wishlist"><i class="fa fa-heart"></i><span class="text">' . __("Added to wishlist", THB_THEME_NAME) . '</span></a></div>';
        $html .= '<div class="yith-wcwl-wishlistexistsbrowse ' . ($exists ? 'show' : 'hide') . '" style="display:' . ($exists ? 'block' : 'none') . '"><a href="' . $url . '" class="add_to_wishlist"><i class="fa fa-heart"></i><span class="text">' . __("Added to wishlist", THB_THEME_NAME) . '</span></a></div>';
        $html .= '</div>';
        return $html;
    }
}
Ejemplo n.º 7
0
    ?>
				<div class="offcanvas-user clearfix">
					<?php 
    $login_url = wp_login_url();
    $logout_url = wp_logout_url();
    $register_url = wp_registration_url();
    if (defined('WOOCOMMERCE_VERSION')) {
        $login_url = get_permalink(get_option('woocommerce_myaccount_page_id'));
        $logout_url = wp_logout_url(get_permalink(woocommerce_get_page_id('myaccount')));
    }
    ?>
					<?php 
    if (defined('YITH_WCWL') && defined('WOOCOMMERCE_VERSION')) {
        ?>
		            <a class="offcanvas-user-wishlist-link"  href="<?php 
        echo esc_url(YITH_WCWL()->get_wishlist_url());
        ?>
"><i class="fa fa-heart-o"></i> <?php 
        esc_html_e('My Wishlist', 'jakiro');
        ?>
</a>
		            <?php 
    }
    ?>
		            <a class="offcanvas-user-account-link" href="<?php 
    echo esc_url($login_url);
    ?>
"><i class="fa fa-user"></i> <?php 
    if (!is_user_logged_in()) {
        esc_html_e('Login', 'jakiro');
    } else {
Ejemplo n.º 8
0
 /**
  * Return "Add to Wishlist" button.
  *
  * @since 1.0.0
  */
 public static function add_to_wishlist($atts, $content = null)
 {
     global $product;
     if (!isset($product)) {
         $product = isset($atts['product_id']) ? wc_get_product($atts['product_id']) : false;
     }
     $template_part = 'button';
     $label_option = get_option('yith_wcwl_add_to_wishlist_text');
     $icon_option = get_option('yith_wcwl_add_to_wishlist_icon') != 'none' ? get_option('yith_wcwl_add_to_wishlist_icon') : '';
     $label = apply_filters('yith_wcwl_button_label', $label_option);
     $icon = apply_filters('yith_wcwl_button_icon', $icon_option);
     $browse_wishlist = get_option('yith_wcwl_browse_wishlist_text');
     $already_in_wishlist = get_option('yith_wcwl_already_in_wishlist_text');
     $product_added = get_option('yith_wcwl_product_added_text');
     $classes = apply_filters('yith_wcwl_add_to_wishlist_button_classes', get_option('yith_wcwl_use_button') == 'yes' ? 'add_to_wishlist single_add_to_wishlist button alt' : 'add_to_wishlist');
     $default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
     if (!empty($default_wishlists)) {
         $default_wishlist = $default_wishlists[0]['ID'];
     } else {
         $default_wishlist = false;
     }
     $exists = YITH_WCWL()->is_product_in_wishlist($product->id, $default_wishlist);
     $wishlist_url = YITH_WCWL()->get_wishlist_url();
     $product_type = $product->product_type;
     $additional_params = array('wishlist_url' => $wishlist_url, 'exists' => $exists, 'product_id' => $product->id, 'product_type' => $product_type, 'label' => $label, 'browse_wishlist_text' => $browse_wishlist, 'already_in_wishslist_text' => $already_in_wishlist, 'product_added_text' => $product_added, 'icon' => $icon, 'link_classes' => $classes, 'available_multi_wishlist' => false, 'disable_wishlist' => false);
     $additional_params = apply_filters('yith_wcwl_add_to_wishlist_params', $additional_params);
     $additional_params['template_part'] = isset($additional_params['template_part']) ? $additional_params['template_part'] : $template_part;
     $atts = shortcode_atts($additional_params, $atts);
     $atts['icon'] = !empty($atts['icon']) ? '<i class="fa ' . $atts['icon'] . '"></i>' : '';
     // adds attributes list to params to extract in template, so it can be passed through a new get_template()
     $atts['atts'] = $atts;
     $template = yith_wcwl_get_template('add-to-wishlist.php', $atts, true);
     return apply_filters('yith_wcwl_add_to_wishlisth_button_html', $template, $wishlist_url, $product_type, $exists);
 }
Ejemplo n.º 9
0
 function st_wishlist_button($extra_class = "")
 {
     global $product, $yith_wcwl;
     $button_type = ot_get_option('button_type');
     if (class_exists('YITH_WCWL_UI')) {
         $product_type = $product->product_type;
         $tooltip = __("Add to wishlist", "SimThemes");
         //Check Wishlist version
         if (version_compare(get_option('yith_wcwl_version'), "2.0") >= 0) {
             $url = YITH_WCWL()->get_wishlist_url('');
             $default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
             if (!empty($default_wishlists)) {
                 $default_wishlist = $default_wishlists[0]['ID'];
             } else {
                 $default_wishlist = false;
             }
             $exists = YITH_WCWL()->is_product_in_wishlist($product->id, $default_wishlist);
         } else {
             $url = $yith_wcwl->get_wishlist_url('');
             $exists = $yith_wcwl->is_product_in_wishlist($product->id);
         }
         if ($exists) {
             $tooltip = __("View wishlist", "SimThemes");
         }
         $classes = 'class="add_to_wishlist btn btn-primary btn-lg st_woo_button product_type_simple"';
         $html = '<div class="yith-wcwl-add-to-wishlist ' . $extra_class . '" data-toggle="tooltip" data-placement="top" title="' . $tooltip . '">';
         $html .= '<div class="yith-wcwl-add-button';
         // the class attribute is closed in the next row
         $html .= $exists ? ' hide" style="display:none;"' : ' show"';
         $html .= '><a href="' . htmlspecialchars($yith_wcwl->get_addtowishlist_url()) . '"  data-ajaxurl="' . admin_url('admin-ajax.php') . '" data-product-id="' . $product->id . '" data-product-type="' . $product_type . '" ' . $classes . ' >';
         $html .= apply_filters('st_add_to_wishlist_icon', '<i class="fa fa-heart"></i>');
         $html .= '</a></div>';
         $html .= '<div class="yith-wcwl-wishlistaddedbrowse hide" style="display:none;" ><a href="' . $url . '" class="btn btn-primary btn-lg st_woo_button product_type_simple ' . esc_attr($button_type) . '">';
         $html .= apply_filters('st_added_to_wishlist_icon', '<i class="fa fa-check"></i>');
         $html .= '</a></div>';
         $html .= '<div class="yith-wcwl-wishlistexistsbrowse ' . ($exists ? 'show' : 'hide') . '" style="display:' . ($exists ? 'block' : 'none') . '"><a href="' . $url . '" class="btn btn-primary btn-lg st_woo_button ' . esc_attr($button_type) . ' product_type_simple" >';
         $html .= apply_filters('st_added_to_wishlist_icon', '<i class="fa fa-check"></i>');
         $html .= '</a></div>';
         $html .= '<div style="clear:both"></div><div class="yith-wcwl-wishlistaddresponse"></div>';
         $html .= '</div>';
         return $html;
     }
 }
 /**
  * Retrieve the number of products in the wishlist.
  *
  * @param $wishlist_token string Optional wishlist token
  * 
  * @return int
  * @since 1.0.0
  */
 function yith_wcwl_count_products($wishlist_token = false)
 {
     return YITH_WCWL()->count_products($wishlist_token);
 }
Ejemplo n.º 11
0
function mango_compare_wishlist_links($text = true)
{
    //function to show wishlist and link in header
    global $mango_settings;
    if (function_exists('YITH_WCWL') && $mango_settings['show-wishlist-button']) {
        $wishlist_url = YITH_WCWL()->get_wishlist_url();
        $in = $text ? __("Wishlist", 'mango') : '(' . YITH_WCWL()->count_products() . ')';
        echo '<a href="' . $wishlist_url . '" class="header-link" title="' . __("wishlist", 'mango') . '"><i class="fa fa-heart-o"></i><span class="header-text">' . $in . '</span></a>';
    }
}
Ejemplo n.º 12
0
function shop_page_wishlist_button()
{
    global $product;
    global $yith_wcwl;
    $default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
    if (!empty($default_wishlists)) {
        $default_wishlist = $default_wishlists[0]['ID'];
    } else {
        $default_wishlist = false;
    }
    $output = '<a href="' . esc_url(add_query_arg("add_to_wishlist", $product->id)) . '" rel="nofollow" data-product-id="' . $product->id . '" data-product-type="' . $product->product_type . '" class="add_to_wishlist shop_wishlist_button ' . ($yith_wcwl->is_product_in_wishlist($product->id, $default_wishlist) == true ? "exist_in_wishlist " : "") . '"></a>';
    $output .= '<a href="' . esc_url($yith_wcwl->get_wishlist_url()) . '" rel="nofollow" class="wishlist-link shop_wishlist_button" style="' . ($yith_wcwl->is_product_in_wishlist($product->id, $default_wishlist) == true ? "display:block; " : "") . '"></a>';
    $output .= '<div class="blockUI blockOverlay ui-widget-overlay  ajax-loading" style="visibility:hidden;"></div>';
    echo $output;
}
Ejemplo n.º 13
0
    function edo_menu_my_account()
    {
        ob_start();
        ?>
        <ul class="top-bar-link top-bar-link-right dot">
            <?php 
        if (edo_is_wc() && is_user_logged_in()) {
            ?>
                <?php 
            $url = get_permalink(get_option('woocommerce_myaccount_page_id'));
            ?>
                <li><a href="<?php 
            echo esc_url($url);
            ?>
"><?php 
            esc_html_e('My Account', 'edo');
            ?>
</a></li>
            <?php 
        }
        ?>
            <?php 
        if (edo_is_wc() && edo_is_wl() && is_user_logged_in()) {
            $wishlist_url = YITH_WCWL()->get_wishlist_url();
            ?>
                <li><a href="<?php 
            echo esc_url($wishlist_url);
            ?>
"><?php 
            esc_html_e('My Wishlist', 'edo');
            ?>
</a></li>
            <?php 
        }
        ?>
            <?php 
        if (edo_is_wc()) {
            ?>
                <?php 
            $check_out_url = WC()->cart->get_cart_url();
            ?>
                <li><a href="<?php 
            echo esc_url($check_out_url);
            ?>
"><?php 
            esc_html_e('Checkout', 'edo');
            ?>
</a></li>
            <?php 
        }
        ?>
            <?php 
        if (is_user_logged_in()) {
            ?>
                <li><a href="<?php 
            echo wp_logout_url();
            ?>
"><?php 
            esc_html_e('Logout', 'edo');
            ?>
</a></li>
            <?php 
        } else {
            ?>
                <li><a href="<?php 
            echo get_permalink(get_option('woocommerce_myaccount_page_id'));
            ?>
"><?php 
            esc_html_e('Login', 'edo');
            ?>
</a></li>
            <?php 
        }
        ?>
            <?php 
        if (edo_is_wc() && edo_is_cp()) {
            global $yith_woocompare;
            $count = count($yith_woocompare->obj->products_list);
            ?>
                <li><a class="yith-woocompare-open" href="#"><?php 
            esc_html_e("Compare", 'edo');
            ?>
</a></li>
            <?php 
        }
        ?>
		</ul>
        <?php 
        $return = ob_get_contents();
        ob_clean();
        echo apply_filters('edo_menu_my_account', $return);
    }
Ejemplo n.º 14
0
 /**
  * Count number of times a product was added to users wishlists
  *
  * @return int Number of times the product was added to wishlists
  * @since 2.0.13
  */
 function yith_wcwl_count_add_to_wishlist($product_id = false)
 {
     return YITH_WCWL()->count_add_to_wishlist($product_id);
 }
Ejemplo n.º 15
0
function kt_myaccount_menu_link($items, $args)
{
    $kt_enable_myaccount_box = kt_option('kt_enable_myaccount_box', 'enable');
    if ($kt_enable_myaccount_box == 'disable') {
        return $items;
    }
    ob_start();
    if ($args->theme_location == 'topbar_menuright') {
        ?>
        <?php 
        if (kt_is_wc()) {
            ?>
            <?php 
            $myaccount_page_id = get_option('woocommerce_myaccount_page_id');
            $myaccount_link = get_permalink(get_option('woocommerce_myaccount_page_id'));
            ?>
            <?php 
            if (is_user_logged_in()) {
                ?>
                <?php 
                if ($myaccount_page_id) {
                    $logout_url = wp_logout_url(get_permalink(woocommerce_get_page_id('shop')));
                    if (get_option('woocommerce_force_ssl_checkout') == 'yes') {
                        $logout_url = str_replace('http:', 'https:', $logout_url);
                    }
                }
                ?>
                <li class="menu-item menu-item-has-children">
                    <a href="<?php 
                echo esc_url($myaccount_link);
                ?>
"><?php 
                _e('My Account', 'kutetheme');
                ?>
</a>
                    <ul class="sub-menu">
                        <?php 
                if (function_exists('YITH_WCWL')) {
                    $wishlist_url = YITH_WCWL()->get_wishlist_url();
                    ?>
                        <li><a href="<?php 
                    echo esc_attr($wishlist_url);
                    ?>
"><?php 
                    _e('Wishlists', 'kutetheme');
                    ?>
</a></li>
                        <?php 
                }
                ?>
                        <?php 
                if (defined('YITH_WOOCOMPARE')) {
                    global $yith_woocompare;
                    $count = count($yith_woocompare->obj->products_list);
                    ?>
                        <li><a href="#" class="yith-woocompare-open"><?php 
                    esc_html_e("Compare", 'kutetheme');
                    ?>
<span>(<?php 
                    echo esc_attr($count);
                    ?>
)</span></a></li>
                        <?php 
                }
                ?>
                        <?php 
                if (isset($logout_url) && $logout_url) {
                    ?>
                        <li><a href="<?php 
                    echo esc_url($logout_url);
                    ?>
"><?php 
                    _e('Logout', 'kutetheme');
                    ?>
</a></li>
                        <?php 
                }
                ?>
                    </ul>
                </li>
            <?php 
            } else {
                ?>
                <li class="menu-item login-item"><a href="<?php 
                echo esc_url($myaccount_link);
                ?>
"><?php 
                _e('Login/Register', 'kutetheme');
                ?>
</a></li>
            <?php 
            }
            ?>
        <?php 
        }
        ?>
   <?php 
    }
    $item = ob_get_contents();
    $items = $item . $items;
    ob_clean();
    return $items;
}
Ejemplo n.º 16
0
 * @version 2.0.12
 */
if (!defined('YITH_WCWL')) {
    exit;
}
// Exit if accessed directly
?>



<?php 
do_action('yith_wcwl_before_wishlist_form', $wishlist_meta);
?>

<form id="yith-wcwl-form" action="<?php 
echo esc_url(YITH_WCWL()->get_wishlist_url('view' . ($wishlist_meta['is_default'] != 1 ? '/' . $wishlist_meta['wishlist_token'] : '')));
?>
" method="post" class="woocommerce">

    <?php 
wp_nonce_field('yith-wcwl-form', 'yith_wcwl_form_nonce');
?>

    <!-- TITLE -->
    <?php 
do_action('yith_wcwl_before_wishlist_title');
if (!empty($page_title)) {
    ?>
        <div class="wishlist-title <?php 
    echo $wishlist_meta['is_default'] != 1 && $is_user_owner ? 'wishlist-title-with-form' : '';
    ?>
Ejemplo n.º 17
0
 function get_wishlist_url()
 {
     if (function_exists('YITH_WCWL')) {
         $wishlist_url = YITH_WCWL()->get_wishlist_url();
         return esc_url($wishlist_url);
     }
 }
 /**
  * Add Frequently Bought Together shortcode to wishlist page
  *
  * @param mixed $meta
  * @author Francesco Licandro
  */
 public function yith_wcfbt_shortcode($meta)
 {
     if (!(defined('YITH_WFBT') && YITH_WFBT) || get_option('yith_wfbt_enable_integration') == 'no') {
         return;
     }
     $products = YITH_WCWL()->get_products(array('wishlist_id' => is_user_logged_in() ? $meta['ID'] : ''));
     $ids = array();
     // take id of products in wishlist
     foreach ($products as $product) {
         $ids[] = $product['prod_id'];
     }
     if (empty($ids)) {
         return;
     }
     do_shortcode('[yith_wfbt products="' . implode(',', $ids) . '"]');
 }
Ejemplo n.º 19
0
                                        data-imgout='<?php 
echo get_template_directory_uri();
?>
/img/icone/geral/ico-Search2x.png'
                                        >
                                </a>

                                <?php 
linkInOut();
?>
                                <?php 
linkMyCart();
?>
                                <a 
                                    href="<?php 
echo YITH_WCWL()->get_wishlist_url();
?>
" 
                                    class="pull-right "
                                    > 
                                    <img 
                                        class="icone-menu" 
                                        src="<?php 
echo get_template_directory_uri();
?>
/img/icone/geral/ico-Favoritar2x.png"
                                        data-imgin='<?php 
echo get_template_directory_uri();
?>
/img/icone/geral/ico-Favoritar2xhover.png'
                                        data-imgout='<?php 
Ejemplo n.º 20
0
 /**
  * Initiator method.
  *
  * @return void
  * @since 1.0.0
  */
 public function init()
 {
     if (is_user_logged_in()) {
         YITH_WCWL()->details['user_id'] = get_current_user_id();
         //check whether any products are added to wishlist, then after login add to the wishlist if not added
         $cookie = yith_getcookie('yith_wcwl_products');
         foreach ($cookie as $details) {
             YITH_WCWL()->details['add_to_wishlist'] = $details['prod_id'];
             YITH_WCWL()->details['wishlist_id'] = $details['wishlist_id'];
             YITH_WCWL()->details['quantity'] = $details['quantity'];
             YITH_WCWL()->details['user_id'] = get_current_user_id();
             $ret_val = YITH_WCWL()->add();
         }
         yith_destroycookie('yith_wcwl_products');
     }
     // update cookie from old version to new one
     $this->_update_cookies();
 }
Ejemplo n.º 21
0
    /**
     * Frontend: Add YITH Wishlist Icon
     */
    public function add_yith_wishlist_icon()
    {
        if (in_array('yith-woocommerce-wishlist/init.php', $this->active_plugins)) {
            global $product;
            $default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
            if (!empty($default_wishlists)) {
                $default_wishlist = $default_wishlists[0]['ID'];
            } else {
                $default_wishlist = false;
            }
            $added = YITH_WCWL()->is_product_in_wishlist($product->id, $default_wishlist);
            $wishlist_url = YITH_WCWL()->get_wishlist_url();
            ?>

            <div class="jck-wt-wishlist-buttons <?php 
            if ($added) {
                echo "jck-wt-wishlist-buttons--added";
            }
            ?>
">

                <a class="jck-wt-wishlist-buttons__browse" href="<?php 
            echo $wishlist_url;
            ?>
" data-jck-wt-tooltip="<?php 
            _e('Browse Wishlist', 'jck-wt');
            ?>
"><i class="jck-wt-icon jck-wt-icon-heart"></i></a>

                <a href="<?php 
            echo esc_url(add_query_arg('add_to_wishlist', $product->id));
            ?>
" rel="nofollow" data-product-id="<?php 
            echo $product->id;
            ?>
" data-product-type="<?php 
            echo $product->product_type;
            ?>
" class="jck-wt-wishlist-buttons__add add_to_wishlist" data-jck-wt-tooltip="<?php 
            _e('Add to Wishlist', 'jck-wt');
            ?>
"><i class="jck-wt-icon jck-wt-icon-heart"></i></a>

            </div>

            <?php 
        }
    }
Ejemplo n.º 22
0
 function sf_wishlist_button($extra_class = "")
 {
     global $product, $yith_wcwl;
     if (class_exists('YITH_WCWL_UI')) {
         $product_type = $product->product_type;
         $tooltip = __("Add to wishlist", "swiftframework");
         //Check Wishlist version
         if (version_compare(get_option('yith_wcwl_version'), "2.0") >= 0) {
             $url = YITH_WCWL()->get_wishlist_url();
             $default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
             if (!empty($default_wishlists)) {
                 $default_wishlist = $default_wishlists[0]['ID'];
             } else {
                 $default_wishlist = false;
             }
             $exists = YITH_WCWL()->is_product_in_wishlist($product->id, $default_wishlist);
         } else {
             $url = $yith_wcwl->get_wishlist_url();
             $exists = $yith_wcwl->is_product_in_wishlist($product->id);
         }
         if ($exists) {
             $tooltip = __("View wishlist", "swiftframework");
         }
         $classes = get_option('yith_wcwl_use_button') == 'yes' ? 'class="add_to_wishlist single_add_to_wishlist button alt"' : 'class="add_to_wishlist"';
         $html = '<div class="yith-wcwl-add-to-wishlist ' . $extra_class . '" data-toggle="tooltip" data-placement="top" title="' . $tooltip . '">';
         $html .= '<div class="yith-wcwl-add-button';
         // the class attribute is closed in the next row
         $html .= $exists ? ' hide" style="display:none;"' : ' show"';
         $html .= '><a href="' . htmlspecialchars($yith_wcwl->get_addtowishlist_url()) . '"  data-ajaxurl="' . admin_url('admin-ajax.php') . '" data-product-id="' . $product->id . '" data-product-type="' . $product_type . '" ' . $classes . ' >';
         $html .= apply_filters('sf_add_to_wishlist_icon', '<i class="ss-star"></i>');
         $html .= '</a></div>';
         $html .= '<div class="yith-wcwl-wishlistaddedbrowse hide" style="display:none;"><span class="feedback">' . __('Product added to wishlist.', 'swiftframework') . '</span> <a href="' . $url . '">';
         $html .= apply_filters('sf_added_to_wishlist_icon', '<i class="fa-check"></i>');
         $html .= '</a></div>';
         $html .= '<div class="yith-wcwl-wishlistexistsbrowse ' . ($exists ? 'show' : 'hide') . '" style="display:' . ($exists ? 'block' : 'none') . '"><a href="' . $url . '">';
         $html .= apply_filters('sf_added_to_wishlist_icon', '<i class="fa-check"></i>');
         $html .= '</a></div>';
         $html .= '<div style="clear:both"></div><div class="yith-wcwl-wishlistaddresponse"></div>';
         $html .= '</div>';
         return $html;
     }
 }
Ejemplo n.º 23
0
 function ts_add_wishlist_button_to_product_list()
 {
     global $product, $yith_wcwl;
     $default_wishlists = is_user_logged_in() ? YITH_WCWL()->get_wishlists(array('is_default' => true)) : false;
     if (!empty($default_wishlists)) {
         $default_wishlist = $default_wishlists[0]['ID'];
     } else {
         $default_wishlist = false;
     }
     $exists = YITH_WCWL()->is_product_in_wishlist($product->id, $default_wishlist);
     $wishlist_url = YITH_WCWL()->get_wishlist_url();
     $added_class = $exists ? 'added' : '';
     echo '<div class="button-in wishlist add-to-wishlist-' . $product->id . ' ' . $added_class . '">';
     echo '<a href="' . esc_url(add_query_arg('add_to_wishlist', $product->id)) . '" data-product-id="' . $product->id . '" data-product-type="' . $product->product_type . '" class="add_to_wishlist wishlist" ><i class="fa fa-heart"></i><span class="ts-tooltip button-tooltip">' . esc_html__('Wishlist', 'gon') . '</span></a>';
     echo '<img src="' . get_template_directory_uri() . '/images/ajax-loader.gif' . '" class="ajax-loading" alt="loading" width="16" height="16" style="visibility:hidden" />';
     echo '<span class="yith-wcwl-wishlistaddedbrowse hide" style="display: none">';
     echo '<a href="' . esc_url($wishlist_url) . '"><i class="fa fa-heart-o"></i><span class="ts-tooltip button-tooltip">' . esc_html__('Wishlist', 'gon') . '</span></a>';
     echo '</span>';
     echo '<span class="yith-wcwl-wishlistexistsbrowse ' . ($exists ? 'show' : 'hide') . '" style="' . ($exists ? '' : 'display: none') . '">';
     echo '<a href="' . esc_url($wishlist_url) . '"><i class="fa fa-heart-o"></i><span class="ts-tooltip button-tooltip">' . esc_html__('Wishlist', 'gon') . '</span></a>';
     echo '</span>';
     echo '</div>';
 }