Advertisement
Guest User

wpsc-single_product.php

a guest
Mar 2nd, 2012
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.86 KB | None | 0 0
  1. <?php
  2. global $wpsc_query, $wpdb;
  3. $image_width = get_option('single_view_image_width');
  4. $image_height = get_option('single_view_image_height');
  5. $imagecolwidth = $image_width + 15;
  6. ?>
  7. <h1 class="prodtitles"><?php echo wpsc_the_product_title(); ?></h1>
  8.  
  9. <div id='products_page_container' class="wrap wpsc_container">
  10. <div id="page-container">
  11.     <?php if(wpsc_has_breadcrumbs()) :?>
  12.         <div class='breadcrumb'>
  13.             <a href='<?php echo get_option('product_list_url'); ?>'><?php echo get_option('blogname'); ?></a> &raquo;
  14.             <?php while (wpsc_have_breadcrumbs()) : wpsc_the_breadcrumb(); ?>
  15.                 <?php if(wpsc_breadcrumb_url()) :?>        
  16.                     <a href='<?php echo wpsc_breadcrumb_url(); ?>'><?php echo wpsc_breadcrumb_name(); ?></a> &raquo;
  17.                 <?php else: ?>
  18.                     <?php echo wpsc_breadcrumb_name(); ?>
  19.                 <?php endif; ?>
  20.             <?php endwhile; ?>
  21.         </div>
  22.     <?php endif; ?>
  23.    
  24.     <?php do_action('wpsc_top_of_products_page'); // Plugin hook for adding things to the top of the products page, like the live search ?>
  25.    
  26.     <div class="productdisplay">
  27.     <?php /** start the product loop here, this is single products view, so there should be only one */?>
  28.         <?php while (wpsc_have_products()) :  wpsc_the_product(); ?>
  29.             <div class="single_product_display product_view_<?php echo wpsc_the_product_id(); ?>">
  30.                 <?php if(get_option('show_thumbnails')) :?>
  31.                 <div class="imagecol" style="max-width:<?php echo $imagecolwidth;?>px;">
  32.                     <?php if(wpsc_the_product_thumbnail()) :?>
  33.                             <a class="thickbox preview_link" href="<?php echo wpsc_the_product_image(); ?>" rel="productgallery">
  34.                                 <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($image_width, $image_height); ?>" />
  35.                             </a>
  36.                     <?php else: ?>
  37.                         <div class="item_no_image">
  38.                             <a style="width:<?php echo $image_width;?>px;height:<?php echo $image_height;?>px;" href="<?php echo wpsc_the_product_permalink(); ?>">
  39.                             <span>No Image Available</span>
  40.                             </a>
  41.                         </div>
  42.                     <?php endif; ?>
  43.                    
  44.                     <div id="sft-single-product-gallery">
  45.                     <?php /*?><style type="text/css">div.single_product_display div.textcol div.imagecol a img.gallery {width:auto;height:auto;max-width:<?php if(isset($thumbwidth)){echo $thumbwidth."px";}?>;}</style><?php */?>
  46.                     <?php
  47.                         $featured_image = get_post_thumbnail_id();
  48.                         $args = array( 'post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image' ,'post_status' => null, 'post_parent' => $post->ID, 'exclude' => $featured_image,'numberposts' => 0);
  49.                         $attachments = get_posts($args);
  50.                         $numposts = count($attachments);
  51.                         $roundheight = round($numposts / 2);
  52.                         $thumbwidth = $image_width / 2 - 12;
  53.                         $galleryheight = $roundheight * $thumbwidth + 85 + $image_height;
  54.                         if ($attachments) {$i = 0;
  55.                         foreach ( $attachments as $attachment ) {$i++;
  56.                         $thumbnail = wp_get_attachment_url( $attachment->ID , false );
  57.                         $image = vt_resize('', $thumbnail, $thumbwidth, $thumbwidth, true);
  58.                         ?>
  59.                        
  60. <?php /*?><style type="text/css">#sft-single-product-gallery img.gallery {max-width:<?php echo $thumbwidth;?>px!important;}</style><?php */?>
  61.                           <a rel="<?php echo str_replace(array(" ", '"',"'", '&quot;','&#039;'), array("_", "", "", "",''), wpsc_the_product_title()); ?>" class="thickbox" href="<?php echo wp_get_attachment_url( $attachment->ID , false ); ?>"><img class="gallery" src="<?php echo $image['url']; ?>" alt="<?php the_title(); ?>" style="width:<?php echo $thumbwidth;?>; height:<?php echo $thumbwidth;?>;" border="0" /></a>
  62.                     <?php   }
  63.                         } ?>
  64.                         <?php $imagecolheight = $thumbwidth * $i / 2 + $image_height + 50;?>
  65.                         <?php /*?><style type="text/css">
  66.                             div.single_product_display div.textcol {min-height:<?php echo $imagecolheight;?>px!important;}
  67.                             div.single_product_display {min-height:<?php echo $galleryheight;?>px!important;}
  68.                         </style><?php */?>
  69.                         <div class="clear"></div>
  70.                     </div><!-- /END SINGLE PRODUCT GALLERY -->
  71.                     <div class="clear"></div>
  72.                 </div>
  73.                 <?php endif; ?>
  74.                 <div class="text-col">
  75.                     <div class="producttext">
  76.                             <?php              
  77.                                 do_action('wpsc_product_before_description', wpsc_the_product_id(), $wpsc_query->product);
  78.                             ?>
  79.                         <div class="wpsc_description"><?php echo wpsc_the_product_description(); ?></div>
  80.        
  81.                         <?php
  82.                             do_action('wpsc_product_addons', wpsc_the_product_id());
  83.                         ?>
  84.                
  85.                     <?php do_action('wpsc_product_addon_after_descr', wpsc_the_product_id()); ?>
  86.  
  87.  
  88.                    
  89.                     <?php
  90.                     // ##############################################################
  91.                     // ##                                                          ##
  92.                     // ## If price is set to £0.00 then display "Price on Request" ##
  93.                     // ##                                                          ##
  94.                     // ##############################################################
  95.                     if(price_on_request_check(wpsc_the_product_price(true), false, "", false) == true):
  96.                     ?>
  97.                     <div class="wpsc_request_product_price">
  98.                         <?php echo __('Price', 'wpsc'); ?>: <span id="product_price_<?php echo wpsc_the_product_id(); ?>" class="pricedisplay"><?php echo __('Price On Request', 'wpsc'); ?></span><br/>
  99.                         <?php price_on_request_check(wpsc_the_product_price(true), "form", wpsc_the_product_title()); ?>
  100.                     </div>
  101.                     <?php
  102.                     else:
  103.                     ?>
  104.                     <form class='product_form upload-file-form' enctype="multipart/form-data" action="<?php echo wpsc_this_page_url(); ?>" method="post" name="1" id="product_<?php echo wpsc_the_product_id(); ?>">
  105.                     <?php if(wpsc_product_has_personal_text()) : ?>
  106.                         <div class='custom_text storefront-single-product-section'>
  107.                             <h4><?php echo __('Personalize your product', 'wpsc'); ?></h4>
  108.                             <?php echo __('Complete this form to include a personalized message with your purchase.', 'wpsc'); ?><br />
  109.                             <input type='text' name='custom_text' value=''  />
  110.                         </div>
  111.                     <?php endif; ?>
  112.                    
  113.                     <?php if(wpsc_product_has_supplied_file()) : ?>
  114.                         <div class='custom_file storefront-single-product-section'>
  115.                             <strong><?php echo __('Upload a File', 'wpsc'); ?></strong>
  116.                             <div class="clear"></div>
  117.                             <?php echo __('Select a file from your computer to include with this purchase.  ', 'wpsc'); ?><br />
  118.                             <input type='file' name='custom_file' value=''  />
  119.                         </div>
  120.                     <?php endif; ?>
  121.                    
  122.                    
  123.                     <?php /** the variation group HTML and loop */?>
  124.                    
  125.                         <?php while (wpsc_have_variation_groups()) : wpsc_the_variation_group(); ?>
  126.                         <div class="wpsc_variation_forms">
  127.                             <p>
  128.                                 <label for="<?php echo wpsc_vargrp_form_id(); ?>"><?php echo wpsc_the_vargrp_name(); ?>:</label>
  129.                                 <?php /** the variation HTML and loop */?>
  130.                                 <select class='wpsc_select_variation' name="variation[<?php echo wpsc_vargrp_id(); ?>]" id="<?php echo wpsc_vargrp_form_id(); ?>">
  131.                                 <?php while (wpsc_have_variations()) : wpsc_the_variation(); ?>
  132.                                     <option value="<?php echo wpsc_the_variation_id(); ?>" <?php echo wpsc_the_variation_out_of_stock(); ?>><?php echo wpsc_the_variation_name() . " - " . wpsc_the_variation_price(); ?></option>
  133.                                 <?php endwhile; ?>
  134.                                 </select>
  135.                             </p>
  136.                         </div>
  137.                         <?php endwhile; ?>
  138.                        
  139.                     <?php /* Automatically select the first variation */ ?>
  140.                    
  141.                    
  142.                     <?php /** the variation group HTML and loop ends here */?>
  143.                                    
  144.                    
  145.                     <!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
  146.                     <?php if(wpsc_has_multi_adding()): ?>
  147.                         <fieldset>
  148.                         <label class='wpsc_quantity_update'><?php echo __('Quantity', 'wpsc'); ?>:</label>
  149.                        
  150.                         <input type="text" id='wpsc_quantity_update' name="wpsc_quantity_update[<?php echo wpsc_the_product_id(); ?>]" size="2" value="1"/>
  151.                         <input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
  152.                         <input type="hidden" name="wpsc_update_quantity" value="true"/>
  153.                         </fieldset>
  154.                     <?php endif ;?>
  155.                    
  156.                         <div class="wpsc_product_price">
  157.                        
  158.                         <?php if(wpsc_show_stock_availability()): ?>
  159.                                     <?php if(wpsc_product_has_stock()) : ?>
  160.                                         <div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="in_stock"><?php _e('Product in stock', 'wpsc'); ?></div>
  161.                                     <?php else: ?>
  162.                                         <div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="out_of_stock"><?php _e('Product not in stock', 'wpsc'); ?></div>
  163.                                     <?php endif; ?>
  164.                         <?php endif; ?>
  165.                        
  166.                             <?php if(wpsc_product_is_donation()) : ?>
  167.                                 <label for='donation_price_<?php echo wpsc_the_product_id(); ?>'><?php echo __('Donation', 'wpsc'); ?>:</label>
  168.                                 <input type='text' id='donation_price_<?php echo wpsc_the_product_id(); ?>' name='donation_price' value='<?php echo $wpsc_query->product['price']; ?>' size='6' />
  169.                                 <br />
  170.                            
  171.                            
  172.                             <?php else : ?>
  173.                                 <?php if(wpsc_product_on_special()) : ?>
  174.                                     <span class='oldprice'><?php echo __('Price', 'wpsc'); ?>: <?php echo wpsc_product_normal_price(); ?></span><br />
  175.                                 <?php endif; ?>
  176.                                 <?php echo __('Price', 'wpsc'); ?>: <span id="product_price_<?php echo wpsc_the_product_id(); ?>" class="pricedisplay"><?php echo wpsc_the_product_price(); ?></span><br/>
  177.                                 <!-- multi currency code -->
  178.                                 <?php if(wpsc_product_has_multicurrency()) : ?>
  179.                                 <?php echo wpsc_display_product_multicurrency(); ?>
  180.                                 <?php endif; ?>
  181.                                 <!-- end multi currency code -->
  182.                                 <?php if(get_option('display_pnp') == 1) : ?>
  183.                                     <?php echo __('P&amp;P', 'wpsc'); ?>: <span class="pricedisplay"><?php echo wpsc_product_postage_and_packaging(); ?></span><br />
  184.                                 <?php endif; ?>                        
  185.                             <?php endif; ?>
  186.                         </div>
  187.                     <?php if(function_exists('wpsc_akst_share_link') && (get_option('wpsc_share_this') == 1)) {
  188.                         echo wpsc_akst_share_link('return');
  189.                     } ?>
  190.                        
  191.                     <input type="hidden" value="add_to_cart" name="wpsc_ajax_action"/>
  192.                     <input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="product_id"/>
  193.                            
  194.                     <?php if(wpsc_product_is_customisable()) : ?>              
  195.                         <input type="hidden" value="true" name="is_customisable"/>
  196.                     <?php endif; ?>
  197.                    
  198.                    
  199.                     <!-- END OF QUANTITY OPTION -->
  200.                     <?php if((get_option('hide_addtocart_button') == 0) && (get_option('addtocart_or_buynow') !='1')) : ?>
  201.                         <?php if(wpsc_product_has_stock()) : ?>
  202.                             <?php if(wpsc_product_external_link(wpsc_the_product_id()) != '') : ?>
  203.                                         <?php   $action =  wpsc_product_external_link(wpsc_the_product_id()); ?>
  204.                                         <input class="wpsc_buy_button" type='button' value='<?php echo __('Buy Now', 'wpsc'); ?>' onclick='gotoexternallink("<?php echo $action; ?>")'>
  205.                                         <?php else: ?>
  206.                                     <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"/>
  207.                                         <?php endif; ?>
  208.                            
  209.                             <div class='wpsc_loading_animation'>
  210.                                 <img title="Loading" alt="Loading" src="<?php echo WPSC_URL ;?>/images/indicator.gif" class="loadingimage" />
  211.                                 <?php echo __('Updating cart...', 'wpsc'); ?>
  212.                             </div>
  213.                            
  214.                         <?php else : ?>
  215.                             <p class='soldout'><?php echo __('This product has sold out.', 'wpsc'); ?></p>
  216.                         <?php endif ; ?>
  217.                     <?php endif ; ?>
  218.                     </form>
  219.                    
  220.                     <?php if((get_option('hide_addtocart_button') == 0) && (get_option('addtocart_or_buynow')=='1')) : ?>
  221.                         <?php echo wpsc_buy_now_button(wpsc_the_product_id()); ?>
  222.                     <?php endif ; ?>
  223.                    
  224.                     <?php echo wpsc_product_rater(); ?>
  225.                        
  226.                        
  227.                     <?php
  228.                         if(function_exists('gold_shpcrt_display_gallery')) :                   
  229.                             echo gold_shpcrt_display_gallery(wpsc_the_product_id());
  230.                         endif;
  231.  
  232.                         //echo wpsc_also_bought(wpsc_the_product_id());
  233.                     ?>
  234.                     <?php
  235.                     endif;
  236.                     ?>
  237.                     </div>
  238.  
  239.                     <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(); ?>">
  240.                         <input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="prodid"/>
  241.                         <input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="item"/>
  242.                     </form>
  243.                    
  244.                     <?php
  245.                     $tags = get_the_product_tags(wpsc_the_product_id());
  246.                     if($tags !== false)
  247.                     {
  248.                         ?>
  249.                         <div id="product_tags" style="float:left; position:relative; width:100%; margin-top:20px;">
  250.                             <h4>Tags</h4>
  251.                             <?php
  252.                             foreach($tags as $tag)
  253.                             {
  254.                                 echo '<a href="' . get_bloginfo('url')."/tagged/". $tag->slug . '">' . $tag->name . "</a> ";
  255.                             }
  256.                             ?>
  257.                         </div>
  258.                         <?php
  259.                     }
  260.                     ?>
  261.                     <?php
  262.                     if(wpsc_show_fb_like()): ?>
  263.                             <div class="FB_like">
  264.                             <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>
  265.                             </div><!--close FB_like-->
  266.                         <?php endif; ?>
  267.                 </div>
  268.             </div>
  269.         </div>
  270.         <?php /*if ( get_option('storefront_product_comments') == "true" ) {comments_template();} else {*/comments_template();/*}*/ ?>
  271.         <?php if (get_option('storefront_product_comments') == "true") { echo "Comments are on!"; } ?>
  272. <?php endwhile; ?>
  273. <?php /** end the product loop here */?>
  274.  
  275.         <?php
  276.         if(function_exists('fancy_notifications')) {
  277.             echo fancy_notifications();
  278.         }
  279.         ?>
  280.    
  281. </div>
  282. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement