Created
October 9, 2017 04:09
-
-
Save twern/66d5ee6d36ebf1077c51dd919d08d602 to your computer and use it in GitHub Desktop.
AP - 19797
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template for displaying product content in the single-product.php template | |
* | |
* This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php. | |
* | |
* HOWEVER, on occasion WooCommerce will need to update template files and you | |
* (the theme developer) will need to copy the new files to your theme to | |
* maintain compatibility. We try to do this as little as possible, but it does | |
* happen. When this occurs the version of the template file will be bumped and | |
* the readme will list any important changes. | |
* | |
* @see https://docs.woocommerce.com/document/template-structure/ | |
* @author WooThemes | |
* @package WooCommerce/Templates | |
* @version 3.0.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly | |
} | |
/** | |
* woocommerce_before_single_product hook. | |
* | |
* @hooked wc_print_notices - 10 | |
*/ | |
do_action( 'woocommerce_before_single_product' ); | |
if ( post_password_required() ) { | |
echo get_the_password_form(); | |
return; | |
} | |
global $product; | |
$social_media__share_image_url = ''; | |
$attributes_string = ''; | |
$average_rating = entrada_post_average_rating( get_the_ID() ); | |
update_post_meta( get_the_ID() , '_last_viewed', current_time('mysql') ); | |
entrada_set_post_views(get_the_ID()); | |
$variations = entrada_product_variations(get_the_ID()); | |
$entrada_product_type = get_post_meta( get_the_ID(),'entrada_product_type', true); | |
/* Product image gallery */ | |
global $post, $product, $woocommerce; | |
$gallery_image_urls = array(); | |
if (has_post_thumbnail( get_the_ID() )) : | |
$featured_img = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'single-post-thumbnail' ); | |
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'medium'); | |
$gallery_image_urls[] = $featured_img[0]; | |
$social_media__share_image_url = $thumb[0]; | |
endif; | |
$attachment_ids = $product->get_gallery_image_ids(); | |
if( $attachment_ids ) { | |
foreach( $attachment_ids as $attachment_id ){ | |
$gallery_image_urls[] = wp_get_attachment_url( $attachment_id, 'large'); | |
} | |
} | |
if( $entrada_product_type == 'shop_item' ) : | |
?> | |
<div class="common-spacing product-detail-container"> | |
<div class="container woocommerce"> | |
<div class="row"> | |
<div class="col-md-6"> | |
<?php if( count( $gallery_image_urls ) > 0 ) { ?> | |
<div class="col-wrapper"> | |
<!-- Nav tabs --> | |
<ul class="nav nav-tabs nav-v col" role="tablist"> | |
<?php | |
$entrada_item_image_gal_cnt = 0; | |
foreach( $gallery_image_urls as $entrada_img_url ) { | |
$entrada_item_image_gal_cnt++; | |
$active_class = ( $entrada_item_image_gal_cnt < 2 ? 'active' : '' ); | |
?> | |
<li role="presentation" class="<?php echo $active_class; ?>"> | |
<a href="#item-<?php echo $entrada_item_image_gal_cnt; ?>" aria-controls="item-<?php echo $entrada_item_image_gal_cnt; ?>" role="tab" data-toggle="tab"><img src="<?php echo $entrada_img_url; ?>" alt="<?php echo entrada_image_attributes_from_src( $entrada_img_url, 'title', true ); ?>"></a> | |
</li> | |
<?php } ?> | |
</ul> | |
<!-- Tab panes --> | |
<div class="tab-content col"> | |
<?php | |
$entrada_item_image_gal_cnt = 0; | |
foreach($gallery_image_urls as $entrada_img_url ) { | |
$entrada_item_image_gal_cnt++; | |
$active_class = ($entrada_item_image_gal_cnt < 2 ? 'active' : ''); | |
?> | |
<div role="tabpanel" class="tab-pane <?php echo $active_class; ?>" id="item-<?php echo $entrada_item_image_gal_cnt; ?>"> | |
<div class="img-container"> | |
<img src="<?php echo $entrada_img_url; ?>" alt="<?php echo entrada_image_attributes_from_src( $entrada_img_url, 'title', true ); ?>"> | |
</div> | |
</div> | |
<?php } ?> | |
</div> | |
</div> | |
<?php } ?> | |
</div> | |
<div class="col-md-6"> | |
<?php do_action( 'woocommerce_single_product_summary' ); ?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php | |
else : | |
if( entrada_is_plugin_active('wc-vendors/class-wc-vendors.php') ) { | |
$auth = get_post( get_the_ID() ); | |
$vendor_id = $auth->post_author; | |
} ?> | |
<!-- main tour information --> | |
<div itemscope itemtype="http://schema.org/Product"> | |
<section class="container-fluid trip-info"> | |
<div class="two-columns row"> | |
<div class="col col-md-6"> | |
<!-- top image slideshow --> | |
<?php | |
if( $gallery_image_urls ) { ?> | |
<div id="tour-slide"> | |
<?php | |
foreach( $gallery_image_urls as $slider_img ){ | |
$image = matthewruddy_image_resize( $slider_img, 960, 1149, true, false); | |
if ( array_key_exists('url', $image) && $image['url'] != '' ){ ?> | |
<div class="slide"> | |
<div class="bg-stretch"> | |
<img src="<?php echo $image['url']; ?>" itemprop="image" alt="<?php echo entrada_image_attributes_from_src( $slider_img, 'title', true ); ?>" height="1149" width="960"> | |
</div> | |
</div> | |
<?php } | |
} ?> | |
</div> | |
<?php if ( isset($vendor_id) && !is_super_admin( $vendor_id ) ) { ?> | |
<span class="wc_vendor_shop"><?php _e( 'Vendor', 'entrada' ); ?></span> | |
<?php } ?> | |
<?php } ?> | |
</div> | |
<div class="col col-md-6 text-col"> | |
<div class="holder"> | |
<?php | |
if( $product->is_type( 'booking' ) ) { | |
do_action( 'woocommerce_single_product_summary' ); | |
} else { | |
?> | |
<h1 class="small-size" itemprop="name"><?php the_title();?></h1> | |
<div class="price"> | |
<?php _e( 'from', 'entrada' ); ?> | |
<strong <?php echo entrada_price_schema_micro_data_link(get_the_ID()); ?>> | |
<?php entrada_product_price(get_the_ID(), true); ?> | |
<?php | |
// German Market: Get all necessary product data | |
// init | |
$hook = ''; | |
$output_parts = array(); | |
// get parts | |
$output_parts = apply_filters( 'wgm_product_summary_parts', $output_parts, $product, $hook ); | |
$output_parts = WGM_Shipping::add_shipping_part( $output_parts, $product ); // this class inits the filter with less parameters, so call it manually | |
// unset price in here, because it's already there | |
if ( isset( $output_parts[ 'price' ] ) ) { | |
unset( $output_parts[ 'price' ] ); | |
} | |
// build and output string | |
$output_html = implode( $output_parts ); | |
$output_html = apply_filters( 'wgm_product_summary_html', $output_html, $output_parts, $product, $hook ); | |
$output_html = apply_filters( 'wgm_product_summary_html_in_widget', $output_html, $output_parts, $product, $hook ); | |
echo $output_html; | |
?> | |
</strong> | |
</div> | |
<div class="description" itemprop="description"> | |
<?php the_content(); ?> | |
</div> | |
<ul class="reviews-info"> | |
<li itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> | |
<div class="info-left"> | |
<strong class="title"><?php _e('Reviews', 'entrada'); ?></strong> | |
<span class="value" itemprop="reviewCount"><?php $total_reviews = entrada_post_total_reviews( get_the_ID(), true ); printf( esc_html( _n( '%d Review', '%d Reviews', $total_reviews, 'entrada' ) ), $total_reviews ); ?></span> | |
</div> | |
<div class="info-right"> | |
<input class="average_rating" type="hidden" value="<?php echo $average_rating; ?>"> | |
<div class="star-rating"> | |
<div class="average_rateYo"></div> | |
</div> | |
<span class="value" itemprop="ratingValue"><?php echo sprintf( __( '%1$d/%2$d', 'entrada' ), $average_rating, '5' ); ?></span> | |
</div> | |
</li> | |
<li> | |
<div class="info-left"> | |
<strong class="title"><?php _e('Vacation Style', 'entrada'); ?></strong> | |
<span class="value"><strong><?php _e('Holiday Type', 'entrada'); ?></strong></span> | |
</div> | |
<div class="info-right"> | |
<?php | |
/* Product Tag..... */ | |
$product_tag = wp_get_post_terms( get_the_ID(), 'product_tag' ) ; | |
if(count( $product_tag ) > 0) { | |
echo '<ul class="ico-list">'; | |
foreach( $product_tag as $term ) { | |
$icomoon_class = entrada_icomoon_class( $term->slug ); | |
if( !empty($icomoon_class) ) { | |
echo '<li class="pop-opener top"> | |
<span class="'.$icomoon_class.'"></span> | |
<div class="popup">'.ucwords( $term->name ).'</div> | |
</li>'; | |
} | |
} | |
echo '</ul>'; | |
} ?> | |
<span class="value"><?php echo entrada_product_holiday_types(get_the_ID(), false); ?></span> | |
</div> | |
</li> | |
<li> | |
<div class="info-left"> | |
<strong class="title"><?php _e('Activity Level', 'entrada'); ?></strong> | |
<span class="value"><?php echo entrada_product_activity_level( get_the_ID(), 'title', false ); ?></span> | |
</div> | |
<?php | |
$activity_level = entrada_product_activity_level( get_the_ID(), 'level', false ); | |
if(!empty($activity_level)) { ?> | |
<div class="info-right"> | |
<ul class="ico-list"> | |
<li><span class="icon-level<?php entrada_product_activity_level( get_the_ID(), 'level', true ); ?>"></span></li> | |
</ul> | |
<span class="value"><?php echo sprintf( __( '%1$d/%2$d', 'entrada' ), $activity_level, '8' ); ?></span> | |
</div> | |
<?php } ?> | |
</li> | |
<li> | |
<?php | |
$trip_group_size = get_post_meta(get_the_ID(), "trip_group_size", true); | |
$trip_group_size_capacity = get_post_meta(get_the_ID(), "trip_group_size_capacity", true); | |
if( !empty( $trip_group_size ) ) { | |
if( 'Small Group' == $trip_group_size ){ | |
$group_name = __( 'Small Group', 'entrada' ); | |
} | |
else if( 'Medium Group' == $trip_group_size ){ | |
$group_name = __( 'Medium Group', 'entrada' ); | |
} | |
else if( 'Large Group' == $trip_group_size ){ | |
$group_name = __( 'Large Group', 'entrada' ); | |
} ?> | |
<div class="info-left"> | |
<strong class="title"><?php _e('Group Size', 'entrada'); ?></strong> | |
<span class="value"><?php echo $group_name; ?></span> | |
</div> | |
<?php } ?> | |
<div class="info-right"> | |
<?php | |
$group_size_icon = entrada_product_group_size_icon(get_the_ID()); | |
if( !empty( $group_size_icon ) ) { | |
echo '<ul class="ico-list"><li>'.$group_size_icon.'</li></ul>'; | |
} ?> | |
<?php | |
if( !empty( $trip_group_size_capacity ) ){ | |
echo '<span class="value">'.$trip_group_size_capacity.'</span>'; | |
} ?> | |
</div> | |
</li> | |
<... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment