<?php woocommerce_content(); ?> </article> </div> <!-- /Main Side --> <?php if (is_single()) { $rehub_aff_post_ids = vp_metabox('rehub_framework_woo.review_woo_links'); if ($rehub_aff_post_ids != '') { echo '<div class="woo_sidebar_deals_links">'; woo_dealslinks_rehub(); echo '</div>'; } } ?> <!-- Sidebar --> <?php get_sidebar(); ?> <!-- /Sidebar --> </div> </div> <!-- /CONTENT --> <!-- FOOTER -->
function rehub_get_woo_offer($review_woo_link) { ?> <?php global $post; ?> <?php global $woocommerce; if ($woocommerce) { ?> <?php $args = array('post_type' => 'product', 'posts_per_page' => 1, 'no_found_rows' => 1, 'post_status' => 'publish', 'p' => $review_woo_link); ?> <?php $products = new WP_Query($args); if ($products->have_posts()) { ?> <?php while ($products->have_posts()) { $products->the_post(); global $product; ?> <?php $offer_price = $product->get_price_html(); ?> <?php $woolink = $product->product_type == 'external' ? $product->add_to_cart_url() : get_post_permalink(get_the_ID()); ?> <?php $offer_title = $product->get_title(); ?> <?php $attributes = $product->get_attributes(); ?> <?php if (rehub_option('rehub_btn_text') != '') { $btn_txt = rehub_option('rehub_btn_text'); } else { $btn_txt = __('Buy this item', 'rehub_framework'); } ?> <?php $gallery_images = $product->get_gallery_attachment_ids(); ?> <?php $woo_aff_links_inreview = vp_metabox('rehub_framework_woo.review_woo_links'); ?> <div class="rehub_woo_review"> <?php if (!empty($attributes) || !empty($gallery_images)) { ?> <ul class="rehub_woo_tabs_menu"> <li><?php _e('Product', 'rehub_framework'); ?> </li> <?php if (!empty($attributes)) { ?> <li><?php _e('Specification', 'rehub_framework'); ?> </li><?php } ?> <?php if (!empty($gallery_images)) { ?> <li><?php _e('Photos', 'rehub_framework'); ?> </li><?php } ?> <?php if (!empty($woo_aff_links_inreview)) { ?> <li class='woo_deals_tab'><?php _e('Deals', 'rehub_framework'); ?> </li><?php } ?> </ul> <?php } ?> <div class="rehub_feat_block table_view_block"> <div class="rehub_woo_review_tabs" style="display:table-row"> <div class="offer_thumb"> <a href="<?php echo $woolink; ?> " target="_blank"><?php wpsm_thumb('med_thumbs'); ?> </a> </div> <div class="desc_col"> <div class="offer_title"><a href="<?php echo $woolink; ?> " target="_blank"><?php echo esc_attr($offer_title); ?> </a></div> <p><?php kama_excerpt('maxchar=200'); ?> </p> <p> <?php if (in_array('yith-woocommerce-compare/init.php', apply_filters('active_plugins', get_option('active_plugins')))) { ?> <?php echo do_shortcode('[yith_compare_button]'); ?> <?php } ?> <?php if (in_array('yith-woocommerce-wishlist/init.php', apply_filters('active_plugins', get_option('active_plugins')))) { ?> <?php echo do_shortcode('[yith_wcwl_add_to_wishlist]'); ?> <?php } ?> </p> </div> <div class="buttons_col"> <div class="priced_block clearfix" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> <?php if (!empty($offer_price)) { ?> <p> <span itemprop="price" class="price_count"><?php echo $offer_price; ?> </span></p><?php } ?> <div> <?php if ($product->product_type == 'external' && $product->add_to_cart_url() == '' && !empty($woo_aff_links_inreview)) { ?> <a class='btn_offer_block choose_offer_woo' href="#"><?php _e('Prices', 'rehub_framework'); ?> </a> <?php } else { ?> <?php if ($product->is_in_stock() && $product->add_to_cart_url() != '') { ?> <?php echo apply_filters('woocommerce_loop_add_to_cart_link', sprintf('<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" class="btn_offer_block %s product_type_%s"%s>%s</a>', esc_url($product->add_to_cart_url()), esc_attr($product->id), esc_attr($product->get_sku()), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : 'add_to_cart_button', esc_attr($product->product_type), $product->product_type == 'external' ? ' target="_blank"' : '', esc_html($product->add_to_cart_text())), $product); ?> <?php } ?> <?php } ?> <?php $offer_coupon = get_post_meta(get_the_ID(), 'rehub_woo_coupon_code', true); ?> <?php $offer_coupon_date = get_post_meta(get_the_ID(), 'rehub_woo_coupon_date', true); ?> <?php $offer_coupon_mask = get_post_meta(get_the_ID(), 'rehub_woo_coupon_mask', true); ?> <?php $offer_coupon_url = esc_url($product->add_to_cart_url()); ?> <?php if (!empty($offer_coupon_date)) { ?> <?php $timestamp1 = strtotime($offer_coupon_date); $seconds = $timestamp1 - time(); $days = floor($seconds / 86400); $seconds %= 86400; if ($days > 0) { $coupon_text = $days . ' ' . __('days left', 'rehub_framework'); $coupon_style = ''; } elseif ($days == 0) { $coupon_text = __('Last day', 'rehub_framework'); $coupon_style = ''; } else { $coupon_text = __('Coupon is Expired', 'rehub_framework'); $coupon_style = 'expired_coupon'; } ?> <?php } ?> <?php if (!empty($offer_coupon)) { ?> <?php wp_enqueue_script('zeroclipboard'); ?> <?php if ($offer_coupon_mask != '1' && $offer_coupon_mask != 'on') { ?> <div class="rehub_offer_coupon not_masked_coupon <?php if (!empty($offer_coupon_date)) { echo $coupon_style; } ?> " data-clipboard-text="<?php echo $offer_coupon; ?> "><i class="fa fa-scissors fa-rotate-180"></i><span class="coupon_text"><?php echo $offer_coupon; ?> </span></div> <?php } else { ?> <div class="rehub_offer_coupon masked_coupon <?php if (!empty($offer_coupon_date)) { echo $coupon_style; } ?> " data-clipboard-text="<?php echo $offer_coupon; ?> " data-codeid="<?php echo $product->id; ?> " data-dest="<?php echo $offer_coupon_url; ?> "><?php if (rehub_option('rehub_mask_text') != '') { echo rehub_option('rehub_mask_text'); } else { _e('Reveal coupon', 'rehub_framework'); } ?> <i class="fa fa-external-link-square"></i></div> <?php } ?> <?php if (!empty($offer_coupon_date)) { echo '<div class="time_offer">' . $coupon_text . '</div>'; } ?> <?php } ?> </div> </div> </div> </div> <?php if (!empty($attributes)) { ?> <div class="rehub_woo_review_tabs"> <div><?php $product->list_attributes(); ?> </div> </div> <?php } ?> <?php if (!empty($gallery_images)) { ?> <script> jQuery(document).ready(function($) { 'use strict'; $('.rehub_woo_review .pretty_woo a').attr('rel', 'prettyPhoto[rehub_product_gallery]'); $(".rehub_woo_review .pretty_woo a[rel^='prettyPhoto']").prettyPhoto({social_tools:false}); }); </script> <div class="rehub_woo_review_tabs pretty_woo"> <?php wp_enqueue_script('prettyphoto'); foreach ($gallery_images as $gallery_img) { ?> <?php $thumbfull = wp_get_attachment_link($gallery_img, array(100, 100)); ?> <?php echo $thumbfull; ?> <?php } ?> </div> <?php } ?> <?php if (!empty($woo_aff_links_inreview)) { ?> <div class="rehub_woo_review_tabs"> <div class="woo_inreview_deals_links"><?php woo_dealslinks_rehub(); ?> </div> </div> <?php } ?> </div> </div> <div class="clearfix"></div> <?php } } wp_reset_postdata(); ?> <?php } ?> <?php }