</div>
						</li>
						<?php 
    }
    ?>
					</ul>
				</div>							
			</div>
		</div>
		<?php 
    if ($show) {
        echo ob_get_clean();
    } else {
        ob_end_clean();
    }
    $shop = ThemexUser::getShop($post->post_author);
    if (!empty($shop)) {
        ThemexShop::refresh($shop);
        get_template_part('module', 'shop');
    }
    ThemexSidebar::renderSidebar('product');
    ?>
	</aside>
	<div class="item-full column eightcol last">
		<?php 
    do_action('woocommerce_single_product_summary');
    ?>
	</div>
	<div class="clear"></div>
	<?php 
    do_action('woocommerce_after_single_product_summary');
Example #2
0
 /**
  * Updates shipping rates
  *
  * @access public
  * @param array $rates
  * @param array $package
  * @return array
  */
 public static function updateShipping($rates, $package)
 {
     $products = $package['contents'];
     $product = reset($products);
     $total = $package['contents_cost'];
     $shipping = ThemexShop::getShipping(ThemexUser::getShop($product['data']->post->post_author));
     $country = '';
     if (isset($package['destination']) && isset($package['destination']['country'])) {
         $country = $package['destination']['country'];
     }
     if (!empty($rates)) {
         foreach ($rates as $key => $rate) {
             if (isset($shipping[$key])) {
                 $method = $shipping[$key];
                 $enabled = themex_value('enabled', $method);
                 $available = themex_value('availability', $method);
                 $amount = themex_value('min_amount', $method);
                 $countries = themex_array('countries', $method);
                 if ($enabled == 'no' || !empty($amount) && $total < $amount || $available == 'specific' && !in_array($country, $countries)) {
                     unset($rates[$key]);
                 } else {
                     if ($key == 'flat_rate') {
                         $default = intval(themex_value('default_cost', $method));
                         $costs = themex_array('costs', $method);
                         $cost = 0;
                         foreach ($products as $product) {
                             $classes = get_the_terms($product['product_id'], 'product_shipping_class');
                             if (is_array($classes) && !empty($classes)) {
                                 $class = reset($classes);
                                 $class = $class->slug;
                                 if (isset($costs[$class])) {
                                     $cost = $cost + intval($costs[$class]) * $product['quantity'];
                                 } else {
                                     $cost = $cost + $default * $product['quantity'];
                                 }
                             } else {
                                 $cost = $cost + $default * $product['quantity'];
                             }
                         }
                         $rates[$key]->cost = $cost;
                     }
                 }
             }
         }
     }
     return $rates;
 }
Example #3
0
wp_nonce_field('woocommerce-cart');
?>
						</td>
					</tr>
					<?php 
do_action('woocommerce_after_cart_contents');
?>
				</tbody>
			</table>
			<?php 
do_action('woocommerce_after_cart_table');
?>
		</form>
		<?php 
foreach ($cart as $author => $products) {
    $title = get_the_title(ThemexUser::getShop($author));
    ?>
		<div class="element-title indented">
			<h2><?php 
    echo __('Order from', 'woocommerce') . ' ' . $title;
    ?>
</h2>
		</div>
		<form action="<?php 
    echo esc_url(WC()->cart->get_cart_url());
    ?>
" method="POST">
			<table class="shop_table cart" cellspacing="0">
				<thead>
					<tr>					
						<th class="product-thumbnail">&nbsp;</th>
 /**
  * Updates shop rating
  *
  * @access public
  * @param int $ID
  * @return void
  */
 public static function updateRating($ID)
 {
     $rating = get_comment_meta($ID, 'rating', true);
     if (!empty($rating)) {
         $comment = get_comment($ID);
         $user = get_post_field('post_author', $comment->comment_post_ID);
         $shop = ThemexUser::getShop($user);
         $rating = ThemexWoo::getRating($user);
         ThemexCore::updatePostMeta($shop, 'rating', $rating['rating']);
         ThemexCore::updatePostMeta($shop, 'ratings', $rating['ratings']);
     }
 }