get_id(), 'product_cat', array( 'orderby' => 'parent', 'order' => 'DESC' ) ); if ( empty( $terms ) ) { return ''; } if ( $terms[0]->parent == 0 ) { $cat = $terms[0]; } else { $ancestors = get_ancestors( $terms[0]->term_id, 'product_cat', 'taxonomy' ); $cat_id = end( $ancestors ); $cat = get_term( $cat_id, 'product_cat' ); } return '
'; } /*Shop Get sale percentage*/ public function sale_flash( $args, $post, $product ) { if ( 'percentage' == bigshop_option('wc_sale_label') ) { if ( $product->get_type() === 'variable' ) { $product_variation_prices = $product->get_variation_prices(); $highest_sale_percent = 0; foreach( $product_variation_prices['regular_price'] as $key => $regular_price ) { $sale_price = $product_variation_prices['sale_price'][$key]; if ( $sale_price < $regular_price ) { $sale_percent = round( ( ( $regular_price - $sale_price ) / $regular_price ) * 100 ); if ( $sale_percent > $highest_sale_percent ) { $highest_sale_percent = $sale_percent; } } } return sprintf('-%s%%', $highest_sale_percent ); } else { $regular_price = $product->get_regular_price(); $sale_percent = 0; if ( intval( $regular_price ) > 0 ) { $sale_percent = round( ( ( $regular_price - $product->get_sale_price() ) / $regular_price ) * 100 ); } return sprintf('-%s%%', $sale_percent ); } } else { $price = $product->get_regular_price(); $sale = $product->get_sale_price(); if ( !$price ) { return $args; } $discount = ( ( $price - $sale ) / $price ) * 100; $discount = round( $discount ); return sprintf('' . esc_html__( 'Sale!', 'bigshop' ) . '', $discount ); } } public function actions_button_control( $product, $module_data,$add_to_cart=false ) { if( ! $product ){ return ; } $product_id = $product->get_id(); ?> '; } return $icon; } public function compare_button_icon( $icon ) { $icon = ''; return $icon; } public function quick_view_icon( $icon ) { $icon = ''; return $icon; } public static function print_add_to_cart_icon( $product_id, $icon = true, $text = true ){ if ( defined( 'ELEMENTOR_PATH' ) && class_exists( 'Elementor\Widget_Base' ) ) { if ( \Elementor\Plugin::$instance->preview->is_preview_mode() || \Elementor\Plugin::$instance->editor->is_edit_mode() ) { echo ''; return; } } global $product; $quantity = 1; $class = implode( ' ', array_filter( array( 'action-cart', 'product_type_' . $product->get_type(), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', !(FnsPro::is_module_active( 'pre_order' ) && PreOrderFns::is_on_pre_order( $product )) && $product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : '', ) ) ); $html = ''; $product_cart_id = WC()->cart->generate_cart_id( $product_id ); $in_cart = WC()->cart->find_product_in_cart( $product_cart_id ); if ( $in_cart ) { if ( $text ) { $html .= 'Already Added Cart'; } } else { if ( $icon ) { $html .= ''; } if ( $text ) { $html .= '' . $product->add_to_cart_text() . ''; } } if ( $in_cart ) { echo sprintf( '' . $html . '', esc_attr( $product->add_to_cart_text() ), esc_url( wc_get_cart_url() ), esc_attr( isset( $quantity ) ? $quantity : 1 ), esc_attr( $product->get_id() ), esc_attr( $product->get_sku() ) ); } else { echo sprintf( '' . $html . '', esc_attr( $product->add_to_cart_text() ), esc_url( $product->add_to_cart_url() ), esc_attr( isset( $quantity ) ? $quantity : 1 ), esc_attr( $product->get_id() ), esc_attr( $product->get_sku() ), esc_attr( isset( $class ) ? $class : 'action-cart' ) ); } } // Countdown hook public function flash_sale_countdown_positions( $positions ) { $positions['before_add_to_cart']['hooks']= [ 'bigshop_shop_layout_before_cart_button' ]; $positions['after_add_to_cart']['hooks']= [ 'bigshop_shop_layout_after_cart_button' ]; return $positions; } public static function bigshop_product_share( ) { echo ''; } public static function bigshop_product_social_share(){ $url = urlencode( get_permalink() ); $title = urlencode( get_the_title() ); $defaults = array( 'facebook' => array( 'url' => "http://www.facebook.com/sharer.php?u=$url", 'class' => 'bg-fb' ), 'twitter' => array( 'url' => "https://twitter.com/intent/tweet?source=$url&text=$title:$url", 'class' => 'bg-twitter' ), 'linkedin' => array( 'url' => "http://www.linkedin.com/shareArticle?mini=true&url=$url&title=$title", 'class' => 'bg-linked' ), 'pinterest'=> array( 'url' => "http://pinterest.com/pin/create/button/?url=$url&description=$title", 'class' => 'bg-pinterst' ), ); foreach ( $defaults as $key => $value ) { if ( !$value ) { unset( $defaults[$key] ); } } $sharers = apply_filters( 'rdtheme_social_sharing_icons', $defaults ); ?>