VirtueMart 2.0.16
 All Data Structures Namespaces Files Functions Variables
components/com_virtuemart/views/category/tmpl/default.php
Go to the documentation of this file.
1 <?php
21 //vmdebug('$this->category',$this->category);
22 vmdebug ('$this->category ' . $this->category->category_name);
23 // Check to ensure this file is included in Joomla!
24 defined ('_JEXEC') or die('Restricted access');
25 JHTML::_ ('behavior.modal');
26 /* javascript for list Slide
27  Only here for the order list
28  can be changed by the template maker
29 */
30 $js = "
31 jQuery(document).ready(function () {
32  jQuery('.orderlistcontainer').hover(
33  function() { jQuery(this).find('.orderlist').stop().show()},
34  function() { jQuery(this).find('.orderlist').stop().hide()}
35  )
36 });
37 ";
38 
39 $document = JFactory::getDocument ();
40 $document->addScriptDeclaration ($js);
41 
42 /*$edit_link = '';
43 if(!class_exists('Permissions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'permissions.php');
44 if (Permissions::getInstance()->check("admin,storeadmin")) {
45  $edit_link = '<a href="'.JURI::root().'index.php?option=com_virtuemart&tmpl=component&view=category&task=edit&virtuemart_category_id='.$this->category->virtuemart_category_id.'">
46  '.JHTML::_('image', 'images/M_images/edit.png', JText::_('COM_VIRTUEMART_PRODUCT_FORM_EDIT_PRODUCT'), array('width' => 16, 'height' => 16, 'border' => 0)).'</a>';
47 }
48 
49 echo $edit_link; */
50 if (empty($this->keyword)) {
51  ?>
52 <div class="category_description">
53  <?php echo $this->category->category_description; ?>
54 </div>
55 <?php
56 }
57 
58 /* Show child categories */
59 
60 if (VmConfig::get ('showCategory', 1) and empty($this->keyword)) {
61  if ($this->category->haschildren) {
62 
63  // Category and Columns Counter
64  $iCol = 1;
65  $iCategory = 1;
66 
67  // Calculating Categories Per Row
68  $categories_per_row = VmConfig::get ('categories_per_row', 3);
69  $category_cellwidth = ' width' . floor (100 / $categories_per_row);
70 
71  // Separator
72  $verticalseparator = " vertical-separator";
73  ?>
74 
75  <div class="category-view">
76 
77  <?php // Start the Output
78  if (!empty($this->category->children)) {
79  foreach ($this->category->children as $category) {
80 
81  // Show the horizontal seperator
82  if ($iCol == 1 && $iCategory > $categories_per_row) {
83  ?>
84  <div class="horizontal-separator"></div>
85  <?php
86  }
87 
88  // this is an indicator wether a row needs to be opened or not
89  if ($iCol == 1) {
90  ?>
91  <div class="row">
92  <?php
93  }
94 
95  // Show the vertical seperator
96  if ($iCategory == $categories_per_row or $iCategory % $categories_per_row == 0) {
97  $show_vertical_separator = ' ';
98  } else {
99  $show_vertical_separator = $verticalseparator;
100  }
101 
102  // Category Link
103  $caturl = JRoute::_ ('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id);
104 
105  // Show Category
106  ?>
107  <div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">
108  <div class="spacer">
109  <h2>
110  <a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">
111  <?php echo $category->category_name ?>
112  <br/>
113  <?php // if ($category->ids) {
114  echo $category->images[0]->displayMediaThumb ("", FALSE);
115  //} ?>
116  </a>
117  </h2>
118  </div>
119  </div>
120  <?php
121  $iCategory++;
122 
123  // Do we need to close the current row now?
124  if ($iCol == $categories_per_row) {
125  ?>
126  <div class="clear"></div>
127  </div>
128  <?php
129  $iCol = 1;
130  } else {
131  $iCol++;
132  }
133  }
134  }
135  // Do we need a final closing row tag?
136  if ($iCol != 1) {
137  ?>
138  <div class="clear"></div>
139  </div>
140  <?php } ?>
141  </div>
142 
143  <?php
144  }
145 }
146 ?>
147 <div class="browse-view">
148 <?php
149 if (!empty($this->keyword)) {
150  ?>
151 <h3><?php echo $this->keyword; ?></h3>
152  <?php
153 } ?>
154 <?php if ($this->search !== NULL) { ?>
155 <form action="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=category&limitstart=0&virtuemart_category_id=' . $this->category->virtuemart_category_id); ?>" method="get">
156 
157  <!--BEGIN Search Box -->
158  <div class="virtuemart_search">
159  <?php echo $this->searchcustom ?>
160  <br/>
161  <?php echo $this->searchcustomvalues ?>
162  <input name="keyword" class="inputbox" type="text" size="20" value="<?php echo $this->keyword ?>"/>
163  <input type="submit" value="<?php echo JText::_ ('COM_VIRTUEMART_SEARCH') ?>" class="button" onclick="this.form.keyword.focus();"/>
164  </div>
165  <input type="hidden" name="search" value="true"/>
166  <input type="hidden" name="view" value="category"/>
167 
168 </form>
169 <!-- End Search Box -->
170  <?php } ?>
171 
172 <?php // Show child categories
173 if (!empty($this->products)) {
174  ?>
175 <div class="orderby-displaynumber">
176  <div class="width70 floatleft">
177  <?php echo $this->orderByList['orderby']; ?>
178  <?php echo $this->orderByList['manufacturer']; ?>
179  </div>
180  <div class="width30 floatright display-number"><?php echo $this->vmPagination->getResultsCounter ();?><br/><?php echo $this->vmPagination->getLimitBox (); ?></div>
181  <div class="vm-pagination">
182  <?php echo $this->vmPagination->getPagesLinks (); ?>
183  <span style="float:right"><?php echo $this->vmPagination->getPagesCounter (); ?></span>
184  </div>
185 
186  <div class="clear"></div>
187 </div> <!-- end of orderby-displaynumber -->
188 
189 <h1><?php echo $this->category->category_name; ?></h1>
190 
191  <?php
192  // Category and Columns Counter
193  $iBrowseCol = 1;
194  $iBrowseProduct = 1;
195 
196  // Calculating Products Per Row
197  $BrowseProducts_per_row = $this->perRow;
198  $Browsecellwidth = ' width' . floor (100 / $BrowseProducts_per_row);
199 
200  // Separator
201  $verticalseparator = " vertical-separator";
202 
203  // Count products ?? why not just count ($this->products) ?? note by Max Milbers
204  $BrowseTotalProducts = 0;
205  foreach ($this->products as $product) {
206  $BrowseTotalProducts++;
207  }
208 
209  // Start the Output
210  foreach ($this->products as $product) {
211 
212  // Show the horizontal seperator
213  if ($iBrowseCol == 1 && $iBrowseProduct > $BrowseProducts_per_row) {
214  ?>
215  <div class="horizontal-separator"></div>
216  <?php
217  }
218 
219  // this is an indicator wether a row needs to be opened or not
220  if ($iBrowseCol == 1) {
221  ?>
222  <div class="row">
223  <?php
224  }
225 
226  // Show the vertical seperator
227  if ($iBrowseProduct == $BrowseProducts_per_row or $iBrowseProduct % $BrowseProducts_per_row == 0) {
228  $show_vertical_separator = ' ';
229  } else {
230  $show_vertical_separator = $verticalseparator;
231  }
232 
233  // Show Products
234  ?>
235  <div class="product floatleft<?php echo $Browsecellwidth . $show_vertical_separator ?>">
236  <div class="spacer">
237  <div class="width30 floatleft center">
238  <a title="<?php echo $product->link ?>" rel="vm-additional-images" href="<?php echo $product->link; ?>">
239  <?php
240  echo $product->images[0]->displayMediaThumb('class="browseProductImage"', false);
241  ?>
242  </a>
243 
244  <!-- The "Average Customer Rating" Part -->
245  <?php if ($this->showRating) { ?>
246  <span class="contentpagetitle"><?php echo JText::_ ('COM_VIRTUEMART_CUSTOMER_RATING') ?>:</span>
247  <br/>
248  <?php
249  // $img_url = JURI::root().VmConfig::get('assets_general_path').'/reviews/'.$product->votes->rating.'.gif';
250  // echo JHTML::image($img_url, $product->votes->rating.' '.JText::_('COM_VIRTUEMART_REVIEW_STARS'));
251  // echo JText::_('COM_VIRTUEMART_TOTAL_VOTES').": ". $product->votes->allvotes;
252  ?>
253  <?php } ?>
254  <?php
255  if ( VmConfig::get ('display_stock', 1)) { ?>
256  <!-- if (!VmConfig::get('use_as_catalog') and !(VmConfig::get('stockhandle','none')=='none')){?> -->
257  <div class="paddingtop8">
258  <span class="vmicon vm2-<?php echo $product->stock->stock_level ?>" title="<?php echo $product->stock->stock_tip ?>"></span>
259  <span class="stock-level"><?php echo JText::_ ('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP') ?></span>
260  </div>
261  <?php } ?>
262  </div>
263 
264  <div class="width70 floatright">
265 
266  <h2><?php echo JHTML::link ($product->link, $product->product_name); ?></h2>
267 
268  <?php // Product Short Description
269  if (!empty($product->product_s_desc)) {
270  ?>
271  <p class="product_s_desc">
272  <?php echo shopFunctionsF::limitStringByWord ($product->product_s_desc, 40, '...') ?>
273  </p>
274  <?php } ?>
275 
276  <div class="product-price marginbottom12" id="productPrice<?php echo $product->virtuemart_product_id ?>">
277  <?php
278  if ($this->show_prices == '1') {
279  if (empty($product->prices['salesPrice']) and VmConfig::get ('askprice', 1) and !$product->images[0]->file_is_downloadable) {
280  echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');
281  }
282  //todo add config settings
283  if ($this->showBasePrice) {
284  echo $this->currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);
285  echo $this->currency->createPriceDiv ('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $product->prices);
286  }
287  echo $this->currency->createPriceDiv ('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices);
288  if (round($product->prices['basePriceWithTax'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
289  echo '<span class="price-crossed" >' . $this->currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";
290  }
291  if (round($product->prices['salesPriceWithDiscount'],$this->currency->_priceConfig['salesPrice'][1]) != $product->prices['salesPrice']) {
292  echo $this->currency->createPriceDiv ('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices);
293  }
294  echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
295  echo $this->currency->createPriceDiv ('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);
296  echo $this->currency->createPriceDiv ('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices);
297  echo $this->currency->createPriceDiv ('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices);
298  $unitPriceDescription = JText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE', $product->product_unit);
299  echo $this->currency->createPriceDiv ('unitPrice', $unitPriceDescription, $product->prices);
300  } ?>
301 
302  </div>
303 
304  <p>
305  <?php // Product Details Button
306  echo JHTML::link ($product->link, JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name, 'class' => 'product-details'));
307  ?>
308  </p>
309 
310  </div>
311  <div class="clear"></div>
312  </div>
313  <!-- end of spacer -->
314  </div> <!-- end of product -->
315  <?php
316 
317  // Do we need to close the current row now?
318  if ($iBrowseCol == $BrowseProducts_per_row || $iBrowseProduct == $BrowseTotalProducts) {
319  ?>
320  <div class="clear"></div>
321  </div> <!-- end of row -->
322  <?php
323  $iBrowseCol = 1;
324  } else {
325  $iBrowseCol++;
326  }
327 
328  $iBrowseProduct++;
329  } // end of foreach ( $this->products as $product )
330  // Do we need a final closing row tag?
331  if ($iBrowseCol != 1) {
332  ?>
333  <div class="clear"></div>
334 
335  <?php
336  }
337  ?>
338 
339 <div class="vm-pagination"><?php echo $this->vmPagination->getPagesLinks (); ?><span style="float:right"><?php echo $this->vmPagination->getPagesCounter (); ?></span></div>
340 
341  <?php
342 } elseif ($this->search !== NULL) {
343  echo JText::_ ('COM_VIRTUEMART_NO_RESULT') . ($this->keyword ? ' : (' . $this->keyword . ')' : '');
344 }
345 ?>
346 </div><!-- end browse-view -->