PageRenderTime 27ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/3.7.6beta3/themes/default/products_page.php

https://github.com/evadne/wp-e-commerce
PHP | 280 lines | 238 code | 39 blank | 3 comment | 60 complexity | 22fcf08a4400a3e999a8b1fffaf88c62 MD5 | raw file
  1. <?php
  2. global $wpsc_query, $wpdb;
  3. /*
  4. * Most functions called in this page can be found in the wpsc_query.php file
  5. */
  6. ?>
  7. <div id='products_page_container' class="wrap wpsc_container">
  8. <?php if(wpsc_has_breadcrumbs()) : ?>
  9. <div class='breadcrumb'>
  10. <a href='<?php echo get_option('home'); ?>'><?php echo get_option('blogname'); ?></a> &raquo;
  11. <?php while (wpsc_have_breadcrumbs()) : wpsc_the_breadcrumb(); ?>
  12. <?php if(wpsc_breadcrumb_url()) :?>
  13. <a href='<?php echo wpsc_breadcrumb_url(); ?>'><?php echo wpsc_breadcrumb_name(); ?></a> &raquo;
  14. <?php else: ?>
  15. <?php echo wpsc_breadcrumb_name(); ?>
  16. <?php endif; ?>
  17. <?php endwhile; ?>
  18. </div>
  19. <?php endif; ?>
  20. <?php do_action('wpsc_top_of_products_page'); // Plugin hook for adding things to the top of the products page, like the live search ?>
  21. <?php if(wpsc_display_categories()): ?>
  22. <?php if(get_option('wpsc_category_grid_view') == 1) :?>
  23. <div class='wpsc_categories wpsc_category_grid'>
  24. <?php wpsc_start_category_query(array('category_group'=> get_option('wpsc_default_category'), 'show_thumbnails'=> 1)); ?>
  25. <a href="<?php wpsc_print_category_url();?>" class="wpsc_category_grid_item" title='<?php wpsc_print_category_name();?>'>
  26. <?php wpsc_print_category_image(45, 45); ?>
  27. </a>
  28. <?php wpsc_print_subcategory("", ""); ?>
  29. <?php wpsc_end_category_query(); ?>
  30. <div class='clear_category_group'></div>
  31. </div>
  32. <?php else:?>
  33. <ul class='wpsc_categories'>
  34. <?php wpsc_start_category_query(array('category_group'=>get_option('wpsc_default_category'), 'show_thumbnails'=> get_option('show_category_thumbnails'))); ?>
  35. <li>
  36. <?php wpsc_print_category_image(32, 32); ?>
  37. <a href="<?php wpsc_print_category_url();?>" class="wpsc_category_link"><?php wpsc_print_category_name();?></a>
  38. <?php if(get_option('wpsc_category_description')) :?>
  39. <?php wpsc_print_category_description("<div class='wpsc_subcategory'>", "</div>"); ?>
  40. <?php endif;?>
  41. <?php wpsc_print_subcategory("<ul>", "</ul>"); ?>
  42. </li>
  43. <?php wpsc_end_category_query(); ?>
  44. </ul>
  45. <?php endif; ?>
  46. <?php endif; ?>
  47. <?php if(wpsc_display_products()): ?>
  48. <?php if(wpsc_is_in_category()) : ?>
  49. <div class='wpsc_category_details'>
  50. <?php if(get_option('show_category_thumbnails') && wpsc_category_image()) : ?>
  51. <img src='<?php echo wpsc_category_image(); ?>' alt='<?php echo wpsc_category_name(); ?>' title='<?php echo wpsc_category_name(); ?>' />
  52. <?php endif; ?>
  53. <?php if(get_option('wpsc_category_description') && wpsc_category_description()) : ?>
  54. <?php echo wpsc_category_description(); ?>
  55. <?php endif; ?>
  56. </div>
  57. <?php endif; ?>
  58. <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
  59. <div class='wpsc_page_numbers'>
  60. <?php
  61. echo $wpsc_query->pagination($wpsc_query->page_count, $wpsc_query->prodcuts_per_page(), $wpsc_query->query_vars['page'],$wpsc_query->a_page_url());
  62. ?>
  63. </div>
  64. <?php endif; ?>
  65. <?php /** start the product loop here */?>
  66. <?php while (wpsc_have_products()) : wpsc_the_product(); ?>
  67. <?php if(wpsc_category_transition()) :?>
  68. <h3 class='wpsc_category_boundary'>
  69. <?php echo wpsc_current_category_name(); ?>
  70. </h3>
  71. <?php endif; ?>
  72. <div class="productdisplay default_product_display product_view_<?php echo wpsc_the_product_id(); ?> <?php echo wpsc_category_class(); ?>">
  73. <div class="textcol">
  74. <?php if(get_option('show_thumbnails')) :?>
  75. <div class="imagecol">
  76. <?php if(wpsc_the_product_thumbnail()) :?>
  77. <a rel="<?php echo str_replace(array(" ", '"',"'", '&quot;','&#039;'), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="thickbox preview_link" href="<?php echo wpsc_the_product_image(); ?>">
  78. <img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>"/>
  79. </a>
  80. <?php else: ?>
  81. <div class="item_no_image">
  82. <a href="<?php echo wpsc_the_product_permalink(); ?>">
  83. <span>No Image Available</span>
  84. </a>
  85. </div>
  86. <?php endif; ?>
  87. </div>
  88. <?php endif; ?>
  89. <div class="producttext">
  90. <h2 class="prodtitles">
  91. <?php if(get_option('hide_name_link') == 1) : ?>
  92. <span><?php echo wpsc_the_product_title(); ?></span>
  93. <?php else: ?>
  94. <a class="wpsc_product_title" href="<?php echo wpsc_the_product_permalink(); ?>"><?php echo wpsc_the_product_title(); ?></a>
  95. <?php endif; ?>
  96. <?php echo wpsc_edit_the_product_link(); ?>
  97. </h2>
  98. <?php
  99. do_action('wpsc_product_before_description', wpsc_the_product_id(), $wpsc_query->product);
  100. do_action('wpsc_product_addons', wpsc_the_product_id());
  101. ?>
  102. <div class='wpsc_description'><?php echo wpsc_the_product_description(); ?></div>
  103. <?php if(wpsc_the_product_additional_description()) : ?>
  104. <div class='additional_description_span'>
  105. <a href='<?php echo wpsc_the_product_permalink(); ?>' class='additional_description_link'>
  106. <img class='additional_description_button' src='<?php echo WPSC_URL; ?>/images/icon_window_expand.gif' title='Additional Description' alt='Additional Description' /><?php echo __('More Details', 'wpsc'); ?>
  107. </a>
  108. <div class='additional_description'>
  109. <?php
  110. $value = '';
  111. $the_addl_desc = wpsc_the_product_additional_description();
  112. if( is_serialized($the_addl_desc) ) {
  113. $addl_descriptions = @unserialize($the_addl_desc);
  114. } else {
  115. $addl_descriptions = array('addl_desc'=> $the_addl_desc);
  116. }
  117. if( isset($addl_descriptions['addl_desc']) ) {
  118. $value = $addl_descriptions['addl_desc'];
  119. }
  120. if( function_exists('wpsc_addl_desc_show') ) {
  121. echo wpsc_addl_desc_show( $addl_descriptions );
  122. } else {
  123. echo stripslashes( wpautop($the_addl_desc, $br=1));
  124. }
  125. ?>
  126. </div>
  127. <br />
  128. </div>
  129. <?php endif; ?>
  130. <?php if(wpsc_product_external_link(wpsc_the_product_id()) != '') : ?>
  131. <?php $action = wpsc_product_external_link(wpsc_the_product_id()); ?>
  132. <?php else: ?>
  133. <?php $action = htmlentities(wpsc_this_page_url(),ENT_QUOTES); ?>
  134. <?php endif; ?>
  135. <form class='product_form' enctype="multipart/form-data" action="<?php echo $action; ?>" method="post" name="product_<?php echo wpsc_the_product_id(); ?>" id="product_<?php echo wpsc_the_product_id(); ?>" >
  136. <?php do_action('wpsc_product_addon_after_descr', wpsc_the_product_id()); ?>
  137. <?php /** the custom meta HTML and loop */?>
  138. <div class="custom_meta">
  139. <?php while (wpsc_have_custom_meta()) : wpsc_the_custom_meta();
  140. if (stripos(wpsc_custom_meta_name(),'g:') !== FALSE){
  141. continue;
  142. }
  143. ?>
  144. <strong><?php echo wpsc_custom_meta_name(); ?>: </strong><?php echo wpsc_custom_meta_value(); ?><br />
  145. <?php endwhile; ?>
  146. </div>
  147. <?php /** the custom meta HTML and loop ends here */?>
  148. <?php /** add the comment link here */?>
  149. <?php echo wpsc_product_comment_link(); ?>
  150. <?php /** the variation group HTML and loop */?>
  151. <div class="wpsc_variation_forms">
  152. <?php while (wpsc_have_variation_groups()) : wpsc_the_variation_group(); ?>
  153. <p>
  154. <label for="<?php echo wpsc_vargrp_form_id(); ?>"><?php echo wpsc_the_vargrp_name(); ?>:</label>
  155. <?php /** the variation HTML and loop */?>
  156. <select class='wpsc_select_variation' name="variation[<?php echo wpsc_vargrp_id(); ?>]" id="<?php echo wpsc_vargrp_form_id(); ?>">
  157. <?php while (wpsc_have_variations()) : wpsc_the_variation(); ?>
  158. <option value="<?php echo wpsc_the_variation_id(); ?>" <?php echo wpsc_the_variation_out_of_stock(); ?> ><?php echo wpsc_the_variation_name(); ?></option>
  159. <?php endwhile; ?>
  160. </select>
  161. </p>
  162. <?php endwhile; ?>
  163. </div>
  164. <?php /** the variation group HTML and loop ends here */?>
  165. <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
  166. <?php if(wpsc_has_multi_adding()): ?>
  167. <label class='wpsc_quantity_update' for='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
  168. <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update" size="2" value="1"/>
  169. <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
  170. <input type="hidden" name="wpsc_update_quantity" value="true"/>
  171. <?php endif ;?>
  172. <p class="wpsc_extras_forms"/>
  173. <div class="wpsc_product_price">
  174. <?php if(wpsc_product_is_donation()) : ?>
  175. <label for='donation_price_<?php echo wpsc_the_product_id(); ?>'><?php echo __('Donation', 'wpsc'); ?>:</label>
  176. <input type='text' id='donation_price_<?php echo wpsc_the_product_id(); ?>' name='donation_price' value='<?php echo $wpsc_query->product['price']; ?>' size='6' />
  177. <br />
  178. <?php else : ?>
  179. <?php if(wpsc_product_on_special()) : ?>
  180. <span class='oldprice'><?php echo __('Price', 'wpsc'); ?>: <?php echo wpsc_product_normal_price(); ?></span><br />
  181. <?php endif; ?>
  182. <span id="product_price_<?php echo wpsc_the_product_id(); ?>" class="pricedisplay"><?php echo wpsc_the_product_price(); ?></span><?php echo __('Price', 'wpsc'); ?>: <br/>
  183. <?php if(get_option('display_pnp') == 1) : ?>
  184. <span class="pricedisplay"><?php echo wpsc_product_postage_and_packaging(); ?></span><?php echo __('P&amp;P', 'wpsc'); ?>: <br />
  185. <?php endif; ?>
  186. <?php endif; ?>
  187. </div>
  188. <input type="hidden" value="add_to_cart" name="wpsc_ajax_action"/>
  189. <input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="product_id"/>
  190. <!-- END OF QUANTITY OPTION -->
  191. <?php if((get_option('hide_addtocart_button') == 0) && (get_option('addtocart_or_buynow') !='1')) : ?>
  192. <?php if(wpsc_product_has_stock()) : ?>
  193. <div class='wpsc_buy_button_container'>
  194. <?php if(wpsc_product_external_link(wpsc_the_product_id()) != '') : ?>
  195. <?php $action = wpsc_product_external_link(wpsc_the_product_id()); ?>
  196. <input class="wpsc_buy_button" type='button' value='<?php echo __('Buy Now', 'wpsc'); ?>' onclick='gotoexternallink("<?php echo $action; ?>")'>
  197. <?php else: ?>
  198. <input type="submit" value="<?php echo __('Add To Cart', 'wpsc'); ?>" name="Buy" class="wpsc_buy_button" id="product_<?php echo wpsc_the_product_id(); ?>_submit_button"/>
  199. <?php endif; ?>
  200. <div class='wpsc_loading_animation'>
  201. <img title="Loading" alt="Loading" src="<?php echo WPSC_URL; ?>/images/indicator.gif" class="loadingimage"/>
  202. <?php echo __('Updating cart...', 'wpsc'); ?>
  203. </div>
  204. </div>
  205. <?php else : ?>
  206. <p class='soldout'><?php echo __('This product has sold out.', 'wpsc'); ?></p>
  207. <?php endif ; ?>
  208. <?php endif ; ?>
  209. </form>
  210. <?php if((get_option('hide_addtocart_button') == 0) && (get_option('addtocart_or_buynow')=='1')) : ?>
  211. <?php echo wpsc_buy_now_button(wpsc_the_product_id()); ?>
  212. <?php endif ; ?>
  213. <?php echo wpsc_product_rater(); ?>
  214. <?php
  215. if(function_exists('gold_shpcrt_display_gallery')) :
  216. echo gold_shpcrt_display_gallery(wpsc_the_product_id(), true);
  217. endif;
  218. ?>
  219. </div>
  220. </div>
  221. </div>
  222. <?php endwhile; ?>
  223. <?php /** end the product loop here */?>
  224. <?php if(wpsc_product_count() < 1):?>
  225. <p><?php echo __('There are no products in this group.', 'wpsc'); ?></p>
  226. <?php endif ; ?>
  227. <?php
  228. if(function_exists('fancy_notifications')) {
  229. echo fancy_notifications();
  230. }
  231. ?>
  232. <?php //exit('<pre>'.print_r($wpsc_query->a_page_url(),true).'</pre>'); ?>
  233. <?php if(wpsc_has_pages() && ((get_option('wpsc_page_number_position') == 2) || (get_option('wpsc_page_number_position') == 3))) : ?>
  234. <div class='wpsc_page_numbers'>
  235. <?php
  236. echo $wpsc_query->pagination($wpsc_query->page_count, $wpsc_query->prodcuts_per_page(), $wpsc_query->query_vars['page'],$wpsc_query->a_page_url());
  237. ?>
  238. </div>
  239. <?php endif; ?>
  240. <?php endif; ?>
  241. </div>