'', 'post_type' => 'product', 'paged' => $paged ) ); define('SHOP_IS_ON_FRONT', true); endif; } } add_action('wp_head', 'jigoshop_front_page_archive', 0); /** * Content Wrappers **/ if (!function_exists('jigoshop_output_content_wrapper')) { function jigoshop_output_content_wrapper() { if( get_option('template') === 'twentyeleven' ) echo '
'; else echo '
'; /* twenty-ten */ } } if (!function_exists('jigoshop_output_content_wrapper_end')) { function jigoshop_output_content_wrapper_end() { if( get_option('template') === 'twentyeleven' ) echo '
'; else echo ''; /* twenty-ten */ } } /** * Sale Flash **/ if (!function_exists('jigoshop_show_product_sale_flash')) { function jigoshop_show_product_sale_flash( $post, $_product ) { if ($_product->is_on_sale()) echo ''.__('Sale!', 'jigoshop').''; } } /** * Sidebar **/ if (!function_exists('jigoshop_get_sidebar')) { function jigoshop_get_sidebar() { get_sidebar('shop'); } } /** * Products Loop **/ if (!function_exists('jigoshop_template_loop_add_to_cart')) { function jigoshop_template_loop_add_to_cart( $post, $_product ) { // do not show "add to cart" button if product's price isn't announced if ( $_product->get_price() === '' AND ! ($_product->is_type(array('variable', 'grouped', 'external'))) ) return; if ( $_product->is_in_stock() OR $_product->is_type('external') ) : if ( $_product->is_type(array('variable', 'grouped')) ) : $output = ''.__('Select', 'jigoshop').''; elseif ( $_product->is_type('external') ) : $output = ''.__('Buy product', 'jigoshop').''; else : $output = ''.__('Add to cart', 'jigoshop').''; endif; elseif ( ($_product->is_type(array('grouped')) ) ) : return; else : $output = ''.__('Out of Stock', 'jigoshop').''; endif; echo $output; } } if (!function_exists('jigoshop_template_loop_product_thumbnail')) { function jigoshop_template_loop_product_thumbnail( $post, $_product ) { echo jigoshop_get_product_thumbnail(); } } if (!function_exists('jigoshop_template_loop_price')) { function jigoshop_template_loop_price( $post, $_product ) { ?>get_price_html(); ?>'; do_action( 'jigoshop_before_single_product_summary_thumbnails', $post, $_product ); $thumb_id = 0; if (has_post_thumbnail()) : $thumb_id = get_post_thumbnail_id(); // since there are now user settings for sizes, shouldn't need filters -JAP- //$large_thumbnail_size = apply_filters('single_product_large_thumbnail_size', 'shop_large'); $large_thumbnail_size = jigoshop_get_image_size( 'shop_large' ); echo ''; the_post_thumbnail($large_thumbnail_size); echo ''; else : echo jigoshop_get_image_placeholder( 'shop_large' ); endif; do_action('jigoshop_product_thumbnails'); echo ''; } } if (!function_exists('jigoshop_show_product_thumbnails')) { function jigoshop_show_product_thumbnails() { global $_product, $post; echo '
'; $thumb_id = get_post_thumbnail_id(); $small_thumbnail_size = jigoshop_get_image_size( 'shop_thumbnail' ); $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID, 'orderby' => 'menu_order', 'order' => 'asc' ); $attachments = get_posts($args); if ($attachments) : $loop = 0; $columns = apply_filters( 'single_thumbnail_columns', 3 ); foreach ( $attachments as $attachment ) : if ($thumb_id==$attachment->ID) continue; $loop++; $_post = get_post( $attachment->ID ); $url = wp_get_attachment_url($_post->ID); $post_title = esc_attr($_post->post_title); $image = wp_get_attachment_image($attachment->ID, $small_thumbnail_size); echo ''.$image.''; endforeach; endif; wp_reset_query(); echo '
'; } } /** * After Single Products Summary Div **/ if (!function_exists('jigoshop_output_product_data_tabs')) { function jigoshop_output_product_data_tabs() { if (isset($_COOKIE["current_tab"])) $current_tab = $_COOKIE["current_tab"]; else $current_tab = '#tab-description'; ?>

get_price_html(); ?>

post_excerpt) echo wpautop(wptexturize($post->post_excerpt)); } } if (!function_exists('jigoshop_template_single_meta')) { function jigoshop_template_single_meta( $post, $_product ) { echo '
'; if (get_option('jigoshop_enable_sku')=='yes' && !empty($_product->sku)) : echo '
SKU: ' . $_product->sku . '
'; endif; echo $_product->get_categories( ', ', '
' . __( 'Posted in ', 'jigoshop' ) . '', '.
'); echo $_product->get_tags( ', ', '
' . __( 'Tagged as ', 'jigoshop' ) . '', '.
'); echo '
'; } } if (!function_exists('jigoshop_template_single_sharing')) { function jigoshop_template_single_sharing( $post, $_product ) { if (get_option('jigoshop_sharethis')) : echo '
'; endif; } } /** * Product Add to cart buttons **/ if (!function_exists('jigoshop_template_single_add_to_cart')) { function jigoshop_template_single_add_to_cart( $post, $_product ) { do_action( $_product->product_type . '_add_to_cart' ); } } if (!function_exists('jigoshop_simple_add_to_cart')) { function jigoshop_simple_add_to_cart() { global $_product; $availability = $_product->get_availability(); // do not show "add to cart" button if product's price isn't announced if( $_product->get_price() === '') return; if ($availability['availability']) : ?>

get_availability(); // do not show "add to cart" button if product's price isn't announced if( $_product->get_price() === '') return; if ($availability['availability']) : ?>

get_children()) return; ?>
get_children() as $child_ID) : $child = $_product->get_child($child_ID); $cavailability = $child->get_availability(); ?>
get_price_html(); ?>
get_available_attributes_variations(); //get all variations available as an array for easy usage by javascript $variationsAvailable = array(); $children = $_product->get_children(); foreach($children as $child) { /* @var $variation jigoshop_product_variation */ $variation = $_product->get_child( $child ); if($variation instanceof jigoshop_product_variation && $variation->is_visible()) { $vattrs = $variation->get_variation_attributes(); $availability = $variation->get_availability(); //@todo needs to be moved to jigoshop_product_variation class if (has_post_thumbnail($variation->get_variation_id())) { $attachment_id = get_post_thumbnail_id( $variation->get_variation_id() ); $large_thumbnail_size = apply_filters('single_product_large_thumbnail_size', 'shop_large'); $image = current(wp_get_attachment_image_src( $attachment_id, $large_thumbnail_size)); $image_link = current(wp_get_attachment_image_src( $attachment_id, 'full')); } else { $image = ''; $image_link = ''; } $a_weight = $a_length = $a_width = $a_height = ''; if ( $variation->get_weight() ) { $a_weight = ' Weight '.$variation->get_weight().get_option('jigoshop_weight_unit').' '; } if ( $variation->get_length() ) { $a_length = ' Length '.$variation->get_length().get_option('jigoshop_dimension_unit').' '; } if ( $variation->get_width() ) { $a_width = ' Width '.$variation->get_width().get_option('jigoshop_dimension_unit').' '; } if ( $variation->get_height() ) { $a_height = ' Height '.$variation->get_height().get_option('jigoshop_dimension_unit').' '; } $variationsAvailable[] = array( 'variation_id' => $variation->get_variation_id(), 'sku' => '
SKU: ' . $variation->get_sku() . '
', 'attributes' => $vattrs, 'image_src' => $image, 'image_link' => $image_link, 'price_html' => ''.$variation->get_price_html().'', 'availability_html' => '

'. $availability['availability'].'

', 'a_weight' => $a_weight, 'a_length' => $a_length, 'a_width' => $a_width, 'a_height' => $a_height, ); } } ?>
$options ): ?>
ID, 'external_url', true ); if ( ! $external_url ) return false; ?>

max_num_pages > 1 ) : ?> post_content ) return false; ?>
  • >
  • has_attributes() || $_product->has_dimensions() || $_product->has_weight() ) ): ?>
  • >
  • >
  • '; echo '

    ' . apply_filters('jigoshop_product_description_heading', __('Product Description', 'jigoshop')) . '

    '; the_content(); echo ''; } } if (!function_exists('jigoshop_product_attributes_panel')) { function jigoshop_product_attributes_panel() { global $_product; echo '
    '; echo '

    ' . apply_filters('jigoshop_product_attributes_heading', __('Additional Information', 'jigoshop')) . '

    '; echo $_product->list_attributes(); echo '
    '; } } if (!function_exists('jigoshop_product_reviews_panel')) { function jigoshop_product_reviews_panel() { echo '
    '; comments_template(); echo '
    '; } } /** * Jigoshop Product Thumbnail **/ if (!function_exists('jigoshop_get_product_thumbnail')) { function jigoshop_get_product_thumbnail( $size = 'shop_small' ) { global $post; if ( has_post_thumbnail() ) return get_the_post_thumbnail($post->ID, $size); else return jigoshop_get_image_placeholder( $size ); } } /** * Jigoshop Product Image Placeholder * @since 0.9.9 **/ if (!function_exists('jigoshop_get_image_placeholder')) { function jigoshop_get_image_placeholder( $size = 'shop_small' ) { $image_size = jigoshop_get_image_size( $size ); return 'Placeholder'; } } /** * Jigoshop Related Products **/ if (!function_exists('jigoshop_output_related_products')) { function jigoshop_output_related_products() { // 4 Related Products in 4 columns jigoshop_related_products( 2, 2 ); } } if (!function_exists('jigoshop_related_products')) { function jigoshop_related_products( $posts_per_page = 4, $post_columns = 4, $orderby = 'rand' ) { global $_product, $columns, $per_page; // Pass vars to loop $per_page = $posts_per_page; $columns = $post_columns; $related = $_product->get_related(); if (sizeof($related)>0) : echo ''; endif; wp_reset_query(); } } /** * Jigoshop Shipping Calculator **/ if (!function_exists('jigoshop_shipping_calculator')) { function jigoshop_shipping_calculator() { if (jigoshop_shipping::show_shipping_calculator()) : ?>

    get_rates_amount(); $i++) { ?>

    id . ':' . $i ) . '"' . ' class="shipping_select"'; if ( $method->get_cheapest_service() == $method->get_selected_service($i) && $method->is_chosen() ) echo ' checked>'; else echo '>'; echo $method->get_selected_service($i) . ' via ' . $method->title; ?>

    get_selected_price($i)); if ($method->shipping_tax>0) : __(' (ex. tax)', 'jigoshop'); endif; ?>

    id . ':' ) .'" class="shipping_select"'; if ( $method->is_chosen() ) echo 'checked>'; else echo '>'; echo $method->title; ?>

    shipping_total>0) : echo jigoshop_price($method->shipping_total); if ($method->shipping_tax>0) : __(' (ex. tax)', 'jigoshop'); endif; else : echo __('Free', 'jigoshop'); endif; ?>

    ', $wrap_after = '', $before = '', $after = '', $home = null ) { global $post, $wp_query, $author, $paged; if( !$home ) $home = _x('Home', 'breadcrumb', 'jigoshop'); $home_link = home_url(); $prepend = ''; if ( get_option('jigoshop_prepend_shop_page_to_urls')=="yes" && jigoshop_get_page_id('shop') && get_option('page_on_front') !== jigoshop_get_page_id('shop') ) $prepend = $before . '' . get_the_title( jigoshop_get_page_id('shop') ) . ' ' . $after . $delimiter; if ( (!is_home() && !is_front_page() && !(is_post_type_archive() && get_option('page_on_front')==jigoshop_get_page_id('shop'))) || is_paged() ) : echo $wrap_before; echo $before . '' . $home . ' ' . $after . $delimiter ; if ( is_category() ) : $cat_obj = $wp_query->get_queried_object(); $this_category = $cat_obj->term_id; $this_category = get_category( $this_category ); if ($thisCat->parent != 0) : $parent_category = get_category( $this_category->parent ); echo get_category_parents($parent_category, TRUE, $delimiter ); endif; echo $before . single_cat_title('', false) . $after; elseif ( is_tax('product_cat') ) : //echo $before . '' . ucwords(get_option('jigoshop_shop_slug')) . '' . $after . $delimiter; $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $parents = array(); $parent = $term->parent; while ($parent): $parents[] = $parent; $new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' )); $parent = $new_parent->parent; endwhile; if(!empty($parents)): $parents = array_reverse($parents); foreach ($parents as $parent): $item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' )); echo $before . '' . $item->name . '' . $after . $delimiter; endforeach; endif; $queried_object = $wp_query->get_queried_object(); echo $prepend . $before . $queried_object->name . $after; elseif ( is_tax('product_tag') ) : $queried_object = $wp_query->get_queried_object(); echo $prepend . $before . __('Products tagged “', 'jigoshop') . $queried_object->name . '”' . $after; elseif ( is_day() ) : echo $before . '' . get_the_time('Y') . '' . $after . $delimiter; echo $before . '' . get_the_time('F') . '' . $after . $delimiter; echo $before . get_the_time('d') . $after; elseif ( is_month() ) : echo $before . '' . get_the_time('Y') . '' . $after . $delimiter; echo $before . get_the_time('F') . $after; elseif ( is_year() ) : echo $before . get_the_time('Y') . $after; elseif ( is_post_type_archive('product') && get_option('page_on_front') !== jigoshop_get_page_id('shop') ) : $_name = jigoshop_get_page_id('shop') ? get_the_title( jigoshop_get_page_id('shop') ) : ucwords(get_option('jigoshop_shop_slug')); if (is_search()) : echo $before . '' . $_name . '' . $delimiter . __('Search results for “', 'jigoshop') . get_search_query() . '”' . $after; else : echo $before . '' . $_name . '' . $after; endif; elseif ( is_single() && !is_attachment() ) : if ( get_post_type() == 'product' ) : //echo $before . '' . ucwords(get_option('jigoshop_shop_slug')) . '' . $after . $delimiter; echo $prepend; if ($terms = get_the_terms( $post->ID, 'product_cat' )) : $term = current($terms); $parents = array(); $parent = $term->parent; while ($parent): $parents[] = $parent; $new_parent = get_term_by( 'id', $parent, 'product_cat'); $parent = $new_parent->parent; endwhile; if(!empty($parents)): $parents = array_reverse($parents); foreach ($parents as $parent): $item = get_term_by( 'id', $parent, 'product_cat'); echo $before . '' . $item->name . '' . $after . $delimiter; endforeach; endif; echo $before . '' . $term->name . '' . $after . $delimiter; endif; echo $before . get_the_title() . $after; elseif ( get_post_type() != 'post' ) : $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo $before . '' . $post_type->labels->singular_name . '' . $after . $delimiter; echo $before . get_the_title() . $after; else : $cat = current(get_the_category()); echo get_category_parents($cat, TRUE, $delimiter); echo $before . get_the_title() . $after; endif; elseif ( is_404() ) : echo $before . __('Error 404', 'jigoshop') . $after; elseif ( !is_single() && !is_page() && get_post_type() != 'post' ) : $post_type = get_post_type_object(get_post_type()); if ($post_type) : echo $before . $post_type->labels->singular_name . $after; endif; elseif ( is_attachment() ) : $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); $cat = $cat[0]; echo get_category_parents($cat, TRUE, '' . $delimiter); echo $before . '' . $parent->post_title . '' . $after . $delimiter; echo $before . get_the_title() . $after; elseif ( is_page() && !$post->post_parent ) : echo $before . get_the_title() . $after; elseif ( is_page() && $post->post_parent ) : $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '' . get_the_title($page->ID) . ''; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) : echo $crumb . '' . $delimiter; endforeach; echo $before . get_the_title() . $after; elseif ( is_search() ) : echo $before . __('Search results for “', 'jigoshop') . get_search_query() . '”' . $after; elseif ( is_tag() ) : echo $before . __('Posts tagged “', 'jigoshop') . single_tag_title('', false) . '”' . $after; elseif ( is_author() ) : $userdata = get_userdata($author); echo $before . __('Author: ', 'jigoshop') . $userdata->display_name . $after; endif; if ( get_query_var('paged') ) : echo ' (' . __('Page', 'jigoshop') . ' ' . get_query_var('paged') .')'; endif; echo $wrap_after; endif; } } /** * Hook to remove the 'singular' class, for the twenty eleven theme, to properly display the sidebar * * @param array $classes */ function jigoshop_body_classes ($classes) { if( ! is_content_wrapped() ) return $classes; $key = array_search('singular', $classes); if ( $key !== false ) unset($classes[$key]); return $classes; } /** * Order review table for checkout **/ function jigoshop_order_review() { jigoshop_get_template('checkout/review_order.php', false); }