Advertisement
Guest User

wpsc-single_product.php

a guest
Mar 6th, 2012
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.94 KB | None | 0 0
  1. <?php
  2.     // Setup globals
  3.     // @todo: Get these out of template
  4.     global $wp_query;
  5.  
  6.     // Setup image width and height variables
  7.     // @todo: Investigate if these are still needed here
  8.     $image_width  = get_option( 'single_view_image_width' );
  9.     $image_height = get_option( 'single_view_image_height' );
  10. ?>
  11.  
  12. <div id="single_product_page_container">
  13.    
  14.     <?php
  15.         // Breadcrumbs
  16.         wpsc_output_breadcrumbs();
  17.  
  18.         // Plugin hook for adding things to the top of the products page, like the live search
  19.         do_action( 'wpsc_top_of_products_page' );
  20.     ?>
  21.    
  22.     <div class="single_product_display group">
  23. <?php
  24.         /**
  25.          * Start the product loop here.
  26.          * This is single products view, so there should be only one
  27.          */
  28.  
  29.         while ( wpsc_have_products() ) : wpsc_the_product(); ?>
  30.                     <div class="imagecol">
  31.                         <?php if ( wpsc_the_product_thumbnail() ) : ?>
  32.                                 <a rel="<?php echo wpsc_the_product_title(); ?>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo wpsc_the_product_image(); ?>">
  33.                                     <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(get_option('product_image_width'),get_option('product_image_height'),'','single'); ?>"/>
  34.                                 </a>
  35.                                 <?php
  36.                                 if ( function_exists( 'gold_shpcrt_display_gallery' ) )
  37.                                     echo gold_shpcrt_display_gallery( wpsc_the_product_id() );
  38.                                 ?>
  39.                         <?php else: ?>
  40.                                     <a href="<?php echo wpsc_the_product_permalink(); ?>">
  41.                                     <img class="no-image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="No Image" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo WPSC_CORE_THEME_URL; ?>wpsc-images/noimage.png" width="<?php echo get_option('product_image_width'); ?>" height="<?php echo get_option('product_image_height'); ?>" />
  42.                                     </a>
  43.                         <?php endif; ?>
  44.                     </div><!--close imagecol-->
  45.  
  46.                     <div class="productcol">           
  47.                         <?php do_action('wpsc_product_before_description', wpsc_the_product_id(), $wp_query->post); ?>
  48.                         <div class="product_description">
  49.                             <?php echo wpsc_the_product_description(); ?>
  50.                         </div><!--close product_description -->
  51.                         <?php do_action( 'wpsc_product_addons', wpsc_the_product_id() ); ?>    
  52.                         <?php if ( wpsc_the_product_additional_description() ) : ?>
  53.                             <div class="single_additional_description">
  54.                                 <p><?php echo wpsc_the_product_additional_description(); ?></p>
  55.                             </div><!--close single_additional_description-->
  56.                         <?php endif; ?>    
  57.                         <?php do_action( 'wpsc_product_addon_after_descr', wpsc_the_product_id() ); ?>
  58.                         <?php
  59.                         /**
  60.                          * Custom meta HTML and loop
  61.                          */
  62.                         ?>
  63.                         <?php if (wpsc_have_custom_meta()) : ?>
  64.                         <div class="custom_meta">
  65.                             <?php while ( wpsc_have_custom_meta() ) : wpsc_the_custom_meta(); ?>
  66.                                 <strong><?php echo wpsc_custom_meta_name(); ?>: </strong><?php echo wpsc_custom_meta_value(); ?><br />
  67.                             <?php endwhile; ?>
  68.                         </div><!--close custom_meta-->
  69.                         <?php endif; ?>
  70.                         <?php
  71.                         /**
  72.                          * Form data
  73.                          */
  74.                         ?>
  75.                        
  76.                         <form class="product_form" enctype="multipart/form-data" action="<?php echo wpsc_this_page_url(); ?>" method="post" name="1" id="product_<?php echo wpsc_the_product_id(); ?>">
  77.                             <?php do_action ( 'wpsc_product_form_fields_begin' ); ?>
  78.                             <?php if ( wpsc_product_has_personal_text() ) : ?>
  79.                                 <fieldset class="custom_text">
  80.                                     <legend><?php _e( 'Personalize Your Product', 'wpsc' ); ?></legend>
  81.                                     <p><?php _e( 'Complete this form to include a personalized message with your purchase.', 'wpsc' ); ?></p>
  82.                                     <textarea cols='55' rows='5' name="custom_text"></textarea>
  83.                                 </fieldset>
  84.                             <?php endif; ?>
  85.                        
  86.                             <?php if ( wpsc_product_has_supplied_file() ) : ?>
  87.  
  88.                                 <fieldset class="custom_file">
  89.                                     <legend><?php _e( 'Upload a File', 'wpsc' ); ?></legend>
  90.                                     <p><?php _e( 'Select a file from your computer to include with this purchase.', 'wpsc' ); ?></p>
  91.                                     <input type="file" name="custom_file" />
  92.                                 </fieldset>
  93.                             <?php endif; ?>
  94.                         <?php /** the variation group HTML and loop */?>
  95.                         <?php if (wpsc_have_variation_groups()) { ?>
  96.                         <fieldset><legend><?php _e('Product Options', 'wpsc'); ?></legend>
  97.                         <div class="wpsc_variation_forms">
  98.                             <table>
  99.                             <?php while (wpsc_have_variation_groups()) : wpsc_the_variation_group(); ?>
  100.                                 <tr><td class="col1"><label for="<?php echo wpsc_vargrp_form_id(); ?>"><?php echo wpsc_the_vargrp_name(); ?>:</label></td>
  101.                                 <?php /** the variation HTML and loop */?>
  102.                                 <td class="col2"><select class="wpsc_select_variation" name="variation[<?php echo wpsc_vargrp_id(); ?>]" id="<?php echo wpsc_vargrp_form_id(); ?>">
  103.                                 <?php while (wpsc_have_variations()) : wpsc_the_variation(); ?>
  104.                                     <option value="<?php echo wpsc_the_variation_id(); ?>" <?php echo wpsc_the_variation_out_of_stock(); ?>><?php echo wpsc_the_variation_name(); ?></option>
  105.                                 <?php endwhile; ?>
  106.                                 </select></td></tr>
  107.                             <?php endwhile; ?>
  108.                             </table>
  109.                         </div><!--close wpsc_variation_forms-->
  110.                         </fieldset>
  111.                         <?php } ?>
  112.                         <?php /** the variation group HTML and loop ends here */?>
  113.  
  114.                             <?php
  115.                             /**
  116.                              * Quantity options - MUST be enabled in Admin Settings
  117.                              */
  118.                             ?>
  119.                             <?php if(wpsc_has_multi_adding()): ?>
  120.                                 <fieldset><legend><?php _e('Quantity', 'wpsc'); ?></legend>
  121.                                 <div class="wpsc_quantity_update">
  122.                                 <input type="text" id="wpsc_quantity_update_<?php echo wpsc_the_product_id(); ?>" name="wpsc_quantity_update" size="2" value="1" />
  123.                                 <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
  124.                                 <input type="hidden" name="wpsc_update_quantity" value="true" />
  125.                                 </div><!--close wpsc_quantity_update-->
  126.                                 </fieldset>
  127.                             <?php endif ;?>
  128.                             <div class="wpsc_product_price">
  129.                                 <?php if(wpsc_show_stock_availability()): ?>
  130.                                     <?php if(wpsc_product_has_stock()) : ?>
  131.                                         <div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="in_stock"><?php _e('Product in stock', 'wpsc'); ?></div>
  132.                                     <?php else: ?>
  133.                                         <div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="out_of_stock"><?php _e('Product not in stock', 'wpsc'); ?></div>
  134.                                     <?php endif; ?>
  135.                                 <?php endif; ?>
  136.                                 <?php if(wpsc_product_is_donation()) : ?>
  137.                                     <label for="donation_price_<?php echo wpsc_the_product_id(); ?>"><?php _e('Donation', 'wpsc'); ?>: </label>
  138.                                     <input type="text" id="donation_price_<?php echo wpsc_the_product_id(); ?>" name="donation_price" value="<?php echo wpsc_calculate_price(wpsc_the_product_id()); ?>" size="6" />
  139.                                 <?php else : ?>
  140.                                     <?php if(wpsc_product_on_special()) : ?>
  141.                                         <p class="pricedisplay <?php echo wpsc_the_product_id(); ?>"><?php _e('Old Price', 'wpsc'); ?>: <span class="oldprice" id="old_product_price_<?php echo wpsc_the_product_id(); ?>"><?php echo wpsc_product_normal_price(); ?></span></p>
  142.                                     <?php endif; ?>
  143.                                     <p class="pricedisplay <?php echo wpsc_the_product_id(); ?>"><?php _e('Price', 'wpsc'); ?>: <span id='product_price_<?php echo wpsc_the_product_id(); ?>' class="currentprice pricedisplay"><?php echo wpsc_the_product_price(); ?></span></p>
  144.                                     <?php if(wpsc_product_on_special()) : ?>
  145.                                         <p class="pricedisplay product_<?php echo wpsc_the_product_id(); ?>"><?php _e('You save', 'wpsc'); ?>: <span class="yousave" id="yousave_<?php echo wpsc_the_product_id(); ?>"><?php echo wpsc_currency_display(wpsc_you_save('type=amount'), array('html' => false)); ?>! (<?php echo wpsc_you_save(); ?>%)</span></p>
  146.                                     <?php endif; ?>
  147.                                      <!-- multi currency code -->
  148.                                     <?php if(wpsc_product_has_multicurrency()) : ?>
  149.                                         <?php echo wpsc_display_product_multicurrency(); ?>
  150.                                     <?php endif; ?>
  151.                                     <?php if(wpsc_show_pnp()) : ?>
  152.                                         <p class="pricedisplay"><?php _e('Shipping', 'wpsc'); ?>:<span class="pp_price"><?php echo wpsc_product_postage_and_packaging(); ?></span></p>
  153.                                     <?php endif; ?>                        
  154.                                 <?php endif; ?>
  155.                             </div><!--close wpsc_product_price-->
  156.                             <!--sharethis-->
  157.                             <?php if ( get_option( 'wpsc_share_this' ) == 1 ): ?>
  158.                             <div class="st_sharethis" displayText="ShareThis"></div>
  159.                             <?php endif; ?>
  160.                             <!--end sharethis-->
  161.                             <input type="hidden" value="add_to_cart" name="wpsc_ajax_action" />
  162.                             <input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="product_id" />                 
  163.                             <?php if( wpsc_product_is_customisable() ) : ?>
  164.                                 <input type="hidden" value="true" name="is_customisable"/>
  165.                             <?php endif; ?>
  166.                    
  167.                             <?php
  168.                             /**
  169.                              * Cart Options
  170.                              */
  171.                             ?>
  172.  
  173.                             <?php if((get_option('hide_addtocart_button') == 0) &&  (get_option('addtocart_or_buynow') !='1')) : ?>
  174.                                 <?php if(wpsc_product_has_stock()) : ?>
  175.                                     <div class="wpsc_buy_button_container">
  176.                                             <?php if(wpsc_product_external_link(wpsc_the_product_id()) != '') : ?>
  177.                                             <?php $action = wpsc_product_external_link( wpsc_the_product_id() ); ?>
  178.                                             <input class="wpsc_buy_button" type="submit" value="<?php echo wpsc_product_external_link_text( wpsc_the_product_id(), __( 'Buy Now', 'wpsc' ) ); ?>" onclick="return gotoexternallink('<?php echo $action; ?>', '<?php echo wpsc_product_external_link_target( wpsc_the_product_id() ); ?>')">
  179.                                             <?php else: ?>
  180.                                         <input type="submit" value="<?php _e('Add To Cart', 'wpsc'); ?>" name="Buy" class="wpsc_buy_button" id="product_<?php echo wpsc_the_product_id(); ?>_submit_button"/>
  181.                                             <?php endif; ?>
  182.                                         <div class="wpsc_loading_animation">
  183.                                             <img title="Loading" alt="Loading" src="<?php echo wpsc_loading_animation_url(); ?>" />
  184.                                             <?php _e('Updating cart...', 'wpsc'); ?>
  185.                                         </div><!--close wpsc_loading_animation-->
  186.                                     </div><!--close wpsc_buy_button_container-->
  187.                                 <?php else : ?>
  188.                                     <p class="soldout"><?php _e('This product has sold out.', 'wpsc'); ?></p>
  189.                                 <?php endif ; ?>
  190.                             <?php endif ; ?>
  191.                             <?php do_action ( 'wpsc_product_form_fields_end' ); ?>
  192.                         </form><!--close product_form-->
  193.                    
  194.                         <?php
  195.                             if ( (get_option( 'hide_addtocart_button' ) == 0 ) && ( get_option( 'addtocart_or_buynow' ) == '1' ) )
  196.                                 echo wpsc_buy_now_button( wpsc_the_product_id() );
  197.                    
  198.                             echo wpsc_product_rater();
  199.  
  200.                             echo wpsc_also_bought( wpsc_the_product_id() );
  201.                        
  202.                         if(wpsc_show_fb_like()): ?>
  203.                             <div class="FB_like">
  204.                             <iframe src="https://www.facebook.com/plugins/like.php?href=<?php echo wpsc_the_product_permalink(); ?>&amp;layout=standard&amp;show_faces=true&amp;width=435&amp;action=like&amp;font=arial&amp;colorscheme=light" frameborder="0"></iframe>
  205.                             </div><!--close FB_like-->
  206.                         <?php endif; ?>
  207.                     </div><!--close productcol-->
  208.        
  209.                     <form onsubmit="submitform(this);return false;" action="<?php echo wpsc_this_page_url(); ?>" method="post" name="product_<?php echo wpsc_the_product_id(); ?>" id="product_extra_<?php echo wpsc_the_product_id(); ?>">
  210.                         <input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="prodid"/>
  211.                         <input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="item"/>
  212.                     </form>
  213.         </div><!--close single_product_display-->
  214.        
  215.         <?php echo wpsc_product_comments(); ?>
  216.  
  217. <?php endwhile;
  218.  
  219.     do_action( 'wpsc_theme_footer' ); ?>    
  220.  
  221. </div><!--close single_product_page_container-->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement