bizz_ecommerce_quick_view_content_actions(); add_action( 'wp', array( $this, 'bizz_ecommerce_single_product_customization' ) ); // Alter cross-sells display remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' ); if ( '0' != get_theme_mod( 'bizz_ecommerce_cross_num_col_shw', '2' ) ) { add_action( 'woocommerce_cart_collaterals', array( $this, 'bizz_ecommerce_cross_sell_display' ) ); } } /** * Assign shop sidebar for store page. * * @param String $sidebar Sidebar. * * @return String $sidebar Sidebar. */ function bizz_ecommerce_replace_store_sidebar( $sidebar ){ if ( is_shop() || is_product_taxonomy() || is_checkout() || is_cart() || is_account_page() ){ $sidebar = 'open-woo-shop-sidebar'; }elseif ( is_product() ){ $sidebar = 'open-woo-product-sidebar'; } return $sidebar; } /** * Setup theme * * @since 1.0.3 */ function bizz_ecommerce_setup_theme(){ // WooCommerce. add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); } /** * Product Flip Image */ function bizz_ecommerce_product_flip_image(){ global $product; $hover_style = get_theme_mod( 'bizz_ecommerce_woo_product_animation' ); if ( 'swap' === $hover_style ) { $attachment_ids = $product->get_gallery_image_ids(); if ( $attachment_ids ) { $image_size = apply_filters( 'single_product_archive_thumbnail_size', 'shop_catalog' ); echo apply_filters( 'open_woocommerce_bizz_ecommerce_product_flip_image', wp_get_attachment_image( reset( $attachment_ids ), $image_size, false, array( 'class' => 'show-on-hover' ) ) ); } } if ('slide' === $hover_style ) { $attachment_ids = $product->get_gallery_image_ids(); if ( $attachment_ids ) { $image_size = apply_filters( 'single_product_archive_thumbnail_size', 'shop_catalog' ); echo apply_filters( 'top_store_woocommerce_product_flip_image', wp_get_attachment_image( reset( $attachment_ids ), $image_size, false, array( 'class' => 'show-on-slide' ) ) ); } } } /** * Post Class * * @param array $classes Default argument array. * * @return array; */ function bizz_ecommerce_post_class( $classes ){ if (!bizz_ecommerce_is_blog()|| is_shop() || is_product_taxonomy() || post_type_exists( 'product' )){ $classes[] = 'texture-woo-product-list'; $qv_enable = get_theme_mod( 'bizz_ecommerce_woo_quickview_enable',true); if ( true == $qv_enable ){ $classes[] = 'opn-qv-enable'; } } if (is_shop() || is_product_taxonomy() || post_type_exists( 'product' )){ $hover_style = get_theme_mod( 'bizz_ecommerce_woo_product_animation' ); if ( '' !== $hover_style ) { $classes[] = 'bizz-ecommerce-woo-hover-' . esc_attr($hover_style); } } if (is_shop() || is_product_taxonomy() || post_type_exists( 'product' )){ $single_product_tab_style = get_theme_mod( 'bizz_ecommerce_single_product_tab_layout','horizontal' ); if ( '' !== $single_product_tab_style ){ $classes[] = 'open-single-product-tab-'.esc_attr($single_product_tab_style); } } if (is_shop() || is_product_taxonomy() || post_type_exists( 'product' )){ $shadow_style = get_theme_mod( 'bizz_ecommerce_product_box_shadow' ); if ( '' !== $shadow_style ){ $classes[] = 'open-shadow-' . esc_attr($shadow_style); } } if (is_shop() || is_product_taxonomy() || post_type_exists( 'product' )){ $shadow_hvr_style = get_theme_mod( 'bizz_ecommerce_product_box_shadow_on_hover' ); if ( '' !== $shadow_hvr_style ){ $classes[] = 'open-shadow-hover-' . esc_attr($shadow_hvr_style); } } if ( 'swap' === $hover_style && !is_page_template('frontpage.php') && (!is_admin()) && !bizz_ecommerce_is_blog()){ global $product; $attachment_ids = $product->get_gallery_image_ids(); if(count($attachment_ids) > '0'){ $classes[] ='bizz-ecommerce-swap-item-hover'; } } if ( 'slide' === $hover_style && !is_page_template('frontpage.php') && (!is_admin()) && !bizz_ecommerce_is_blog()){ global $product; $attachment_ids = $product->get_gallery_image_ids(); if(count($attachment_ids) > '0'){ $classes[] ='bizz-ecommerce-slide-item-hover'; } } return $classes; } /** * Infinite Products Show on scroll * * @since 1.1.0 * @param array $localize JS localize variables. * @return array */ function bizz_ecommerce_js_localize( $localize ){ global $wp_query; $bizz_ecommerce_pagination = get_theme_mod( 'bizz_ecommerce_pagination' ); $localize['ajax_url'] = admin_url( 'admin-ajax.php' ); $localize['is_cart'] = is_cart(); $localize['is_single_product'] = is_product(); $localize['query_vars'] = json_encode( $wp_query->query ); $localize['shop_quick_view_enable'] = get_theme_mod('bizz_ecommerce_woo_quickview_enable','true' ); $localize['shop_infinite_nonce'] = wp_create_nonce( 'opn-shop-load-more-nonce' ); $localize['shop_infinite_count'] = 2; $localize['shop_infinite_total'] = $wp_query->max_num_pages; $localize['shop_pagination'] = $bizz_ecommerce_pagination; $localize['shop_infinite_scroll_event'] = $bizz_ecommerce_pagination; $localize['query_vars'] = json_encode( $wp_query->query ); $localize['shop_no_more_post_message'] = apply_filters( 'bizz_ecommerce_no_more_product_text', __( 'No more products to show.', 'bizz-ecommerce' ) ); return $localize; } /** * Common Actions. * * @since 1.1.0 * @return void */ function bizz_ecommerce_common_actions(){ // Shop Pagination. $this->shop_pagination(); // Quick View. $this->bizz_ecommerce_shop_init_quick_view(); } /** * Init Quick View */ function bizz_ecommerce_shop_init_quick_view(){ $qv_enable = get_theme_mod( 'bizz_ecommerce_woo_quickview_enable','true' ); if ( true == $qv_enable ){ add_filter( 'open_theme_js_localize', array( $this, 'bizz_ecommerce_bizz_ecommerce_qv_js_localize' ) ); add_action( 'quickview', array( $this,'bizz_ecommerce_add_quick_view_on_img' ),15); // load modal template. add_action( 'wp_footer', array( $this, 'bizz_ecommerce_quick_view_html' ) ); } } /** * Add Scripts */ function bizz_ecommerce_add_scripts(){ wp_enqueue_script( 'bizz-ecommerce-woocommerce-js', BIZZ_ECOMMERCE_THEME_URI .'/inc/woocommerce/js/woocommerce.js', array( 'jquery' ), '1.0.0', true ); $localize = array( 'ajaxUrl' => admin_url( 'admin-ajax.php' ), //cat-tab-filter 'bizz_ecommerce_single_row_slide_cat' => get_theme_mod('bizz_ecommerce_single_row_slide_cat',false), 'bizz_ecommerce_cat_slider_optn' => get_theme_mod('bizz_ecommerce_cat_slider_optn',false), //product-slider 'bizz_ecommerce_single_row_prdct_slide' => get_theme_mod('bizz_ecommerce_single_row_prdct_slide',false), 'bizz_ecommerce_product_slider_optn' => get_theme_mod('bizz_ecommerce_product_slider_optn',false), //cat-slider 'bizz_ecommerce_category_slider_optn' => get_theme_mod('bizz_ecommerce_category_slider_optn',false), //product-list 'bizz_ecommerce_single_row_prdct_list' => get_theme_mod('bizz_ecommerce_single_row_prdct_list',false), 'bizz_ecommerce_product_list_slide_optn' => get_theme_mod('bizz_ecommerce_product_list_slide_optn',false), //cat-tab-list-filter 'bizz_ecommerce_single_row_slide_cat_tb_lst' => get_theme_mod('bizz_ecommerce_single_row_slide_cat_tb_lst',false), 'bizz_ecommerce_cat_tb_lst_slider_optn' => get_theme_mod('bizz_ecommerce_cat_tb_lst_slider_optn',false), //product tab image 'bizz_ecommerce_product_img_sec_single_row_slide' => get_theme_mod('bizz_ecommerce_product_img_sec_single_row_slide',true), 'bizz_ecommerce_product_img_sec_slider_optn' => get_theme_mod('bizz_ecommerce_product_img_sec_slider_optn',false), 'bizz_ecommerce_product_img_sec_adimg' => get_theme_mod('bizz_ecommerce_product_img_sec_adimg',''), //brand 'bizz_ecommerce_brand_slider_optn' => get_theme_mod('bizz_ecommerce_brand_slider_optn',false), //big-feature-product 'bizz_ecommerce_feature_product_slider_optn' => get_theme_mod('bizz_ecommerce_feature_product_slider_optn',false), //category slider coloum 'bizz_ecommerce_cat_item_no' => get_theme_mod('bizz_ecommerce_cat_item_no','10'), 'bizz_ecommerce_rtl' => (bool)get_theme_mod('bizz_ecommerce_rtl'), ); wp_localize_script( 'bizz-ecommerce-woocommerce-js', 'bizzecommerce', $localize ); wp_enqueue_script('open-quick-view', BIZZ_ECOMMERCE_THEME_URI.'inc/woocommerce/quick-view/js/quick-view.js', array( 'jquery' ), '', true ); wp_localize_script('open-quick-view', 'bizzecommerceqv', array('ajaxurl' => admin_url( 'admin-ajax.php' ))); } /** * Add Style */ function bizz_ecommerce_add_style(){ wp_enqueue_style( 'open-quick-view', BIZZ_ECOMMERCE_THEME_URI. 'inc/woocommerce/quick-view/css/quick-view.css', null, ''); } /** * Quick view localize. * * @since 1.0 * @param array $localize JS localize variables. * @return array */ function bizz_ecommerce_bizz_ecommerce_qv_js_localize( $localize ){ global $wp_query; $loader = ''; if ( ! isset( $localize['ajax_url'] ) ){ $localize['ajax_url'] = admin_url( 'admin-ajax.php', 'relative' ); } $localize['qv_loader'] = $loader; return $localize; } /****************/ // add to compare /****************/ function bizz_ecommerce_add_to_compare($pid=''){ if( is_plugin_active('yith-woocommerce-compare/init.php') ){ return '