' . ob_get_contents() . '';
ob_end_clean();
return $fragments;
}
}
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
add_action( 'woocommerce_shop_loop_item_title', 'adela_woo_product_loop_title', 10 );
if( !function_exists( 'adela_woo_product_loop_title' ) ){
function adela_woo_product_loop_title(){
?>
is_frontend() || $is_ajax ) {
if ( $is_ajax ) {
if ( !class_exists( 'YITH_Woocompare_Frontend' ) ) {
if ( file_exists( YITH_WOOCOMPARE_DIR . 'includes/class.yith-woocompare-frontend.php' ) ) {
require_once( YITH_WOOCOMPARE_DIR . 'includes/class.yith-woocompare-frontend.php' );
}
}
$yith_woocompare->obj = new YITH_Woocompare_Frontend();
}
/* Remove button */
remove_action( 'woocommerce_after_shop_loop_item', array( $yith_woocompare->obj, 'add_compare_link' ), 20 );
/* Add compare button */
if ( !function_exists( 'adela_wc_loop_product_compare_btn' ) ) {
function adela_wc_loop_product_compare_btn()
{
if ( shortcode_exists( 'yith_compare_button' ) ) {
echo do_shortcode( '[yith_compare_button product_id="' . get_the_ID() . '"]' );
} // End if ( shortcode_exists( 'yith_compare_button' ) )
else {
if ( class_exists( 'YITH_Woocompare_Frontend' ) ) {
$YITH_Woocompare_Frontend = new YITH_Woocompare_Frontend();
echo do_shortcode( '[yith_compare_button product_id="' . get_the_ID() . '"]' );
}
}
}
}
add_action( 'adela_woo_compare_button', 'adela_wc_loop_product_compare_btn', 1 );
}
}
/* Compare in single product */
if( class_exists('YITH_Woocompare') && get_option('yith_woocompare_compare_button_in_product_page') == 'yes' ){
global $yith_woocompare;
$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
if( $yith_woocompare->is_frontend() || $is_ajax ) {
if( $is_ajax ){
if( !class_exists( 'YITH_Woocompare_Frontend' ) ){
$file_name = YITH_WOOCOMPARE_DIR . 'includes/class.yith-woocompare-frontend.php';
if( file_exists( $file_name ) ){
require_once( $file_name );
}
}
$yith_woocompare->obj = new YITH_Woocompare_Frontend();
}
remove_action( 'woocommerce_after_shop_loop_item', array( $yith_woocompare->obj, 'add_compare_link' ), 20 );
remove_action( 'woocommerce_single_product_summary', array( $yith_woocompare->obj, 'add_compare_link' ), 35 );
add_action( 'adela_single_product_after_add_to_cart_button', array( $yith_woocompare->obj, 'add_compare_link' ), 5 );
}
}
/* Wislist in single product */
add_filter('yith_wcwl_positions','adela_single_product_wishlist_button_position',99,1);
if( !function_exists('adela_single_product_wishlist_button_position')){
function adela_single_product_wishlist_button_position( $positions ){
if( isset( $positions['add-to-cart']['hook'] )){
$positions['add-to-cart']['hook'] = 'adela_single_product_after_add_to_cart_button';
}
if( isset( $positions['add-to-cart']['priority'] )){
$positions['add-to-cart']['priority'] = 10;
}
return $positions;
}
}
remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30);
remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20);
add_action( 'woocommerce_before_shop_loop', 'adela_woo_shop_bar_controls', 30 );
if( !function_exists( 'adela_woo_shop_bar_controls' ) ){
function adela_woo_shop_bar_controls(){
?>
request));
?>
get_id(), '_stock_status', true );
if( $product_status == 'instock' ){
$stock_status = array(
'class' => 'instock',
'label' => esc_html__( 'Instock', 'adela' )
);
}elseif( $product_status == 'outofstock' ){
$stock_status = array(
'class' => 'outofstock',
'label' => esc_html__( 'Out of Stock', 'adela' )
);
}elseif( $product_status == 'onrequest' ){
$stock_status = array(
'class' => 'onrequest',
'label' => esc_html__( 'On Request', 'adela' )
);
}else{
$stock_status = array(
'class' => 'undefine',
'label' => esc_html__( 'Undefine', 'adela' )
);
}
echo sprintf( '%s %s
', esc_attr( $stock_status['class'] ), esc_html__( 'Available: ', 'adela' ) , esc_attr( $stock_status['label'] ) );
}
}
add_action( 'woocommerce_after_add_to_cart_button', 'adela_single_product_add_to_cart_group_buttons', 30 );
if( !function_exists( 'adela_single_product_add_to_cart_group_buttons' ) ){
function adela_single_product_add_to_cart_group_buttons(){
?>
get_stock_quantity();
$is_enable_stock = get_post_meta( $product->get_id(), '_manage_stock', true );
$units_sold = get_post_meta( $product->get_id(), 'total_sales', true );
if( $is_enable_stock == 'yes' && $stock_quantity ){
?>
%s %d %s %d', esc_html__( "Only", 'adela' ), $stock_quantity, esc_html__( "left", 'adela' ), $units_sold ); ?>
-1,
'post_type' => 'yith-wcpsc-wc-chart',
'post_status' => 'publish',
'meta_key' => 'product',
'meta_value' => $post->ID
);
$charts = get_posts( $args );
ob_start();
if ( count( $charts ) > 0 ) {
foreach ( $charts as $chart ) {
$chart_title = $chart->post_title;
$chart_name = $chart->post_name;
$chart_id = $chart->ID;
if( isset( $chart_id ) ){
$table_meta = get_post_meta( $chart_id, '_table_meta', true );
$sizechart_args = array(
'table_meta' => $table_meta
);
?>
get_tag_ids() ) > 0 ){
$tabs['test_tab'] = array(
'title' => _n( 'Tag', 'Tags', count( $product->get_tag_ids() ), 'adela' ),
'priority' => 50,
'callback' => 'adela_single_product_display_tags'
);
}
return $tabs;
}
}
if( !function_exists( 'adela_single_product_display_tags' ) ){
function adela_single_product_display_tags(){
global $product; ?>
get_id(), ' ', '', '' ); ?>
get_category_ids();
if( is_array( $product_cat ) && isset( $product_cat[0] ) && is_numeric( $product_cat[0] ) ){
$p_cat = get_term_by( 'id', $product_cat[0], 'product_cat' );
if( $p_cat->term_id ){
?>
name ); ?>