';
}
//wrapper sub page header - end
function rt_woocommerce_output_content_wrapper_end(){
global $sidebar;
echo '
';
//call the sub content holder 2nd part
sub_page_layout("subfooter",@$sidebar);
}
//pagination
function rt_woocommerce_pagination(){
echo '
';
get_pagination();
echo '
';
}
//thumbnail
function rt_woocommerce_template_loop_product_thumbnail() {
global $post, $woocommerce, $placeholder_width, $placeholder_height, $title;
if ( ! $placeholder_width )
$placeholder_width = $woocommerce->get_image_size( 'shop_catalog_image_width' );
if ( ! $placeholder_height )
$placeholder_height = $woocommerce->get_image_size( 'shop_catalog_image_height' );
$image = (has_post_thumbnail( $post->ID )) ? get_post_thumbnail_id($post->ID) : "";
//Thumbnail dimensions
$w = ($placeholder_width > 640) ? 940 : (($placeholder_width > 400) ? 440 : 420);
$h = get_option(THEMESLUG."_woo_product_image_height");
// Crop
$crop = get_option(THEMESLUG."_woo_product_image_crop");
if($crop) $crop="true"; else $h=10000;
// Resize Image
if($image) $image_thumb = @vt_resize( $image, '', $w, $h, ''.$crop.'' );
if ( has_post_thumbnail() )
echo '';
else
echo '';
echo '';
}
//Single Page Titles
function rt_woocommerce_single_product_summary(){
echo '
';
if(is_page() || is_single()) the_title();
if(is_tax()) echo single_term_title( "", false );
echo '
';
}
add_action( 'woocommerce_before_single_product_summary', 'rt_woocommerce_before_single_product_summary', 5);
add_action( 'woocommerce_after_single_product_summary', 'rt_woocommerce_after_single_product_summary', 10);
function rt_woocommerce_before_single_product_summary() {
echo '';
}
function rt_woocommerce_after_single_product_summary() {
echo "
";
}
//Related Products
function rt_woocommerce_output_related_products() {
global $product, $woocommerce_loop,$related,$posts_per_page,$orderby,$columns;
$woo_related_product_layout = get_option(THEMESLUG."_woo_related_product_list_pager");
$woo_related_product_layout = $woo_related_product_layout ? $woo_related_product_layout : 3; //default 3
$related = $product->get_related();
if ( sizeof($related) == 0 ) return;
$args = apply_filters('woocommerce_related_products_args', array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'posts_per_page' => $woo_related_product_layout,
'orderby' => $orderby,
'post__in' => $related
));
$products = new WP_Query( $args );
$woocommerce_loop['columns'] = $columns;
if ( $products->have_posts() ) : ?>
get_upsells();
if ( sizeof( $upsells ) == 0 ) return;
$args = array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'posts_per_page' => 4,
'no_found_rows' => 1,
'orderby' => 'rand',
'post__in' => $upsells
);
$products = new WP_Query( $args );
$woocommerce_loop['loop'] = 0;
if ( $products->have_posts() ) : ?>
get_gallery_attachment_ids();
if ( $attachment_ids ) {
$loop = 0;
$columns = apply_filters( 'woocommerce_product_thumbnails_columns', 3 );
foreach ( $attachment_ids as $attachment_id ) {
$classes = array( 'zoom' );
if ( $loop == 0 || $loop % $columns == 0 )
$classes[] = 'first';
if ( ( $loop + 1 ) % $columns == 0 )
$classes[] = 'last';
$image_link = wp_get_attachment_url( $attachment_id );
if ( ! $image_link )
continue;
$image_title = esc_attr( get_the_title( $attachment_id ) );
//resize the photo
$w = 110;
$h = 90;
$crop = "true";
$image_thumb = @vt_resize('' , $image_link, $w, $h, $crop );
$imagesHTML .= '';
}
}
if(trim(isset($imagesHTML))){
echo '';
echo '
';
echo $imagesHTML;
echo '
';
}
}
//category thumbnails
function rt_woocommerce_subcategory_thumbnail( $category ) {
global $woocommerce;
$small_thumbnail_size = apply_filters( 'single_product_small_thumbnail_size', 'shop_catalog' );
$dimensions = $woocommerce->get_image_size( $small_thumbnail_size );
$thumbnail_id = get_woocommerce_term_meta( $category->term_id, 'thumbnail_id', true );
if ( $thumbnail_id ) {
$image = wp_get_attachment_image_src( $thumbnail_id, $small_thumbnail_size );
$image = $image[0];
} else {
$image = woocommerce_placeholder_img_src();
}
if ( $image )
echo '';
}
#-----------------------------------------
# RT - WOOCOMMERCE Options
#-----------------------------------------
global $woo_product_layout, $woo_layout_names, $woo_column_class_name;
#
# COLUMN LAYOUT
#
$woo_product_layout = get_option(THEMESLUG."_woo_product_layout");
$woo_product_layout = $woo_product_layout ? $woo_product_layout : 3; //default 3
// woo layouts
$woo_layout_names = array("5"=>"five","4"=>"four","3"=>"three","2"=>"two","1"=>"one");
$woo_column_class_name = $woo_layout_names[$woo_product_layout];
// Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
function loop_columns() {
global $woo_product_layout;
return $woo_product_layout;
}
}
// add column value as javascript value to header
add_filter('wp_head', 'rt_woo_column_jquery_var');
if (!function_exists('rt_woo_column_jquery_var')) {
function rt_woo_column_jquery_var() {
global $woo_product_layout;
$output = "\n";
$output .= ''."\n";
echo $output;
}
}
;
#
# Number of products displayed per page
#
$woo_product_list_pager = get_option(THEMESLUG."_woo_product_list_pager");
if($woo_product_list_pager!="" && is_numeric($woo_product_list_pager) ) add_filter('loop_shop_per_page', create_function('$cols', 'return '.$woo_product_list_pager.';'));
#
# Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
#
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 > 1 )
echo sprintf(__('%d items', 'rt_theme'), $woocommerce->cart->cart_contents_count);
else
echo sprintf(__('%d item', 'rt_theme'), $woocommerce->cart->cart_contents_count);
?>
- cart->get_cart_total(); ?>