Advertisement
Guest User

Untitled

a guest
Aug 20th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.69 KB | None | 0 0
  1. <div class="content-pad single-event-meta">
  2. <?php
  3. $product_id = get_post_meta(get_the_ID(),'product_id', true );
  4. if($product_id == ''){$product_id = get_the_ID();}
  5. $layout_event = get_post_meta(get_the_ID(),'event-layout-header', true );
  6. if($layout_event=='def' || $layout_event==''){
  7. if(function_exists('cop_get')){
  8. $layout_event = cop_get('u_event_settings','u-event-layout-header');
  9. }
  10. }
  11.  
  12. if($layout_event!='feature-image'){?>
  13. <div class="item-thumbnail">
  14. <?php if(get_the_post_thumbnail( $product_id, 'thumb_263x263' )!=''){ echo get_the_post_thumbnail( $product_id, 'thumb_263x263' );}else{ echo get_the_post_thumbnail( get_the_ID(), 'thumb_263x263' );} ?>
  15. </div><!--/item-thumbnail-->
  16. <?php } if(has_excerpt( get_the_ID())&& $layout_event!='feature-image'){ ?>
  17. <div class="event-description">
  18. <?php echo get_the_excerpt(); ?>
  19. </div>
  20. <?php } else {?>
  21. <div class="event-description">
  22. <?php echo wp_trim_words(get_post_field('post_content', $product_id),50,$more = ''); ?>
  23. </div>
  24. <?php }?>
  25. <div class="event-action">
  26. <?php
  27. if(class_exists('U_event')){
  28. $u_event = new U_event;
  29. $price = $u_event->getPrice();
  30. $vailable = $u_event->getAvailable();
  31. }
  32. ?>
  33. <?php if($vailable == 'variable'){ ?>
  34. <form action="<?php get_permalink(get_the_ID()) ?>" method="POST">
  35. <div class="element-pad">
  36. <input type="hidden" name="event_action" value="add" />
  37. <label for="seat" class="small-text"><?php _e('CHOOSE YOUR SEAT','cactusthemes') ?></label>
  38. <?php
  39. if(function_exists('wc_get_product')){
  40. $product = wc_get_product($product_id);
  41. $price['text'] = $product->get_price_html();
  42. }
  43.  
  44. if(isset($product) && $product){?>
  45. <select id="event_variation" name="event_variation" class="form-control">
  46. <?php
  47.  
  48. $product_variations = $product->get_available_variations();
  49.  
  50. foreach($product_variations as $variation){
  51.  
  52. $attributes = array_values($variation['attributes']);
  53. $variation_name = implode(', ', $attributes);
  54. if(substr($variation_name, -2) === ', '){
  55. $variation_name = substr($variation_name, 0, strlen($variation_name) - 2);
  56. }
  57. ?>
  58. <option value="<?php echo $variation['variation_id']; ?>" class="<?php echo esc_html($variation['price_html']); ?>"><?php echo $variation_name; ?></option>
  59. <?php
  60. } ?>
  61. </select>
  62. <?php }
  63. ?>
  64. </div>
  65. <?php
  66. if(class_exists('Product_Addon_Display') && $product_id!=''){
  67. echo '<div class="element-pad">';
  68. $Product_Addon_Display = new Product_Addon_Display;
  69. echo $Product_Addon_Display->display($product_id);
  70. echo '</div>';
  71. }
  72. ?>
  73. <?php
  74. if ( shortcode_exists( 'currency_switcher' ) ) {
  75. ?>
  76. <div class="element-pad currency_switcher">
  77. <?php
  78. echo do_shortcode('[currency_switcher]');
  79. ?>
  80. </div>
  81. <?php
  82. }?>
  83. <div class="element-pad">
  84. <label for="quantity" class="small-text"><?php _e('NUMBER OF TICKETS','cactusthemes') ?></label>
  85. <div class="input-group quantity-group">
  86. <span class="input-group-btn">
  87. <button class="btn btn-primary btn-lg" id="minus" type="button">-</button>
  88. </span>
  89. <input class="quantity form-control" id="num" name="num_ticket" value="1" type="text" min="0" step="1" placeholder="0">
  90. <span class="input-group-btn">
  91. <button class="btn btn-primary btn-lg" id="plus" type="button">+</button>
  92. </span>
  93. </div>
  94. </div>
  95. <div class="element-pad">
  96. <div class="small-text"><?php _e('PRICE','cactusthemes') ?></div>
  97. <span class="price main-color-1" id="u-price"></span>
  98. </div>
  99. <?php
  100. if(method_exists($u_event,'ct_wc_disposit_form')){
  101. $u_event->ct_wc_disposit_form($product_id);
  102. }?>
  103. <div class="element-pad sold-out">
  104. <?php
  105. $stock_status = get_post_meta($product_id, '_stock_status',true);
  106. if($stock_status!='outofstock'){?>
  107. <a href="#" class="button medium price-button submit-button left" name="join_event">
  108. <button class="btn btn-primary btn-lg btn-block"><?php _e('JOIN THIS EVENT','cactusthemes') ?></button>
  109. </a>
  110. <?php }else{?>
  111. <span><?php _e('Sold Out','cactusthemes') ?></span>
  112. <?php }?>
  113. </div>
  114. </form>
  115. <?php } else if($vailable == 'simple'){?>
  116. <form action="<?php get_permalink(get_the_ID()) ?>" method="POST">
  117. <div class="element-pad">
  118. <input type="hidden" name="event_action" value="add" />
  119. </div>
  120. <?php
  121. if(class_exists('Product_Addon_Display') && $product_id!=''){
  122. echo '<div class="element-pad">';
  123. $Product_Addon_Display = new Product_Addon_Display;
  124. echo $Product_Addon_Display->display($product_id);
  125. echo '</div>';
  126. }
  127. ?>
  128. <?php
  129. if ( shortcode_exists( 'currency_switcher' ) ) {
  130. ?>
  131. <div class="element-pad currency_switcher">
  132. <?php
  133. echo do_shortcode('[currency_switcher]');
  134. ?>
  135. </div>
  136. <?php
  137. }?>
  138. <div class="element-pad">
  139. <label for="quantity" class="small-text"><?php _e('NUMBER OF TICKETS','cactusthemes') ?></label>
  140. <div class="input-group quantity-group">
  141. <span class="input-group-btn">
  142. <button class="btn btn-primary btn-lg" id="minus" type="button">-</button>
  143. </span>
  144. <input class="quantity form-control" id="num" name="num_ticket" value="1" type="text" min="0" step="1" placeholder="0">
  145. <span class="input-group-btn">
  146. <button class="btn btn-primary btn-lg" id="plus" type="button">+</button>
  147. </span>
  148. </div>
  149. </div>
  150. <div class="element-pad">
  151. <div class="small-text"><?php _e('PRICE','cactusthemes') ?></div>
  152. <span class="price main-color-1" id="u-price"><?php echo ($price['text']); ?></span>
  153. </div>
  154. <?php
  155. if(method_exists($u_event,'ct_wc_disposit_form')){
  156. $u_event->ct_wc_disposit_form($product_id);
  157. }?>
  158. <div class="element-pad sold-out">
  159. <?php
  160. $stock_status = get_post_meta($product_id, '_stock_status',true);
  161. if($stock_status!='outofstock'){?>
  162. <a href="#" class="button medium price-button submit-button left" name="join_event">
  163. <button class="btn btn-primary btn-lg btn-block btn-slg"><?php _e('BUY EXAM','cactusthemes') ?></button>
  164. </a>
  165. <?php }else{?>
  166. <span><?php _e('Sold Out','cactusthemes') ?></span>
  167. <?php }?>
  168. </div>
  169. </form>
  170. <?php } else {
  171. $u_linkssub = get_post_meta(get_the_ID(),'u-linkssub', true );
  172. if($u_linkssub){
  173. ?>
  174. <div class="element-pad">
  175. <a href="<?php echo $u_linkssub; ?>" class="button-link" target="_blank">
  176. <button class="btn btn-primary btn-lg btn-block btn-slg"><?php _e('JOIN THIS EVENT','cactusthemes') ?></button>
  177. </a>
  178. </div>
  179. <?php }}?>
  180. </div>
  181. <script >
  182. jQuery(document).ready(function($) {
  183. $("#plus").click(function(){
  184. var $this = $(this);
  185. var quantity = parseInt($("#num").val()) +1;
  186. $("#num").val(quantity);
  187. return false;
  188. });
  189. $("#minus").click(function(){
  190. var $this = $(this);
  191. if($("#num").val()>0){
  192. var quantity = parseInt($("#num").val()) -1;
  193. $("#num").val(quantity);
  194. }
  195. return false;
  196. });
  197. $("#u-price").html($("#event_variation").find('option:selected').attr("class"));
  198. $("#event_variation").change(function(){
  199. $("#u-price").html('');
  200. $("#u-price").html($(this).find('option:selected').attr("class"));
  201.  
  202. });
  203. });
  204. </script>
  205. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement