function widget($args, $instance) { global $post; extract($args); global $woocommerce; global $yith_wcwl; // Our variables from the widget settings $type = isset($instance['type']) ? esc_attr($instance['type']) : ''; // Before widget (defined by theme functions file) echo $before_widget; ?> <?php if (class_exists('YITH_WCWL')) { ?> <a href="<?php echo esc_url($yith_wcwl->get_wishlist_url()); ?> " class="tools_button <?php if ($type == 'light') { ?> light <?php } ?> "> <span class="wishlist_items_number"><?php echo yith_wcwl_count_products(); ?> </span> </a> <?php } ?> <?php // After widget (defined by theme functions file) echo $after_widget; }
if (isset($_POST['gform_form_id'])) { unset($_POST['gform_form_id']); } // Handles all ajax requests pertaining to this plugin require_once 'safe-wp-load.php'; require_once 'functions.yith-wcwl.php'; header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past if (!isset($yith_wcwl)) { $yith_wcwl = new YITH_WCWL($_REQUEST); } // Remove product from the wishlist if ($_GET['action'] == 'remove_from_wishlist') { $count = yith_wcwl_count_products(); if ($yith_wcwl->remove($_GET['wishlist_item_id'])) { _e('Product successfully removed.', 'yit'); } else { echo '#' . $count . '#'; _e('Error. Unable to remove the product from the wishlist.', 'yit'); } if (!$count) { _e('No products were added to the wishlist', 'yit'); } wp_redirect($yith_wcwl->get_wishlist_url()); die; } elseif ($_GET['action'] == 'add_to_wishlist') { $return = $yith_wcwl->add(); if ($return == 'true') { echo $return . '##' . __('Product added!', 'yit');
if (isset($shopkeeper_theme_options['main_header_wishlist_icon']['url']) && $shopkeeper_theme_options['main_header_wishlist_icon']['url'] != "") { ?> <img src="<?php echo esc_url($shopkeeper_theme_options['main_header_wishlist_icon']['url']); ?> "> <?php } else { ?> <i class="fa fa-heart-o"></i> <?php } ?> </span> <span class="wishlist_items_number"><?php echo yith_wcwl_count_products(); ?> </span> </a> </li> <?php } ?> <?php } ?> <?php if (class_exists('WooCommerce')) { ?> <?php
/** * AJAX: remove from wishlist action * * @return void * @since 1.0.0 */ public function remove_from_wishlist_ajax() { $wishlist_token = isset($this->details['wishlist_token']) ? $this->details['wishlist_token'] : false; $count = yith_wcwl_count_products($wishlist_token); $message = ''; if ($count != 0) { if ($this->remove()) { $message = apply_filters('yith_wcwl_product_removed_text', __('Product successfully removed.', 'yit')); $count--; } else { $message = apply_filters('yith_wcwl_unable_to_remove_product_message', __('Error. Unable to remove the product from the wishlist.', 'yit')); } } else { $message = apply_filters('yith_wcwl_no_product_to_remove_message', __('No products were added to the wishlist', 'yit')); } wc_add_notice($message); $atts = array('wishlist_id' => $wishlist_token); if (isset($this->details['pagination'])) { $atts['pagination'] = $this->details['pagination']; } if (isset($this->details['per_page'])) { $atts['per_page'] = $this->details['per_page']; } echo YITH_WCWL_Shortcode::wishlist($atts); die; }
<!-- Right Block --> <div class="right_block"> <!-- Menu --> <ul class="right_menu"> <li><a href="<?php echo site_url(); ?> /my-account/">Account</a></li> <li><a href="<?php echo site_url(); ?> /auction/">Auction</a></li> <?php if (is_user_logged_in()) { $wishlist_product_count = yith_wcwl_count_products(); ?> <li><a href="<?php echo site_url(); ?> /wishlist/">Wishlist <?php if ($wishlist_product_count > 0) { echo '(' . $wishlist_product_count . ')'; } ?> </a></li> <li><a href="<?php echo site_url(); ?> /my-account/customer-logout/">Logout</a></li>
function refresh_wishlist_items_number() { global $yith_wcwl; echo yith_wcwl_count_products(); die; }
function refresh_dynamic_contents() { global $woocommerce, $yith_wcwl; $data = array('cart_count_products' => $woocommerce->cart->cart_contents_count, 'wishlist_count_products' => yith_wcwl_count_products(), 'wishlist_shortcode_content' => do_shortcode('[yith_wcwl_wishlist]')); wp_send_json($data); }
<?php if (is_woocommerce_activated()) { echo accesspress_wcmenucart(); } ?> <?php if (function_exists('YITH_WCWL')) { $wishlist_url = YITH_WCWL()->get_wishlist_url(); ?> <a class="quick-wishlist" href="<?php echo $wishlist_url; ?> " title="Wishlist"> <i class="fa fa-heart"></i> <?php echo "(" . yith_wcwl_count_products() . ")"; ?> </a> <?php } ?> <div class="login-woocommerce"> <?php if (is_user_logged_in()) { global $current_user; get_currentuserinfo(); ?> <a href="<?php echo wp_logout_url(home_url()); ?>
/** * AJAX: remove from wishlist action * * @return void * @since 1.0.0 */ public function remove_from_wishlist_ajax() { $count = yith_wcwl_count_products(); if ($this->remove($_GET['wishlist_item_id'])) { echo apply_filters('yith_wcwl_product_removed_text', __('Product successfully removed.', 'yit')); } else { echo '#' . $count . '#'; _e('Error. Unable to remove the product from the wishlist.', 'yit'); } if (!$count) { _e('No products were added to the wishlist', 'yit'); } die; }
function refresh_dynamic_contents() { global $woocommerce, $yith_wcwl; $data = array('cart_count_products' => class_exists('WooCommerce') ? WC()->cart->get_cart_contents_count() : 0, 'wishlist_count_products' => class_exists('YITH_WCWL') ? yith_wcwl_count_products() : 0); wp_send_json($data); }
function get_wishlist_quantity() { global $yith_wcwl; $nonce = $_REQUEST['ajax_nonce']; // check to see if the submitted nonce matches with the // generated nonce we created earlier if (!wp_verify_nonce($nonce, 'ajax-nonce')) { die('Failed!'); } $data = array('wishlist_count_products' => yith_wcwl_count_products()); wp_send_json($data); }
/** Tini wishlist **/ function ts_tini_wishlist() { if (!(ts_has_woocommerce() && class_exists('YITH_WCWL'))) { return; } ob_start(); $wishlist_page_id = get_option('yith_wcwl_wishlist_page_id'); if (function_exists('icl_object_id')) { $wishlist_page_id = icl_object_id($wishlist_page_id, 'page', true); } $wishlist_page = get_permalink($wishlist_page_id); $count = yith_wcwl_count_products(); ?> <a title="<?php esc_html_e('Wishlist', 'gon'); ?> " href="<?php echo esc_url($wishlist_page); ?> " class="tini-wishlist"> <?php esc_html_e('Wishlist', 'gon'); ?> <?php echo '(' . ($count > 0 ? zeroise($count, 2) : '0') . ')'; ?> </a> <?php $tini_wishlist = ob_get_clean(); return $tini_wishlist; }