linccce

virtuemart details default view template

Jul 2nd, 2014
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.96 KB | None | 0 0
  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 7930 2014-05-15 16:06:09Z Milbo $
  19.  */
  20. // Check to ensure this file is included in Joomla!
  21. defined('_JEXEC') or die('Restricted access');
  22.  
  23. /* Let's see if we found the product */
  24. if (empty($this->product)) {
  25.     echo vmText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
  26.     echo '<br /><br />  ' . $this->continue_link_html;
  27.     return;
  28. }
  29.  
  30. if(vRequest::getInt('print',false)){
  31. ?>
  32. <body onload="javascript:print();">
  33. <?php }
  34.  
  35. // addon for joomla modal Box
  36. JHtml::_('behavior.modal');
  37.  
  38. $MailLink = 'index.php?option=com_virtuemart&view=productdetails&task=recommend&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->product->virtuemart_category_id . '&tmpl=component';
  39.  
  40. $boxFuncReco = '';
  41. $boxFuncAsk = '';
  42. if(VmConfig::get('usefancy',1)){
  43.     vmJsApi::js( 'fancybox/jquery.fancybox-1.3.4.pack');
  44.     vmJsApi::css('jquery.fancybox-1.3.4');
  45.     if(VmConfig::get('show_emailfriend',0)){
  46.         $boxReco = "jQuery.fancybox({
  47.                 href: '" . $MailLink . "',
  48.                 type: 'iframe',
  49.                 height: '550'
  50.             });";
  51.     }
  52.     if(VmConfig::get('ask_question', 0)){
  53.         $boxAsk = "jQuery.fancybox({
  54.                 href: '" . $this->askquestion_url . "',
  55.                 type: 'iframe',
  56.                 height: '550'
  57.             });";
  58.     }
  59.  
  60. } else {
  61.     vmJsApi::js( 'facebox' );
  62.     vmJsApi::css( 'facebox' );
  63.     if(VmConfig::get('show_emailfriend',0)){
  64.         $boxReco = "jQuery.facebox({
  65.                 iframe: '" . $MailLink . "',
  66.                 rev: 'iframe|550|550'
  67.             });";
  68.     }
  69.     if(VmConfig::get('ask_question', 0)){
  70.         $boxAsk = "jQuery.facebox({
  71.                 iframe: '" . $this->askquestion_url . "',
  72.                 rev: 'iframe|550|550'
  73.             });";
  74.     }
  75. }
  76. if(VmConfig::get('show_emailfriend',0) ){
  77.     $boxFuncReco = "jQuery('a.recommened-to-friend').click( function(){
  78.                     ".$boxReco."
  79.             return false ;
  80.         });";
  81. }
  82. if(VmConfig::get('ask_question', 0)){
  83.     $boxFuncAsk = "jQuery('a.ask-a-question').click( function(){
  84.                     ".$boxAsk."
  85.             return false ;
  86.         });";
  87. }
  88.  
  89. if(!empty($boxFuncAsk) or !empty($boxFuncReco)){
  90.     $document = JFactory::getDocument();
  91.     $document->addScriptDeclaration("
  92. //<![CDATA[
  93.     jQuery(document).ready(function($) {
  94.         ".$boxFuncReco."
  95.         ".$boxFuncAsk."
  96.     /*  $('.additional-images a').mouseover(function() {
  97.             var himg = this.href ;
  98.             var extension=himg.substring(himg.lastIndexOf('.')+1);
  99.             if (extension =='png' || extension =='jpg' || extension =='gif') {
  100.                 $('.main-image img').attr('src',himg );
  101.             }
  102.             console.log(extension)
  103.         });*/
  104.     });
  105. //]]>
  106. ");
  107. }
  108. // This is the rows for the customfields, as long you have only one product, just increase it by one,
  109. // if you have more than one product, reset it for every product
  110. $this->row = 0;
  111. ?>
  112.  
  113. <div class="productdetails-view productdetails">
  114.  
  115.     <?php
  116.     // Product Navigation
  117.     if (VmConfig::get('product_navigation', 1)) {
  118.     ?>
  119.         <div class="product-neighbours">
  120.         <?php
  121.         if (!empty($this->product->neighbours ['previous'][0])) {
  122.         $prev_link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->neighbours ['previous'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' . $this->product->virtuemart_category_id, FALSE);
  123.         echo JHtml::_('link', $prev_link, $this->product->neighbours ['previous'][0]
  124.             ['product_name'], array('rel'=>'prev', 'class' => 'previous-page'));
  125.         }
  126.         if (!empty($this->product->neighbours ['next'][0])) {
  127.         $next_link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->neighbours ['next'][0] ['virtuemart_product_id'] . '&virtuemart_category_id=' . $this->product->virtuemart_category_id, FALSE);
  128.         echo JHtml::_('link', $next_link, $this->product->neighbours ['next'][0] ['product_name'], array('rel'=>'next','class' => 'next-page'));
  129.         }
  130.         ?>
  131.         <div class="clear"></div>
  132.         </div>
  133.     <?php } // Product Navigation END
  134.     ?>
  135.  
  136.     <?php // Back To Category Button
  137.     if ($this->product->virtuemart_category_id) {
  138.         $catURL =  JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->product->virtuemart_category_id, FALSE);
  139.         $categoryName = $this->product->category_name ;
  140.     } else {
  141.         $catURL =  JRoute::_('index.php?option=com_virtuemart');
  142.         $categoryName = vmText::_('COM_VIRTUEMART_SHOP_HOME') ;
  143.     }
  144.     ?>
  145.     <div class="back-to-category">
  146.         <a href="<?php echo $catURL ?>" class="product-details" title="<?php echo $categoryName ?>"><?php echo vmText::sprintf('COM_VIRTUEMART_CATEGORY_BACK_TO',$categoryName) ?></a>
  147.     </div>
  148.  
  149.     <?php // Product Title   ?>
  150.     <h1><?php echo $this->product->product_name ?></h1>
  151.     <?php // Product Title END   ?>
  152.  
  153.     <?php // afterDisplayTitle Event
  154.     echo $this->product->event->afterDisplayTitle ?>
  155.  
  156.     <?php
  157.     // Product Edit Link
  158.     echo $this->edit_link;
  159.     // Product Edit Link END
  160.     ?>
  161.  
  162.     <?php
  163.     // PDF - Print - Email Icon
  164.     if (VmConfig::get('show_emailfriend') || VmConfig::get('show_printicon') || VmConfig::get('pdf_icon')) {
  165.     ?>
  166.         <div class="icons">
  167.         <?php
  168.  
  169.         $link = 'index.php?tmpl=component&option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->virtuemart_product_id;
  170.  
  171.         echo $this->linkIcon($link . '&format=pdf', 'COM_VIRTUEMART_PDF', 'pdf_button', 'pdf_icon', false);
  172.         echo $this->linkIcon($link . '&print=1', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon');
  173.         echo $this->linkIcon($MailLink, 'COM_VIRTUEMART_EMAIL', 'emailButton', 'show_emailfriend', false,true,false,'class="recommened-to-friend"');
  174.         ?>
  175.         <div class="clear"></div>
  176.         </div>
  177.     <?php } // PDF - Print - Email Icon END
  178.     ?>
  179.  
  180.     <?php
  181.     // Product Short Description
  182.     if (!empty($this->product->product_s_desc)) {
  183.     ?>
  184.         <div class="product-short-description">
  185.         <?php
  186.         /** @todo Test if content plugins modify the product description */
  187.         echo nl2br($this->product->product_s_desc);
  188.         ?>
  189.         </div>
  190.     <?php
  191.     } // Product Short Description END
  192.  
  193.  
  194.     if (!empty($this->product->customfieldsSorted['ontop'])) {
  195.     $this->position = 'ontop';
  196.     echo $this->loadTemplate('customfields');
  197.     } // Product Custom ontop end
  198.     ?>
  199.  
  200.     <div>
  201.     <div class="width60 floatleft">
  202. <?php
  203. echo $this->loadTemplate('images');
  204. ?>
  205.     </div>
  206.  
  207.     <div class="width40 floatright">
  208.         <div class="spacer-buy-area">
  209.  
  210.         <?php
  211.         // TODO in Multi-Vendor not needed at the moment and just would lead to confusion
  212.         /* $link = JRoute::_('index2.php?option=com_virtuemart&view=virtuemart&task=vendorinfo&virtuemart_vendor_id='.$this->product->virtuemart_vendor_id);
  213.           $text = vmText::_('COM_VIRTUEMART_VENDOR_FORM_INFO_LBL');
  214.           echo '<span class="bold">'. vmText::_('COM_VIRTUEMART_PRODUCT_DETAILS_VENDOR_LBL'). '</span>'; ?><a class="modal" href="<?php echo $link ?>"><?php echo $text ?></a><br />
  215.          */
  216.         ?>
  217.  
  218.         <?php
  219.         if ($this->showRating) {
  220.             $maxrating = VmConfig::get('vm_maximum_rating_scale', 5);
  221.  
  222.             if (empty($this->rating)) {
  223.             ?>
  224.             <span class="vote"><?php echo vmText::_('COM_VIRTUEMART_RATING') . ' ' . vmText::_('COM_VIRTUEMART_UNRATED') ?></span>
  225.                 <?php
  226.             } else {
  227.                 $ratingwidth = $this->rating->rating * 24; //I don't use round as percetntage with works perfect, as for me
  228.                 ?>
  229.             <span class="vote">
  230.     <?php echo vmText::_('COM_VIRTUEMART_RATING') . ' ' . round($this->rating->rating) . '/' . $maxrating; ?><br/>
  231.                 <span title=" <?php echo (vmText::_("COM_VIRTUEMART_RATING_TITLE") . round($this->rating->rating) . '/' . $maxrating) ?>" class="ratingbox" style="display:inline-block;">
  232.                 <span class="stars-orange" style="width:<?php echo $ratingwidth.'px'; ?>">
  233.                 </span>
  234.                 </span>
  235.             </span>
  236.             <?php
  237.             }
  238.         }
  239.         if (is_array($this->productDisplayShipments)) {
  240.             foreach ($this->productDisplayShipments as $productDisplayShipment) {
  241.             echo $productDisplayShipment . '<br />';
  242.             }
  243.         }
  244.         if (is_array($this->productDisplayPayments)) {
  245.             foreach ($this->productDisplayPayments as $productDisplayPayment) {
  246.             echo $productDisplayPayment . '<br />';
  247.             }
  248.         }
  249.         // Product Price
  250.             // the test is done in show_prices
  251.         //if ($this->show_prices and (empty($this->product->images[0]) or $this->product->images[0]->file_is_downloadable == 0)) {
  252.             echo $this->loadTemplate('showprices');
  253.         //}
  254.         ?>
  255.  
  256.         <?php
  257.         // Add To Cart Button
  258. //          if (!empty($this->product->prices) and !empty($this->product->images[0]) and $this->product->images[0]->file_is_downloadable==0 ) {
  259. //      if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices['salesPrice'])) {
  260.             echo $this->loadTemplate('addtocart');
  261. //      }  // Add To Cart Button END
  262.         ?>
  263.  
  264.         <?php
  265.         // Availability
  266.         $stockhandle = VmConfig::get('stockhandle', 'none');
  267.         $product_available_date = substr($this->product->product_available_date,0,10);
  268.         $current_date = date("Y-m-d");
  269.         if (($this->product->product_in_stock - $this->product->product_ordered) < 1) {
  270.             if ($product_available_date != '0000-00-00' and $current_date < $product_available_date) {
  271.             ?>  <div class="availability">
  272.                     <?php echo vmText::_('COM_VIRTUEMART_PRODUCT_AVAILABLE_DATE') .': '. JHtml::_('date', $this->product->product_available_date, vmText::_('DATE_FORMAT_LC4')); ?>
  273.                 </div>
  274.             <?php
  275.             } else if ($stockhandle == 'risetime' and VmConfig::get('rised_availability') and empty($this->product->product_availability)) {
  276.             ?>  <div class="availability">
  277.                 <?php echo (file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability'))) ? JHtml::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability', '7d.gif'), VmConfig::get('rised_availability', '7d.gif'), array('class' => 'availability')) : vmText::_(VmConfig::get('rised_availability')); ?>
  278.             </div>
  279.             <?php
  280.             } else if (!empty($this->product->product_availability)) {
  281.             ?>
  282.             <div class="availability">
  283.             <?php echo (file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . $this->product->product_availability)) ? JHtml::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . $this->product->product_availability, $this->product->product_availability, array('class' => 'availability')) : vmText::_($this->product->product_availability); ?>
  284.             </div>
  285.             <?php
  286.             }
  287.         }
  288.         else if ($product_available_date != '0000-00-00' and $current_date < $product_available_date) {
  289.         ?>  <div class="availability">
  290.                 <?php echo vmText::_('COM_VIRTUEMART_PRODUCT_AVAILABLE_DATE') .': '. JHtml::_('date', $this->product->product_available_date, vmText::_('DATE_FORMAT_LC4')); ?>
  291.             </div>
  292.         <?php
  293.         }
  294.         ?>
  295.  
  296. <?php
  297. // Ask a question about this product
  298. if (VmConfig::get('ask_question', 0) == 1) {
  299.     ?>
  300.             <div class="ask-a-question">
  301.                 <a class="ask-a-question" href="<?php echo $this->askquestion_url ?>" rel="nofollow" ><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>
  302.                 <!--<a class="ask-a-question modal" rel="{handler: 'iframe', size: {x: 700, y: 550}}" href="<?php echo $this->askquestion_url ?>"><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>-->
  303.             </div>
  304.         <?php }
  305.         ?>
  306.  
  307.         <?php
  308.         // Manufacturer of the Product
  309.         if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
  310.             echo $this->loadTemplate('manufacturer');
  311.         }
  312.         ?>
  313.  
  314.         </div>
  315.     </div>
  316.     <div class="clear"></div>
  317.  
  318.  
  319.     </div>
  320. <?php
  321.     $count_images = count ($this->product->images);
  322.     if ($count_images > 1) {
  323.         echo $this->loadTemplate('images_additional');
  324.     }
  325.  
  326.     // event onContentBeforeDisplay
  327.     echo $this->product->event->beforeDisplayContent; ?>
  328.  
  329.     <?php
  330.     // Product Description
  331.     if (!empty($this->product->product_desc)) {
  332.         ?>
  333.         <div class="product-description">
  334.     <?php /** @todo Test if content plugins modify the product description */ ?>
  335.         <span class="title"><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE') ?></span>
  336.     <?php echo $this->product->product_desc; ?>
  337.         </div>
  338.     <?php
  339.     } // Product Description END
  340.  
  341.     if (!empty($this->product->customfieldsSorted['normal'])) {
  342.     $this->position = 'normal';
  343.     echo $this->loadTemplate('customfields');
  344.     } // Product custom_fields END
  345.     // Product Packaging
  346.     $product_packaging = '';
  347.     if ($this->product->product_box) {
  348.     ?>
  349.         <div class="product-box">
  350.         <?php
  351.             echo vmText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box;
  352.         ?>
  353.         </div>
  354.     <?php } // Product Packaging END
  355.  
  356.     // Show child categories
  357.     if (VmConfig::get('showCategory', 1)) {
  358.         echo $this->loadTemplate('showcategory');
  359.     }
  360.     if (!empty($this->product->customfieldsSorted['onbot'])) {
  361.         $this->position='onbot';
  362.         echo $this->loadTemplate('customfields');
  363.     } // Product Custom ontop end
  364.     if (!empty($this->product->customfieldsSorted['related_products'])) {
  365.         $this->position = 'related_products';
  366.         echo $this->loadTemplate('customfields');
  367.     }
  368.     if (!empty($this->product->customfieldsSorted['related_categories'])) {
  369.         $this->position = 'related_categories';
  370.         echo $this->loadTemplate('customfields');
  371.     }
  372.     ?>
  373.  
  374. <?php // onContentAfterDisplay event
  375. echo $this->product->event->afterDisplayContent; ?>
  376.  
  377. <?php
  378. echo $this->loadTemplate('reviews');
  379. ?>
  380. </div>
Advertisement
Add Comment
Please, Sign In to add comment