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

/templates/jsn_pixel_pro/html/com_virtuemart/productdetails/pdf.php

https://bitbucket.org/pastor399/newcastleunifc
PHP | 295 lines | 221 code | 35 blank | 39 comment | 42 complexity | 54147ff598759fa2e4c9e5aa52f9350c MD5 | raw file
  1. <?php
  2. /**
  3. *
  4. * Show the product details page
  5. *
  6. * @package VirtueMart
  7. * @subpackage
  8. * @author Max Milbers, Eugen Stranz
  9. * @author RolandD,
  10. * @todo handle child products
  11. * @link http://www.virtuemart.net
  12. * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
  13. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
  14. * VirtueMart is free software. This version may have been modified pursuant
  15. * to the GNU General Public License, and as distributed it includes or
  16. * is derivative of works licensed under the GNU General Public License or
  17. * other free or open source software licenses.
  18. * @version $Id: default.php 3605 2011-07-04 10:23:23Z Milbo $
  19. */
  20. // Check to ensure this file is included in Joomla!
  21. defined ( '_JEXEC' ) or die ( 'Restricted access' );
  22. /* Let's see if we found the product */
  23. if (empty ( $this->product )) {
  24. echo JText::_ ( 'COM_VIRTUEMART_PRODUCT_NOT_FOUND' );
  25. echo '<br /><br /> ' . $this->continue_link_html;
  26. return;
  27. }
  28. ?>
  29. <div class="productdetails-view">
  30. <?php // Product Title ?>
  31. <h1><?php echo $this->product->product_name ?></h1>
  32. <?php // Product Title END ?>
  33. <?php // Showing The Additional Images
  34. if(!empty($this->product->images) && count($this->product->images)>0) {
  35. echo $this->product->images[0]->displayMediaFull('class="product-image"',false); ?>
  36. <div class="additional-images">
  37. <?php // List all Images
  38. foreach ($this->product->images as $image) {
  39. echo $image->displayMediaThumb('class="product-image"'); //'class="modal"'
  40. } ?>
  41. </div>
  42. <?php } // Showing The Additional Images END ?>
  43. <?php // Product Short Description
  44. if (!empty($this->product->product_s_desc)) { ?>
  45. <div class="product-short-description">
  46. <?php /** @todo Test if content plugins modify the product description */
  47. echo $this->product->product_s_desc; ?>
  48. </div>
  49. <?php } // Product Short Description END ?>
  50. <div>
  51. <div class="width50 floatright">
  52. <div class="spacer-buy-area">
  53. <?php // TO DO in Multi-Vendor not needed at the moment and just would lead to confusion
  54. /* $link = JRoute::_('index2.php?option=com_virtuemart&view=virtuemart&task=vendorinfo&virtuemart_vendor_id='.$this->product->virtuemart_vendor_id);
  55. $text = JText::_('COM_VIRTUEMART_VENDOR_FORM_INFO_LBL');
  56. echo '<span class="bold">'. JText::_('COM_VIRTUEMART_PRODUCT_DETAILS_VENDOR_LBL'). '</span>'; ?><a class="modal" href="<?php echo $link ?>"><?php echo $text ?></a><br />
  57. */ ?>
  58. <?php
  59. $rating = empty($this->rating)? JText::_('COM_VIRTUEMART_UNRATED'):$this->rating->rating;
  60. echo JText::_('COM_VIRTUEMART_RATING') . $rating;
  61. // Product Price
  62. if ($this->show_prices) { ?>
  63. <div class="product-price" id="productPrice<?php echo $this->product->virtuemart_product_id ?>">
  64. <?php
  65. if ($this->product->product_unit && VmConfig::get ( 'price_show_packaging_pricelabel' )) {
  66. echo "<strong>" . JText::_ ( 'COM_VIRTUEMART_CART_PRICE_PER_UNIT' ) . ' (' . $this->product->product_unit . "):</strong>";
  67. } else {
  68. echo "<strong>" . JText::_ ( 'COM_VIRTUEMART_CART_PRICE' ) . "</strong>";
  69. }
  70. if ($this->showBasePrice) {
  71. echo $this->currency->createPriceDiv ( 'basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices );
  72. echo $this->currency->createPriceDiv ( 'basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $this->product->prices );
  73. }
  74. echo $this->currency->createPriceDiv ( 'variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $this->product->prices );
  75. echo $this->currency->createPriceDiv ( 'basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices );
  76. echo $this->currency->createPriceDiv ( 'discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE', $this->product->prices );
  77. echo $this->currency->createPriceDiv ( 'salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $this->product->prices );
  78. echo $this->currency->createPriceDiv ( 'salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $this->product->prices );
  79. echo $this->currency->createPriceDiv ( 'priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices );
  80. echo $this->currency->createPriceDiv ( 'discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $this->product->prices );
  81. echo $this->currency->createPriceDiv ( 'taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $this->product->prices ); ?>
  82. </div>
  83. <?php } ?>
  84. <?php // Add To Cart Button
  85. if (!VmConfig::get('use_as_catalog',0)) { ?>
  86. <div class="addtocart-area">
  87. <?php // Product custom_fields
  88. if (!empty($this->product->customfieldsCart)) { ?>
  89. <div class="product-fields">
  90. <?php foreach ($this->product->customfieldsCart as $field)
  91. { ?><div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
  92. <span class="product-fields-title" ><strong><?php echo $field->custom_title ?></strong></span>
  93. <?php echo JHTML::tooltip($field->custom_tip, $field->custom_title, 'tooltip.png'); ?>
  94. <span class="product-field-display"><?php echo $field->display ?></span>
  95. <span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
  96. </div><br/ >
  97. <?php
  98. }
  99. ?>
  100. </div>
  101. <?php }
  102. /* Product custom Childs
  103. * to display a simple link use $field->virtuemart_product_id as link to child product_id
  104. * custom_value is relation value to child
  105. */
  106. if (!empty($this->product->customsChilds)) { ?>
  107. <div class="product-fields">
  108. <?php foreach ($this->product->customsChilds as $field) { ?>
  109. <div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field->field_type ?>">
  110. <span class="product-fields-title" ><strong><?php echo $field->field->custom_title ?></strong></span>
  111. <span class="product-field-desc"><?php echo $field->field->custom_value ?></span>
  112. <span class="product-field-display"><?php echo $field->display ?></span>
  113. </div><br/ >
  114. <?php
  115. } ?>
  116. </div>
  117. <?php } ?>
  118. <div class="clear"></div>
  119. </div>
  120. <?php } // Add To Cart Button END ?>
  121. <?php // Availability Image
  122. /* TO DO add width and height to the image */
  123. if (!empty($this->product->product_availability)) { ?>
  124. <div class="availability">
  125. <?php echo JHTML::image(JURI::root().VmConfig::get('assets_general_path').'images/availability/'.$this->product->product_availability, $this->product->product_availability, array('class' => 'availability')); ?>
  126. </div>
  127. <?php } ?>
  128. <?php // Ask a question about this product
  129. $url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id='.$this->product->virtuemart_product_id.'&virtuemart_category_id='.$this->product->virtuemart_category_id.'&tmpl=component'); ?>
  130. <div class="ask-a-question">
  131. <a class="ask-a-question modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}" href="<?php echo $url ?>"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>
  132. </div>
  133. <?php // Manufacturer of the Product
  134. if(VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) { ?>
  135. <div class="manufacturer">
  136. <?php
  137. $link = JRoute::_('index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id='.$this->product->virtuemart_manufacturer_id.'&tmpl=component');
  138. $text = $this->product->mf_name;
  139. /* Avoid JavaScript on PDF Output */
  140. if (strtolower(JRequest::getWord('output')) == "pdf"){
  141. echo JHTML::_('link', $link, $text);
  142. } else { ?>
  143. <span class="bold"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL') ?></span><a class="modal" href="<?php echo $link ?>"><?php echo $text ?></a>
  144. <?PHP } ?>
  145. </div>
  146. <?php } ?>
  147. </div>
  148. </div>
  149. <div class="clear"></div>
  150. </div>
  151. <?php // Product Description
  152. if (!empty($this->product->product_desc)) { ?>
  153. <div class="product-description">
  154. <?php /** @todo Test if content plugins modify the product description */ ?>
  155. <span class="title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE') ?></span>
  156. <?php echo $this->product->product_desc; ?>
  157. </div>
  158. <?php } // Product Description END ?>
  159. <?php // Product custom_fields TODO relation to Childs
  160. if (!empty($this->product->customfields)) { ?>
  161. <div class="product-fields">
  162. <?php
  163. $custom_title = null ;
  164. foreach ($this->product->customfields as $field){
  165. ?><div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
  166. <?php if ($field->custom_title != $custom_title) { ?>
  167. <span class="product-fields-title" ><strong><?php echo JText::_($field->custom_title); ?></strong></span>
  168. <?php //echo JHTML::tooltip($field->custom_tip, $field->custom_title, 'tooltip.png');
  169. } ?>
  170. <span class="product-field-display"><?php echo $field->display ?></span>
  171. <span class="product-field-desc"><?php echo jText::_($field->custom_field_desc) ?></span>
  172. </div>
  173. <?php
  174. $custom_title = $field->custom_title;
  175. } ?>
  176. </div>
  177. <?php
  178. } // Product custom_fields END ?>
  179. <?php // Product Packaging
  180. $product_packaging = '';
  181. if ($this->product->packaging || $this->product->box) { ?>
  182. <div class="product-packaging">
  183. <span class="bold"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_PACKAGING2') ?></span>
  184. <br />
  185. <?php
  186. if ($this->product->packaging) {
  187. $product_packaging .= JText::_('COM_VIRTUEMART_PRODUCT_PACKAGING1').$this->product->packaging;
  188. if ($this->product->box) $product_packaging .= '<br />';
  189. }
  190. if ($this->product->box) $product_packaging .= JText::_('COM_VIRTUEMART_PRODUCT_PACKAGING2').$this->product->box;
  191. echo str_replace("{unit}",$this->product->product_unit ? $this->product->product_unit : JText::_('COM_VIRTUEMART_PRODUCT_FORM_UNIT_DEFAULT'), $product_packaging); ?>
  192. </div>
  193. <?php }
  194. // Product Packaging END
  195. // Customer Reviews
  196. if( $this->showReview ) {
  197. $maxrating = VmConfig::get('vm_maximum_rating_scale',5);
  198. $ratingsShow = VmConfig::get('vm_num_ratings_show',3); // TODO add vm_num_ratings_show in vmConfig
  199. $starsPath = JURI::root().VmConfig::get('assets_general_path').'images/stars/';
  200. $stars = array();
  201. $showall = JRequest::getBool('showall', false);
  202. for ($num=0 ; $num <= $maxrating; $num++ ) {
  203. $title = (JText::_("VM_RATING_TITLE").' : '. $num . '/' . $maxrating) ;
  204. $stars[] = JHTML::image($starsPath.$num.'.gif', JText::_($num.'_STARS'), array("title" => $title) );
  205. } ?>
  206. <div class="customer-reviews">
  207. <?php
  208. }
  209. if($this->showReview) {
  210. $alreadycommented = false;
  211. ?>
  212. <h4><?php echo JText::_('COM_VIRTUEMART_REVIEWS') ?></h4>
  213. <div class="list-reviews">
  214. <?php
  215. $i=0;
  216. foreach($this->rating_reviews as $review ) {
  217. if ($i % 2 == 0) {
  218. $color = 'normal';
  219. } else {
  220. $color = 'highlight';
  221. }
  222. // Loop through all reviews
  223. if (!empty($this->rating_reviews)) { ?>
  224. <div class="<?php echo $color ?>">
  225. <span class="date"><?php echo JHTML::date($review->created_on, JText::_('DATE_FORMAT_LC')); ?></span>
  226. <?php //echo $stars[ $review->review_rating ] //Attention the review rating is the rating of the review itself, rating for the product is the vote !?>
  227. <blockquote><?php echo $review->comment; ?></blockquote>
  228. <span class="bold"><?php echo $review->customer ?></span>
  229. </div>
  230. <?php
  231. }
  232. $i++ ;
  233. if ( $i == $ratingsShow && !$showall) break;
  234. }
  235. if (count($this->rating_reviews) < 1) {
  236. // "There are no reviews for this product" ?>
  237. <span class="step"><?php echo JText::_('COM_VIRTUEMART_NO_REVIEWS') ?></span>
  238. <?php
  239. } else {
  240. /* Show all reviews */
  241. if (!$showall && count($this->rating_reviews) >= $ratingsShow ) {
  242. $attribute = array('class'=>'details', 'title'=>JText::_('COM_VIRTUEMART_MORE_REVIEWS'));
  243. echo JHTML::link($this->more_reviews, JText::_('COM_VIRTUEMART_MORE_REVIEWS'),$attribute);
  244. }
  245. } ?>
  246. <div class="clear"></div>
  247. </div>
  248. <?php
  249. }
  250. // } else {
  251. // echo '<strong>'.JText::_('COM_VIRTUEMART_DEAR').$this->user->name.',</strong><br />' ;
  252. // echo JText::_('COM_VIRTUEMART_REVIEW_ALREADYDONE');
  253. // }
  254. if( $this->showReview ) {
  255. ?>
  256. </div>
  257. <?php
  258. }
  259. ?>
  260. </div>