/** * Show dropdown account content * * @since 1.0.0 * @return void */ public function dropdown_frontend() { $this->prepare_options(); if ('true' !== $this->account_options['shop-show-acc']) { return; } ?> <div class="cherry-wc-account" data-dropdown="box" data-dropdown-active="false"> <?php cherry_wc_templater()->get_template_part('account-dropdown'); ?> </div> <?php Cherry_WC_Assets::enqueue_local_js(array('cherry-woocommerce')); }
/** * Print custom compare link * * @since 1.0.0 * @return void|null */ public function custom_compare_link() { global $product; $product_id = isset($product->id) ? $product->id : 0; // return if product doesn't exist if (empty($product_id) || apply_filters('yith_woocompare_remove_compare_link_by_cat', false, $product_id)) { return null; } $is_button = get_option('yith_woocompare_is_button', 'button'); if (!isset($button_text) || 'default' == $button_text) { $button_text = get_option('yith_woocompare_button_text', __('Compare', 'cherry-woocommerce-package')); $button_text = function_exists('icl_translate') ? icl_translate('Plugins', 'plugin_yit_compare_button_text', $button_text) : $button_text; } $action_add = 'yith-woocompare-add-product'; $url_args = array('action' => $action_add, 'id' => $product_id); $url = apply_filters('yith_woocompare_add_product_url', wp_nonce_url(esc_url_raw(add_query_arg($url_args)), $action_add)); global $wp_query; $wp_query->query_vars['cherry_wc_compare_button'] = array('url' => $url, 'is_button' => $is_button, 'product_id' => $product_id, 'button_text' => $button_text); cherry_wc_templater()->get_template_part('compare-button'); unset($wp_query->query_vars['cherry_wc_compare_button']); }
<?php cherry_wc_templater()->get_template_part('single-product/sale-flash', true); ?> <?php cherry_wc_templater()->get_template_part('quick-view/image'); ?> </div> <div class="cherry-quick-view-data summary"> <?php cherry_wc_templater()->get_template_part('single-product/title', true); ?> <?php cherry_wc_templater()->get_template_part('quick-view/rating'); ?> <?php cherry_wc_templater()->get_template_part('single-product/price', true); ?> <?php cherry_wc_templater()->get_template_part('single-product/short-description', true); ?> <div class="cherry-quick-view-add-to-cart"> <?php cherry_wc_templater()->get_template_part('loop/add-to-cart', true); ?> <?php cherry_wc_templater()->get_template_part('quick-view/read-more'); ?> </div> </div> </div>
/** * Process AJAX request and return quick view popup content * * @since 1.0.0 */ public function ajax_callback() { $nonce = isset($_REQUEST['_wpnonce']) ? esc_attr($_REQUEST['_wpnonce']) : false; if (!wp_verify_nonce($nonce, 'cherry_woocommerce')) { die('Nonce not verifyed'); } $product_id = isset($_REQUEST['product']) ? $_REQUEST['product'] : false; if (!$product_id) { die('Product not found'); } if (!class_exists('WC_Product_Factory')) { die('Product not found'); } global $product, $woocommerce, $post; $product_factory = new WC_Product_Factory(); $post = get_post($product_id); $product = $product_factory->get_product($product_id); setup_postdata($post); cherry_wc_templater()->get_template_part('quick-view'); wp_reset_postdata(); die; }
<?php /** * Cart dropdown template * * @author Cherry Team * @category Core * @package cherry-woocommerce-package/templates * @version 1.0.0 */ if (!defined('ABSPATH')) { exit; // Exit if accessed directly } $cart_dropdown = Cherry_WC_Cart_Dropdown::get_instance(); ?> <div class="cart-content"> <a class="cherry-wc-cart_link" href="#" data-dropdown="trigger"><?php // print cart title printf(apply_filters('cherry_woocommerce_cart_title_format', '<span>%s</span>'), $cart_dropdown->cart_options['shop-cart-title']); // print cart count printf(apply_filters('cherry_woocommerce_cart_count_format', '<span class="cherry-wc-cart_count">%s</span>'), WC()->cart->cart_contents_count); ?> </a> <div class="cherry-wc-cart_content" data-dropdown="content"> <?php cherry_wc_templater()->get_template_part('cart/cart-content'); ?> </div> </div>
/** * Add product images gallery * * @since 1.0.0 * @return void */ public function add_gallery() { Cherry_WC_Assets::enqueue_local_js(array('cherry-woocommerce', 'cherry-cycle2', 'cherry-cycle2-carousel', 'cherry-elevatezoom')); cherry_wc_templater()->get_template_part('product-gallery/image'); }
return; } require_once cherry_wc_package()->plugin_dir('init/statics/' . $static_file); } /** * Returns the instance. * * @since 1.0.0 * @return object */ public static function get_instance() { // If the single instance hasn't been set, set it now. if (null == self::$instance) { self::$instance = new self(); } return self::$instance; } } /** * Get instance of templater class * * @since 1.0.0 * @return jbject */ function cherry_wc_templater() { return Cherry_WC_Templater::get_instance(); } cherry_wc_templater(); }
/** * Categories shortcode callback function * * @since 1.0.0 * @param array $atts shortcode attributes array. * @param string $content shortcode inner content. * @return string */ public function categories($atts, $content = null) { $atts = shortcode_atts(array('only_top' => 'yes', 'number' => -1, 'orderby' => 'name', 'order' => 'asc', 'columns' => 3, 'hide_empty' => 'yes', 'parent' => '', 'ids' => '', 'template' => 'default.tmpl'), $atts, 'shop_categories'); if (!empty($atts['ids'])) { $ids = explode(',', $atts['ids']); $ids = array_map('trim', $ids); } else { $ids = array(); } $hide_empty = 'yes' === $atts['hide_empty'] ? 1 : 0; $parent = !empty($atts['parent']) ? absint($atts['parent']) : ''; if (-1 !== $atts['number']) { $number = absint($atts['number']); } else { $number = -1; } $args = array('orderby' => esc_attr($atts['orderby']), 'order' => esc_attr($atts['order']), 'hide_empty' => $hide_empty, 'include' => $ids, 'pad_counts' => true, 'child_of' => $parent); if ('yes' === $atts['only_top']) { $args['parent'] = 0; } $product_categories = get_terms('product_cat', $args); if (0 <= $number) { $product_categories = array_slice($product_categories, 0, $number); } ob_start(); $macros = '/%%([a-zA-Z_]+[^%]{2})(=[\'\\"]([a-zA-Z0-9-_\\.\\s]+)[\'\\"])?%%/'; $callbacks = $this->setup_template_data($atts); $template = cherry_wc_templater()->get_tmpl_content(esc_attr($atts['template']), 'shop_categories'); $classes = array('cat-list', 'col-' . absint($atts['columns'])); $class = implode(' ', $classes); /** * Fires before start main categories shortcode output */ do_action('cherry_wc_before_categories_list'); echo '<div class="' . esc_attr($class) . '">'; foreach ($product_categories as $cat) { $callbacks->set_object($cat); $content = preg_replace_callback($macros, array($this, 'replace_callback'), $template); $callbacks->clear_object(); echo $content; } echo '</div>'; /** * Fires immediately after main categories shortcode output ended */ do_action('cherry_wc_after_categories_list'); return ob_get_clean(); }
/** * AJAX callback for add to cart action * * @since 1.0.0 * @param array $fragments array of DOM fragments to replace. * @return array */ function add_to_cart_fragment($fragments) { $this->prepare_options(); ob_start(); cherry_wc_templater()->get_template_part('cart-dropdown'); $fragments['div.cart-content'] = ob_get_clean(); return $fragments; }