tribulant

Products List

Sep 2nd, 2011
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 23.80 KB | None | 0 0
  1. <?php if (!empty($searchterm)) : ?>
  2.     <p>Search results for "<strong><?php echo stripslashes($searchterm); ?></strong>"</p>
  3. <?php endif; ?>
  4.  
  5. <?php if (!empty($products)) : ?>
  6.     <?php
  7.        
  8.     $displaygrid = (!$this -> get_option('loop_display') || $this -> get_option('loop_display') == "grid") ? true : false;
  9.    
  10.     if (!empty($related) && $related == true) {
  11.         $displaygrid = ($this -> get_option('related_display') == "list") ? false : true;  
  12.     }
  13.    
  14.     ?>
  15.     <div class="products<?php echo ($displaygrid) ? 'grid' : 'list'; ?>">
  16.         <div class="productsoptions">
  17.             <?php if ($this -> get_option('loopsorting') == "Y" && empty($related)) : ?>
  18.                 <form class="productssort">
  19.                     <label for="productsortselect">Sort By: </label>
  20.                     <select name="productsortselect" onchange="window.location=this.value;">
  21.                         <optgroup label="<?php _e('By Price', $this->plugin_name); ?>" name="sortlistselect">
  22.                             <option value="<?php echo $wpcoHtml -> retainquery('sortby=price&sort=ASC', $_SERVER['REQUEST_URI']); ?>"><?php _e('Low to High', $this->plugin_name); ?></option>
  23.                             <option value="<?php echo $wpcoHtml -> retainquery('sortby=price&sort=DESC', $_SERVER['REQUEST_URI']); ?>"><?php _e('High to Low', $this->plugin_name); ?></option>
  24.                         </optgroup>
  25.                         <optgroup label="<?php _e('By Title', $this->plugin_name); ?>">
  26.                             <option value="<?php echo $wpcoHtml -> retainquery('sortby=title&sort=ASC', $_SERVER['REQUEST_URI']); ?>"><?php _e('A to Z', $this->plugin_name); ?></option>
  27.                             <option value="<?php echo $wpcoHtml -> retainquery('sortby=title&sort=DESC', $_SERVER['REQUEST_URI']); ?>"><?php _e('Z to A', $this->plugin_name); ?></option>
  28.                         </optgroup>
  29.                         <optgroup label="<?php _e('By Date', $this->plugin_name); ?>">
  30.                             <option value="<?php echo $wpcoHtml -> retainquery('sortby=modified&sort=ASC', $_SERVER['REQUEST_URI']); ?>"><?php _e('New to Old', $this->plugin_name); ?></option>
  31.                             <option value="<?php echo $wpcoHtml -> retainquery('sortby=modified&sort=DESC', $_SERVER['REQUEST_URI']); ?>"><?php _e('Old to New', $this->plugin_name); ?></option>
  32.                         </optgroup>
  33.                     </select>
  34.                 </form>
  35.             <?php endif; ?>
  36.             <?php $this -> render('paginate', array('paginate' => $paginate), true, 'default'); ?>
  37.         </div>
  38.         <ul class="products<?php echo ($displaygrid) ? 'grid' : 'list'; ?>ul">
  39.             <?php $liclass = ''; ?>
  40.             <?php foreach ($products as $product) : ?>
  41.                 <li class="products<?php echo ($displaygrid) ? 'grid' : 'list'; ?>item products<?php echo ($displaygrid) ? 'grid' : 'list'; ?>item-<?php echo $liclass = (empty($liclass) || $liclass == "r") ? 'l' : 'r'; ?>">
  42.                     <?php if ($truncate = $this -> get_option('loop_truncatetitle')) : ?>
  43.                         <?php if (!empty($truncate)) : ?>
  44.                             <?php $product -> title = $wpcoHtml -> truncate($product -> title, $truncate, '...'); ?>
  45.                         <?php endif; ?>
  46.                     <?php endif; ?>
  47.  
  48.                     <?php if (!$this -> get_option('loop_titleposition') || $this -> get_option('loop_titleposition') == "above") : ?>             
  49.                         <?php if (!empty($tabber) && $tabber == true) : ?>
  50.                             <h4 class="producttitle producttitle<?php echo $product -> id; ?>"><?php echo $wpcoHtml -> link($product -> title, get_permalink($product -> post_id), array('title' => $product -> title, 'class' => "producttitlelink")); ?></h4>
  51.                         <?php else : ?>
  52.                             <h3 class="producttitle producttitle<?php echo $product -> id; ?>"><?php echo $wpcoHtml -> link($product -> title, get_permalink($product -> post_id), array('title' => $product -> title, 'class' => "producttitlelink")); ?></h3>
  53.                         <?php endif; ?>
  54.                     <?php endif; ?>
  55.                    
  56.                     <?php $imgw = ($this -> get_option('loop_imgw')) ? "width:" . $this -> get_option('loop_imgw') . "px; " : ''; ?>
  57.                     <?php $imgh = ($this -> get_option('loop_imgh')) ? "height:" . $this -> get_option('loop_imgh') . "px; " : ''; ?>
  58.                
  59.                     <div class="productimage">
  60.                         <?php $thumblink = ($this -> get_option('loop_thumblink') == "product") ? get_permalink($product -> post_id) : $wpcoHtml -> image_url($product -> image -> name); ?>
  61.                    
  62.                         <?php if ($this -> get_option('cropthumb') == "Y") : ?>
  63.                             <?php /*<?php echo $wpcoHtml -> link($wpcoHtml -> image($wpcoHtml -> thumb_name($product -> image -> name, $append = "loopthumb"), array('class' => "productimagethumb"), $product -> image -> name), $thumblink, array('title' => $product -> title, 'class' => (($this -> get_option('loop_thumblink') == "product") ? "productimagelink" : "productimagelink thickbox"))); ?>*/ ?>
  64.                             <?php echo $wpcoHtml -> link($wpcoHtml -> timthumb_image($product -> image_url, $this -> get_option('loop_imgw'), $this -> get_option('loop_imgh'), $this -> get_option('loopthumbq'), "productimagethumb"), $thumblink, array('title' => $product -> title, 'class' => (($this -> get_option('loop_thumblink') == "product") ? "productimagelink" : "productimagelink colorbox"))); ?>
  65.                         <?php else : ?>
  66.                             <?php echo $wpcoHtml -> link($wpcoHtml -> image($product -> image -> name, array('class' => "productimagethumb"), $product -> image -> name), $thumblink, array('title' => $product -> title, 'class' => (($this -> get_option('loop_thumblink') == "product") ? "productimagelink" : "productimagelink colorbox"))); ?>
  67.                         <?php endif; ?>
  68.                     </div>
  69.                    
  70.                     <?php if ($this -> get_option('loop_titleposition') == "below") : ?>               
  71.                         <?php if (!empty($tabber) && $tabber == true) : ?>
  72.                             <h4 class="producttitle producttitle<?php echo $product -> id; ?>"><?php echo $wpcoHtml -> link($product -> title, get_permalink($product -> post_id), array('title' => $product -> title, 'class' => "producttitlelink")); ?></h4>
  73.                         <?php else : ?>
  74.                             <h3 class="producttitle producttitle<?php echo $product -> id; ?>"><?php echo $wpcoHtml -> link($product -> title, get_permalink($product -> post_id), array('title' => $product -> title, 'class' => "producttitlelink")); ?></h3>
  75.                         <?php endif; ?>
  76.                     <?php endif; ?>
  77.  
  78.                     <!-- Not Showcase -->
  79.                     <?php if ($this -> get_option('showcase') == "N" && $product -> showcase == "N") : ?>
  80.                         <div class="productdetails productdetails<?php echo $product -> id; ?>">
  81.                             <!-- Price -->             
  82.                             <div class="productpricewrap">
  83.                                 <?php if (empty($product -> price_type) || ($product -> price_type != "donate" && $product -> price_type != "square")) : ?>
  84.                                     <?php echo (!empty($product -> price_type) && $product -> price_type == "tiers" && $product -> price_display != "high") ? __('From', $this -> plugin_name) . ' ' : ''; ?>
  85.                                     <?php echo (!empty($product -> sprice) && is_numeric($product -> sprice) && $product -> sprice != "0.00") ? '<span class="sprice"><strike>' . $wpcoHtml -> currency_price($product -> sprice) . '</strike></span>' : ''; ?>
  86.                                     <?php if (!empty($product -> price) && $product -> price != "0.00") : ?>
  87.                                         <span id="productprice<?php echo $product -> id; ?>" class="productprice"><?php echo $wpcoHtml -> currency_price($Product -> unit_price($product -> id, 999999, null, false, false, true)); ?></span>
  88.                                     <?php else : ?>
  89.                                         <span id="productprice<?php echo $product -> id; ?>" class="productprice"><?php echo stripslashes($this -> get_option('loop_zerotext')); ?></span>
  90.                                     <?php endif; ?>
  91.                                 <?php elseif ($product -> price_type == "donate") : ?>
  92.                                     <?php if (!empty($product -> donate_caption)) : ?>
  93.                                         <span id="productprice<?php echo $product -> id; ?>" class="productprice"><?php echo $product -> donate_caption; ?></span>
  94.                                     <?php endif; ?>
  95.                                 <?php elseif ($product -> price_type == "square") : ?>
  96.                                     <?php if (!empty($product -> square_price_text)) : ?>
  97.                                         <span id="productprice<?php echo $product -> id; ?>" class="productprice"><?php echo stripslashes($product -> square_price_text); ?></span>
  98.                                     <?php else : ?>
  99.                                         <span id="productprice<?php echo $product -> id; ?>" class="productprice"><?php echo $wpcoHtml -> currency_price($product -> square_price, true, true); ?> <?php _e('per sq', $this -> plugin_name); ?> <?php echo $product -> lengthmeasurement; ?></span>
  100.                                     <?php endif; ?>
  101.                                 <?php else : ?>
  102.                                     <!-- do nothing, it goes inside the form -->
  103.                                 <?php endif; ?>
  104.                             </div>
  105.    
  106.                             <?php if ($this -> get_option('loop_addbutton') == "Y" && (empty($noaddtob) || $noaddtob == false)) : ?>                   
  107.                                 <?php if (empty($product -> oos) || $product -> oos == false) : ?>
  108.                                     <?php echo $wpcoHtml -> addtocart_action($product -> id, (!empty($product -> styles) || !empty($product -> cfields)) ? true : false); ?>
  109.                                    
  110.                                         <?php echo $wpcoForm -> hidden('Item.product_id', array('value' => $product -> id)); ?>
  111.                                         <?php global $user_ID; ?>
  112.                                         <?php echo $wpcoForm -> hidden('Item.user_id', array('value' => $user_ID)); ?>
  113.        
  114.                                         <?php if ($this -> get_option('loop_howmany') == "Y" && $product -> price_type != "donate" && $product -> price_type != "square") : ?>                             
  115.                                             <div class="productcount wpcohowmany">
  116.                                                 <b><?php _e('How many?', $this -> plugin_name); ?></b>
  117.                                                 <?php echo $wpcoForm -> text('Item.count', array('value' => (empty($product -> min_order)) ? '1' : $product -> min_order, 'width' => '25px')); ?>
  118.                                             </div>
  119.                                         <?php elseif ($product -> price_type == "donate") : ?>
  120.                                             <?php echo $wpcoHtml -> currency_html('<input type="text" name="Item[donate_price]" value="' . $wpcoHtml -> field_value('Item.donate_price') . '" id="Item.donate_price" class="donateprice" />'); ?>
  121.                                         <?php elseif ($product -> price_type == "square" && !empty($product -> square_price)) : ?>
  122.                                             <?php echo $wpcoForm -> text('Item.width', array('width' => "45px")); ?><?php echo $product -> lengthmeasurement; ?> <?php _e('X', $this -> plugin_name); ?>
  123.                                             <?php echo $wpcoForm -> text('Item.length', array('width' => "45px")); ?><?php echo $product -> lengthmeasurement; ?>
  124.                                             <?php echo $wpcoForm -> hidden('Item.count', array('value' => 1)); ?>
  125.                                         <?php else : ?>
  126.                                             <?php echo $wpcoForm -> hidden('Item.count', array('value' => 1)); ?>
  127.                                         <?php endif; ?>
  128.                                        
  129.                                         <!-- Custom Fields & Product Varieties -->
  130.                                         <?php if (empty($related) || $related == false) : ?>
  131.                                             <?php if ($this -> get_option('loop_display') == "list" && $this -> get_option('loop_showfields') == "Y") : ?>
  132.                                                 <?php if (!empty($product -> styles) && !empty($product -> options)) : ?>
  133.                                                     <?php foreach ($product -> styles as $style_id) : ?>
  134.                                                         <?php echo $this -> render_style($style_id, $product -> options[$style_id], true, $product -> id); ?>
  135.                                                     <?php endforeach; ?>
  136.                                                 <?php endif; ?>
  137.                            
  138.                                                 <?php if (!empty($product -> cfields)) : ?>
  139.                                                     <?php foreach ($product -> cfields as $field_id) : ?>
  140.                                                         <?php if (!empty($field_id)) : ?>
  141.                                                             <?php $this -> render_field($field_id, true, false, $product -> id); ?>
  142.                                                         <?php endif; ?>
  143.                                                     <?php endforeach; ?>
  144.                                                 <?php endif; ?>
  145.                                             <?php endif; ?>
  146.                                         <?php endif; ?>
  147.                                        
  148.                                         <span class="wpcobuttonwrap">
  149.                                             <?php if ($this -> get_option('buynow') == "Y" || (!empty($product -> buynow) && $product -> buynow == "Y")) : ?>
  150.                                             <!-- BEG Buy Now -->
  151.                                                 <?php if ($this -> get_option('loop_btntxt') == "txt") : ?>
  152.                                                     <span class="productsubmit buynowproductsubmit productsubmittext" id="submit<?php echo $product -> id; ?>"><a class="<?php echo $this -> pre; ?>buylink" href="#void" onclick="jQuery('#addtocart<?php echo $product -> id; ?>').submit();" title="<?php _e('Buy this product right now', $this -> plugin_name); ?>"><?php echo $product -> buttontext; ?></a></span>
  153.                                                 <?php else : ?>
  154.                                                     <span class="productsubmit buynowproductsubmit productsubmitbutton" id="submit<?php echo $product -> id; ?>"><?php echo $wpcoForm -> submit($product -> buttontext); ?></span>
  155.                                                 <?php endif; ?>
  156.                                                
  157.                                                 <?php if (empty($product -> oos) || $product -> oos == false) : ?>
  158.                                                     <input type="hidden" name="buynow" value="Y" />
  159.                                                 <?php endif; ?>
  160.                                             <!-- END Buy Now -->
  161.                                             <?php elseif (!empty($product -> affiliate) && $product -> affiliate == "Y" && !empty($product -> affiliateurl)) : ?>
  162.                                             <!-- BEG Affiliate -->
  163.                                                 <?php if ($this -> get_option('loop_btntxt') == "txt") : ?>
  164.                                                     <span class="productsubmit productsubmittext affiliateproductsubmit" id="submit<?php echo $product -> id; ?>"><a href="<?php echo $product -> affiliateurl; ?>" <?php echo (!empty($product -> affiliatewindow) && $product -> affiliatewindow == "blank") ? 'target="_blank"' : 'target="_self"'; ?> title="<?php echo $product -> buttontext; ?>" class="<?php echo $this -> pre; ?>buylink"><?php echo $product -> buttontext; ?></a></span>
  165.                                                 <?php else : ?>
  166.                                                     <span class="productsubmit productsubmitbutton affiliateproductsubmit" id="submit<?php echo $product -> id; ?>"><?php echo $wpcoForm -> submit($product -> buttontext); ?></span>
  167.                                                 <?php endif; ?>
  168.                                             <!-- END Affiliate -->
  169.                                             <?php else : ?>
  170.                                             <!-- BEG Normal Product -->
  171.                                                 <?php if ($this -> get_option('loop_btntxt') == "txt") : ?>
  172.                                                     <?php if ((!empty($product -> styles) || !empty($product -> cfields)) && $this -> get_option('loop_showfields') == "N") : ?>
  173.                                                         <span class="productsubmit productsubmittext" id="submit<?php echo $product -> id; ?>"><a href="<?php echo get_permalink($product -> post_id); ?>" class="<?php echo $this -> pre; ?>buylink" title="<?php _e('Add this product to your shopping cart', $this -> plugin_name); ?>"><?php echo $product -> buttontext; ?></a></span>
  174.                                                     <?php else : ?>
  175.                                                         <?php if ($this -> get_option('cart_addajax') == "N" || ($product -> price_type == "donate" && (!empty($product -> inhonorof) && $product -> inhonorof == "Y"))) : ?>
  176.                                                             <span class="productsubmit productsubmittext" id="submit<?php echo $product -> id; ?>"><a href="#void" onclick="jQuery('#addtocart<?php echo $product -> id; ?>').submit();" class="<?php echo $this -> pre; ?>buylink" title="<?php _e('Add this product to your shopping cart', $this -> plugin_name); ?>"><?php echo $product -> buttontext; ?></a></span>
  177.                                                         <?php else : ?>
  178.                                                             <span class="productsubmit productsubmittext" id="submit<?php echo $product -> id; ?>"><a href="#void" class="<?php echo $this -> pre; ?>buylink" onclick="wpco_addtocart(jQuery('#addtocart<?php echo $product -> id; ?>'), '<?php echo $product -> id; ?>', '<?php echo $this -> widget_active('cart'); ?>'); return false;" title="<?php _e('Add this product to your shopping cart', $this -> plugin_name); ?>"><?php echo $product -> buttontext; ?></a></span>
  179.                                                         <?php endif; ?>
  180.                                                     <?php endif; ?>
  181.                                                 <?php else : ?>
  182.                                                     <?php if (empty($product -> styles) && empty($product -> cfields)) : ?>    
  183.                                                         <?php if ($this -> get_option('cart_addajax') == "Y" && $product -> inhonorof != "Y") : ?>
  184.                                                             <span id="submit<?php echo $product -> id; ?>" class="productsubmit productsubmitbutton"><input type="button" name="submit" value="<?php echo $product -> buttontext; ?>" onclick="wpco_addtocart(jQuery('#addtocart<?php echo $product -> id; ?>'), '<?php echo $product -> id; ?>', '<?php echo $this -> widget_active('cart'); ?>'); return false;" /></span>
  185.                                                         <?php else : ?>
  186.                                                             <span id="submit<?php echo $product -> id; ?>" class="productsubmit productsubmitbutton"><?php echo $wpcoForm -> submit($product -> buttontext); ?></span>
  187.                                                         <?php endif; ?>
  188.                                                     <?php else : ?>
  189.                                                         <span id="submit<?php echo $product -> id; ?>" class="productsubmit productsubmitbutton"><?php echo $wpcoForm -> submit($product -> buttontext); ?></span>
  190.                                                     <?php endif; ?>
  191.                                                 <?php endif; ?>
  192.                                                 <span class="<?php echo $this -> pre; ?>loading" id="loading<?php echo $product -> id; ?>" style="display:none; z-index:99;"><img src="<?php echo $this -> url(); ?>/images/loading.gif" alt="loading" /> <?php _e('Adding Item...', $this -> plugin_name); ?><br class="<?php echo $this -> pre; ?>cleaner" /></span>
  193.                                                 <span class="<?php echo $this -> pre; ?>added" style="display:none;" id="added<?php echo $product -> id; ?>"><img src="<?php echo $this -> url(); ?>/images/accept.png" /> <?php _e('Product has been added', $this -> plugin_name); ?><br class="<?php echo $this -> pre; ?>cleaner" /></span>
  194.                                             <?php endif; ?>
  195.                                         </span>
  196.                                        
  197.                                         <p class="<?php echo $this -> pre; ?>error producterror" id="message<?php echo $product -> id; ?>" style="display:none;"></p>
  198.                                     </form>
  199.                                 <?php else : ?>
  200.                                     <p class="<?php echo $this -> pre; ?>oos productoutofstock"><?php echo $captions['product']['oos']; ?></p>
  201.                                 <?php endif; ?>
  202.                             <?php endif; ?>
  203.                            
  204.                             <?php if ($this -> get_option('favoritesshow') == "productsandloop") : ?>
  205.                                 <?php $this -> render('favorites' . DS . 'link', array('product' => $product), true, 'default'); ?>
  206.                             <?php endif; ?>
  207.                         </div>
  208.                     <!-- Not Showcase -->
  209.                     <?php else : ?>
  210.                         <?php $showcasemsg = $this -> get_option('showcasemsg'); ?>
  211.                         <?php if (!empty($showcasemsg) || !empty($product -> showcasemsg)) : ?>
  212.                             <div class="productdetails productdetails<?php echo $product -> id; ?>">
  213.                                 <p><?php echo (empty($product -> showcasemsg)) ? $showcasemsg : $product -> showcasemsg; ?></p>
  214.                             </div>
  215.                         <?php endif; ?>
  216.                     <?php endif; ?>
  217.                    
  218.                     <?php if ($displaygrid == false) : ?>
  219.                         <?php /*<p class="productdescription"><?php echo $wpcoHtml -> truncate($product -> description, 125); ?></p>*/ ?>
  220.                         <p><?php echo wpautop($product -> description); ?></p>
  221.                     <?php endif; ?>
  222.                        
  223.                    
  224.                     <?php if ($displaygrid == false) : ?>
  225.                         <?php if (!empty($product -> kws) && is_array($product -> kws)) : ?>
  226.                             <div class="productkeywords">
  227.                                 <small>
  228.                                     <?php $k = 1; ?>
  229.                                     <?php foreach ($product -> kws as $kw) : ?>
  230.                                         <?php echo $wpcoHtml -> link($kw, $wpcoHtml -> retainquery($this -> pre . 'searchterm=' . urlencode($kw), get_permalink($this -> get_option('allproductsppid'))), array('title' => $kw)); ?>
  231.                                         <?php echo ($k < count($product -> kws)) ? ', ' : ''; ?>
  232.                                         <?php $k++; ?>
  233.                                     <?php endforeach; ?>
  234.                                 </small>
  235.                             </div>
  236.                         <?php endif; ?>
  237.                     <?php endif; ?>
  238.                 </li>
  239.             <?php endforeach; ?>
  240.         </ul>
  241.         <br class="<?php echo $this -> pre; ?>cleaner" />
  242.         <?php $this -> render('paginate', array('paginate' => $paginate), true, 'default'); ?>
  243.     </div>
  244. <?php else : ?>
  245.     <?php if (empty($searchterm)) : ?>
  246.         <div class="<?php echo $this -> pre; ?>error productserror"><?php _e('No products are available', $this -> plugin_name); ?></div>
  247.     <?php else : ?>
  248.         <div class="<?php echo $this -> pre; ?>error productserror"><?php _e('There were no product results found for your search ! - please double check the spelling or try a slightly different phrase. Try and use as few words as possible. If you are still not successful, why not try browsing the categories.', $this -> plugin_name); ?></div>
  249.     <?php endif; ?>
  250. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment