'; } /** 18.ecommerce-radio-img-img Lite Header Wishlist */ function acommerce_top_wishlist() { if (!defined( 'YITH_WCWL' )) return; return YITH_WCWL()->get_wishlist_url(); } /** Add Compare Links */ function acommerce_add_compare_link( $product_id = false, $args = array() ) { if( !defined( 'YITH_WOOCOMPARE' ) ) return; extract( $args ); if ( ! $product_id ) { global $product; $productid = $product->get_id(); $product_id = isset( $productid ) ? $productid : 0; } $is_button = ! isset( $button_or_link ) || ! $button_or_link ? get_option( 'yith_woocompare_is_button' ) : $button_or_link; if ( ! isset( $button_text ) || $button_text == 'default' and function_exists( 'yit_wpml_register_string') ) { $button_text = get_option( 'yith_woocompare_button_text', esc_html__( 'Compare', 'acommerce' ) ); yit_wpml_register_string( 'Plugins', 'plugin_yit_compare_button_text', $button_text ); $button_text = yit_wpml_string_translate( 'Plugins', 'plugin_yit_compare_button_text', $button_text ); } printf( '
', '#', 'compare', intval($product_id)); } //ecommerce-radio-img-img wishlist products section function acommerce_wishlist_products() { if ( !defined( 'YITH_WCWL' )) return; global $product; $url = add_query_arg( 'add_to_wishlist', $product->get_id() ); $id = $product->get_id(); $wishlist_url = YITH_WCWL()->get_wishlist_url(); ?>
plugin_url() . '/assets/fonts/'; $acommerce_inline_font = '@font-face { font-family: "star"; src: url("' . $acommerce_font_path . 'star.eot"); src: url("' . $acommerce_font_path . 'star.eot?#iefix") format("embedded-opentype"), url("' . $acommerce_font_path . 'star.woff") format("woff"), url("' . $acommerce_font_path . 'star.ttf") format("truetype"), url("' . $acommerce_font_path . 'star.svg#star") format("svg"); font-weight: normal; font-style: normal; }'; wp_add_inline_style( 'acommerce-woocommerce-style', $acommerce_inline_font ); } /** * Add 'woocommerce-active' class to the body tag. * * @param array $classes CSS classes applied to the body tag. * @return array $classes modified to include 'woocommerce-active' class. */ function acommerce_woocommerce_active_body_class( $classes ) { $classes[] = 'woocommerce-active'; return $classes; } /** * Products per page. * * @return integer number of products. */ function acommerce_woocommerce_products_per_page() { return get_theme_mod('acommerce_woocommerce_products_per_page',12); } /** * Product gallery thumnbail columns. * * @return integer number of columns. */ function acommerce_woocommerce_thumbnail_columns() { return get_theme_mod('acommerce_woocommerce_loop_columns',4); } /** * Default loop columns on product archives. * * @return integer products per row. */ function acommerce_woocommerce_loop_columns() { return get_theme_mod('acommerce_woocommerce_loop_columns',4); } /** * Related Products Args. * * @param array $args related products args. * @return array $args related products args. */ function acommerce_woocommerce_related_products_args( $args ) { $defaults = array( 'posts_per_page' => 4, 'columns' => 4, ); $args = wp_parse_args( $defaults, $args ); return $args; } /** * Product columns wrapper. * * @return void */ function acommerce_woocommerce_product_columns_wrapper() { $acommerce_columns = acommerce_woocommerce_loop_columns(); echo '
'; } /** * Product columns wrapper close. * * @return void */ function acommerce_woocommerce_product_columns_wrapper_close() { echo '
'; } /** * Before Content. * * Wraps all WooCommerce content in wrappers which match the theme markup. * * @return void */ function acommerce_woocommerce_wrapper_before() { ?>
  • cart->get_cart_contents_count()); ?> cart->get_cart_contents_count()); ?>
    get_average_rating(); echo '
    '; for( $i = 1; $i<=5; $i++ ) { if ($i<=$acommerce_average){ echo ''; }else{ echo ''; } } echo '
    '; } /** * Disable the default WooCommerce stylesheet. * * Removing the default WooCommerce stylesheet and enqueing your own will * protect you during WooCommerce core updates. * * @link https://docs.woocommerce.com/document/disable-the-default-stylesheet/ */ add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' ); /** * Remove default WooCommerce wrapper. */ remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); //add_action( 'woocommerce_before_shop_loop_item_title', 'acommerce_show_sale_percentage_loop', 25 ); function acommerce_show_sale_percentage_loop() { global $product; $percentage = ''; if ( ! $product->is_on_sale() ) return; if ( $product->is_type( 'simple' ) ) { $max_percentage = ( ( $product->get_regular_price() - $product->get_sale_price() ) / $product->get_regular_price() ) * 100; } elseif ( $product->is_type( 'variable' ) ) { $max_percentage = 0; foreach ( $product->get_children() as $child_id ) { $variation = wc_get_product( $child_id ); $price = $variation->get_regular_price(); $sale = $variation->get_sale_price(); if ( $price != 0 && ! empty( $sale ) ) $percentage = ( $price - $sale ) / $price * 100; if ( $percentage > $max_percentage ) { $max_percentage = $percentage; } } } if ( $max_percentage > 0 ) echo "- " .esc_html( round( $max_percentage ) ). "%"; } function acommerce_show_info_display_loop() { global $product; // $acommerce_title = ''; if ( $product->is_featured() ) { $acommerce_title = esc_html__('Featured','acommerce'); }else{ if ( $product->is_on_sale() ) { $acommerce_title = esc_html__('Sale','acommerce'); } } if( $acommerce_title ){ $acommerce_title = " ".esc_html( $acommerce_title )." "; } return $acommerce_title; } function acommerce_prograss_bare(){ $date = date('y-m-j&\nb\sp;g:i:s'); $date1 = strtotime('2018-5-12 00:00:00'); $date2 = strtotime('2019-7-12 00:00:00'); $today = time(); $dateDiff = $date2 - $date1; $dateDiffForToday = $today - $date1; $percentage = $dateDiffForToday / $dateDiff * 100; $percentageRounded = round($percentage); return $percentageRounded; } /** * Woo Commerce Add Content Primary Div Function **/ remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10); remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 ); remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); if (!function_exists('acommerce_woocommerce_output_content_wrapper')) { function acommerce_woocommerce_output_content_wrapper(){ ?>
    get_gallery_image_ids(); if ( $attachment_ids ) { $imgurlmobile = wp_get_attachment_image_url( $attachment_ids[0], 'woocommerce_thumbnail' ); if( $imgurlmobile){ echo ''; }else{ the_post_thumbnail(); } //echo wp_get_attachment_image( $attachment_ids[0], apply_filters( 'single_product_small_thumbnail_size', 'shop_catalog' ), false, array('class'=>'secondary_image') ); }else{ the_post_thumbnail(); } //print_r( $attachment_ids );exit('new'); ?>

    '; acommerce_show_sale_percentage_loop(); echo '
    '; ?> 'rand', 'posts_per_page' => $acommerce_woocommerce_related_products_posts_per_page, 'post_type' => 'product', ); //related post query $query = new WP_Query( $related_posts ); ?>

      have_posts()) { while($query->have_posts()) { $query->the_post(); echo '
    • '; acommerce_woocommerce_before_shop_loop_item(); echo '
    • '; }}wp_reset_query(); ?>
    'my-account', 'menu_id' => 'acommerce-my-account', 'container' => 'ul', 'menu_class' => 'acommerce-my-account' ) ); } else { $submenu = '
    '; $submenu .= '
      '; foreach ( wc_get_account_menu_items() as $endpoint => $label ) { $url = ( $endpoint != 'dashboard' ) ? wc_get_endpoint_url( $endpoint, '', $login_link ) : $login_link ; $submenu .= '
    • '; $submenu .= '' . esc_html( $label ) . ''; $submenu .= '
    • '; } $submenu .= '
    '; $submenu .= '
    '; } $link = array( 'class' => 'my-account-link' . $class, 'link_class' => '', 'href' => $login_link, 'title' => esc_html__( 'My Account', 'acommerce' ), 'submenu' => $submenu ); $class .= ' my-account-link'; } else { $login_text = ( $short ) ? esc_html__( 'Sign In', 'acommerce' ) : esc_html__( 'Sign In or Create an account', 'acommerce' ); $login_text = 'Login text'; if ( ! $short ) { if ( acommerce_is_woocommerce_activated() ) { ob_start(); ?>

    false, 'label_username' => esc_html__( 'Username or email address *', 'acommerce' ), 'label_password' => esc_html__( 'Password *', 'acommerce' ) ) ); } } else { $login_form = ''; } $link = array( 'class' => 'login-link' . $class, 'link_class' => '', 'href' => $login_link, 'title' => $login_text, 'submenu' => '
    ' . $login_form . '
    ' ); $class .= ' login-link'; } if ( $echo ) { $out = ''; $out .= sprintf( '<%1$s class="%2$s">%5$s%6$s', 'div', $class, $link['href'], $link['link_class'], $link['title'], $link['submenu'] ); if ( $echo === 'get' ) { return wp_kses_post( $out ); } else { echo wp_kses_post( $out ) ; } } else { return $link; } } } /** Woocommerce Shop Products Quick View */ function acommerce_css_js_woocomerce() { //slider test wp_enqueue_script('slick.min.js', ACOMMERCE_THEME_URI . 'assets/js/slick.min.js', array(), false, false); wp_enqueue_script('acommerce_img_js', ACOMMERCE_THEME_URI . 'assets/js/easyzoom.js', array(), false, false); } add_action('wp_enqueue_scripts', 'acommerce_css_js_woocomerce'); function acommerce_product_image_wrap_open () { echo '
    '; } function acommerce_product_image_wrap_close () { echo '
    '; } add_action( 'yith_wcqv_product_image', 'acommerce_product_image_wrap_open', 9 ); add_action( 'yith_wcqv_product_image', 'acommerce_product_image_wrap_close', 21 ); function acommerce_add_thumb_wcqv () { add_action('woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 2); } add_action( 'wp_ajax_yith_load_product_quick_view', "acommerce_add_thumb_wcqv", 1); add_action( 'wp_ajax_nopriv_yith_load_product_quick_view', 'acommerce_add_thumb_wcqv',1 ); //Replace Ratings in popup remove_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_rating', 10 ); add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_rating', 4 ); add_action( 'yith_wcqv_product_summary', 'woocommerce_template_single_meta', 17 ); add_action( 'yith_wcqv_product_summary' , 'acommerce_add_title_quantity', 18 ); function acommerce_add_instock () { global $product; $availability = $product->get_availability(); $availability_icon = $availability['class'] === "in-stock" ? '' : ''; $availability_html = empty( $availability['availability'] ) ? '' : '

    ' . $availability_icon . esc_html( $availability['availability'] ) . '

    '; echo wp_kses_post( $availability_html ); } add_action( 'yith_wcqv_product_summary', 'acommerce_add_instock', 16 ); add_action( 'woocommerce_single_product_summary', 'acommerce_add_instock', 11 );