'; } function alchem_after_shop_loop_item(){ echo ''; } function alchem_after_catalog_ordering(){ } function alchem_woocommerce_before_shop_loop(){ echo "
"; } function alchem_woocommerce_after_shop_loop(){ echo "
"; } function alchem_single_product_sharing(){ } function alchem_woocommerce_output_content_wrapper() { global $woocommerce; $detect = new Mobile_Detect; $sidebar ='none'; $enable_page_title_bar = alchem_option('enable_page_title_bar'); $page_title_bg_parallax = esc_attr(alchem_option('page_title_bg_parallax')); $page_title_bg_parallax = $page_title_bg_parallax=="yes"?"parallax-scrolling":""; $page_title_align = esc_attr(alchem_option('page_title_align')); $display_breadcrumb = esc_attr(alchem_option('display_breadcrumb')); $breadcrumbs_on_mobile = esc_attr(alchem_option('breadcrumbs_on_mobile_devices')); $breadcrumb_menu_prefix = esc_attr(alchem_option('breadcrumb_menu_prefix')); $breadcrumb_menu_separator = esc_attr(alchem_option('breadcrumb_menu_separator')); if(is_single()) { $left_sidebar = alchem_option('left_sidebar_woo_products'); $right_sidebar = alchem_option('right_sidebar_woo_products'); }else { $left_sidebar = alchem_option('left_sidebar_woo_archive'); $right_sidebar = alchem_option('right_sidebar_woo_archive'); } if( $left_sidebar ) $sidebar = 'left'; if( $right_sidebar ) $sidebar = 'right'; if( $left_sidebar && $right_sidebar ) $sidebar = 'both'; $aside = 'no-aside'; if( $left_sidebar !='' ) $aside = 'left-aside'; if( $right_sidebar !='' ) $aside = 'right-aside'; if( $left_sidebar !='' && $right_sidebar !='' ) $aside = 'both-aside'; echo '
'; do_action("alchem_before_content_wrap"); echo '
'; if( $enable_page_title_bar == 'yes' ):?>

isMobile()):?> "
".$breadcrumb_menu_prefix,"after"=>"
","show_browse"=>false,"separator"=>$breadcrumb_menu_separator));?> isMobile()):?> "
".$breadcrumb_menu_prefix,"after"=>"
","show_browse"=>false,"separator"=>$breadcrumb_menu_separator));?>
'; if( $left_sidebar !='' ):?>
'; } function alchem_woocommerce_styles(){ if(is_admin() || 'wp-login.php' == basename($_SERVER['PHP_SELF'])){ return; } //wp_enqueue_style('alchem-woocommerce', get_template_directory_uri().'/style/woocommerce.css', false, false, 'all'); } add_action('wp_print_styles', 'alchem_woocommerce_styles',12); add_filter('add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment'); function woocommerce_header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); ?> cart->cart_contents_count, 'alchem'), $woocommerce->cart->cart_contents_count);?> - cart->get_cart_total(); ?> cart->get_cart() && is_array( $woocommerce->cart->get_cart() ) ) { foreach ( $woocommerce->cart->get_cart() as $cart ) { $items_in_cart[] = $cart['product_id']; } } $id = get_the_ID(); $in_cart = in_array( $id, $items_in_cart ); $size = 'shop_catalog'; $gallery = get_post_meta( $id, '_product_image_gallery', true ); $attachment_image = ''; if ( ! empty( $gallery ) ) { $gallery = explode( ',', $gallery ); $first_image_id = $gallery[0]; $attachment_image = wp_get_attachment_image( $first_image_id, $size, false, array( 'class' => 'hover-image' ) ); } $output = '
'; if ( has_post_thumbnail() ) { $thumb = get_the_post_thumbnail( get_the_ID() , "shop_catalog" ); $output .= '
'.$thumb.'
'.$attachment_image.'
'; } else { $output .= 'Placeholder'; } $output .= '
'; return $output; } } function alchem_short_desc_filter($content){ $content = str_replace ('

','

',$content); return $content; } add_filter('woocommerce_short_description', 'alchem_short_desc_filter'); function alchem_url_set_value($url,$key,$value) { $a=explode('?',$url); $url_f=$a[0]; $query=isset($a[1])?$a[1]:""; parse_str($query,$arr); $arr[$key]=$value; return $url_f.'?'.http_build_query($arr); } function alchem_get_self_url(){ if (isset($_SERVER['REQUEST_URI'])) { $serverrequri = $_SERVER['REQUEST_URI']; } else { if (isset($_SERVER['argv'])) { $serverrequri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['argv'][0]; } else if(isset($_SERVER['QUERY_STRING'])) { $serverrequri = $_SERVER['PHP_SELF'] .'?'. $_SERVER['QUERY_STRING']; } } $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strstr(strtolower($_SERVER["SERVER_PROTOCOL"]), "/",true).$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$serverrequri; } function alchem_header_shopping_cart(){ global $woocommerce; } /** * Register the [woocommerce_recently_viewed_products per_page="5"] shortcode * * This shortcode displays recently viewed products using WooCommerce default cookie * It only has one parameter "per_page" to choose number of items to show * * @access public * @since 1.0 * @return $content */ function alchem_woocommerce_recently_viewed_products( ) { // Get WooCommerce Global global $woocommerce; // Get recently viewed product cookies data $viewed_products = ! empty( $_COOKIE['woocommerce_recently_viewed'] ) ? (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] ) : array(); $viewed_products = array_filter( array_map( 'absint', $viewed_products ) ); // If no data, quit if ( empty( $viewed_products ) ) return __( 'You have not viewed any product yet!', 'alchem' ); // Create the object // Get products per page if( !isset( $per_page ) ? $number = 4 : $number = $per_page ) // Create query arguments array $query_args = array( 'posts_per_page' => $number, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'post__in' => $viewed_products, 'orderby' => 'rand' ); // Add meta_query to query args $query_args['meta_query'] = array(); // Check products stock status $query_args['meta_query'][] = $woocommerce->query->stock_status_meta_query(); // Create a new query $r = new WP_Query($query_args); // If query return results if ( $r->have_posts() ) { woocommerce_product_loop_start(); // Start the loop while ( $r->have_posts()) { $r->the_post(); wc_get_template_part( 'content', 'product' ); } woocommerce_product_loop_end(); } wp_reset_query(); } add_action("woocommerce_cart_is_empty", "alchem_woocommerce_recently_viewed_products"); function alchem_before_cart(){} add_action("woocommerce_before_cart", "alchem_before_cart",0); function alchem_before_checkout_form(){} add_action("woocommerce_before_checkout_form", "alchem_before_checkout_form",20); function alchem_before_thankyou(){} add_action("woocommerce_before_thankyou", "alchem_before_thankyou"); function alchem_after_nav_menu(){} add_action("alchem_before_nav_menu", "alchem_after_nav_menu");