Advertisement
Guest User

Untitled

a guest
Dec 1st, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 17.11 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 6530 2012-10-12 09:40:36Z alatak $
  19.  */
  20. // Check to ensure this file is included in Joomla!
  21. defined('_JEXEC') or die('Restricted access');
  22.  
  23. jimport( 'joomla.application.module.helper' );
  24. $product_page_modules = JModuleHelper::getModules( 'product-page' );
  25.  
  26. /* Let's see if we found the product */
  27. if (empty($this->product)) {
  28.     echo JText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
  29.     echo $this->continue_link_html;
  30.     return;
  31. }
  32. echo shopFunctionsF::renderVmSubLayout('askrecomjs',array('product'=>$this->product));
  33.  
  34. if(JRequest::getInt('print',false)) { ?>
  35. <body onLoad="javascript:print();">
  36. <?php }
  37.  
  38. // addon for joomla modal Box
  39. JHTML::_('behavior.modal');
  40.  
  41. $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';
  42.  
  43. ?>
  44. <div class="page productdetails-view productdetails">
  45.     <div class="page_heading product_heading">     
  46.  
  47.         <?php // afterDisplayTitle Event
  48.         echo $this->product->event->afterDisplayTitle ?>
  49.  
  50.         <?php
  51.         // Product Edit Link
  52.        // echo $this->edit_link;
  53.         ?>
  54.  
  55.         <?php
  56.         // PDF - Print - Email Icon
  57.         if (VmConfig::get('show_emailfriend') || VmConfig::get('show_printicon') || VmConfig::get('pdf_icon')) {
  58.         ?>
  59.             <div class="product_icons icons">
  60.                 <?php
  61.                 //$link = (JVM_VERSION===1) ? 'index2.php' : 'index.php';
  62.                 $link = 'index.php?tmpl=component&option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->virtuemart_product_id;
  63.  
  64.                 echo $this->linkIcon($link . '&format=pdf', 'COM_VIRTUEMART_PDF', 'pdf_button', 'pdf_icon', false);
  65.                 echo $this->linkIcon($link . '&print=1', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon');
  66.                 echo $this->linkIcon($MailLink, 'COM_VIRTUEMART_EMAIL', 'emailButton', 'show_emailfriend', false,true,false,'class="recommened-to-friend"');
  67.                 ?>
  68.             </div>
  69.         <?php }
  70.         ?>
  71.     </div>
  72.  
  73.     <?php
  74.     // Back To Category Button
  75.     if ($this->product->virtuemart_category_id) {
  76.         $catURL =  JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->product->virtuemart_category_id, FALSE);
  77.         $categoryName = $this->product->category_name ;
  78.     } else {
  79.         $catURL =  JRoute::_('index.php?option=com_virtuemart');
  80.         $categoryName = jText::_('COM_VIRTUEMART_SHOP_HOME') ;
  81.     }
  82.     ?>
  83.     <div class="product_back-to-category">
  84.         <a href="<?php echo $catURL ?>" class="product-details btn btn-default" title="<?php echo $categoryName ?>"><span><span><i class="fa fa-reply"></i><?php echo JText::sprintf('COM_VIRTUEMART_CATEGORY_BACK_TO','<strong>'.$categoryName.'</strong>') ?></span></span></a>
  85.     </div>
  86.  
  87.     <div class="row product_columns">
  88.  
  89.         <div class="col-md-4">
  90.             <div class="product_images">
  91.                 <?php echo $this->loadTemplate('images'); ?>
  92.             </div>
  93.         </div>
  94.  
  95.         <div class="col-md-8">
  96.             <div class="row product_wrap-top-right">
  97.                 <div class="col-md-7">
  98.  
  99.                     <!-- Product title -->
  100.                     <h1 class="page_title product_title"><?php echo $this->product->product_name ?></h1>
  101.  
  102.                     <div class="product_rating ratingbox">
  103.                         <?php // Output: Average Product Rating
  104.                             $ratingModel = VmModel::getModel('ratings');
  105.                             $rating = $ratingModel->getRatingByProduct($this->product->virtuemart_product_id);
  106.                          ?>
  107.                        
  108.                         <?php                    
  109.                         if ($this->showRating) {
  110.                             $maxrating = VmConfig::get('vm_maximum_rating_scale', 5);
  111.  
  112.                             if (empty( $rating)) { ?>
  113.                                 <div class="vote">
  114.                                     <span class="rating-text"><?php echo JText::_('COM_VIRTUEMART_RATING') . ' ' . JText::_('COM_VIRTUEMART_UNRATED') ?></span>
  115.                                 </div>
  116.                             <?php
  117.                             } else {
  118.                                 ?>
  119.                                 <div class="vote">
  120.                                     <span class="pull-left rating-icons">
  121.                                     <?php
  122.                                     for ($i = 1; $i <= 5 ; $i ++ ) {                                       
  123.                                         if ($i <= $rating->rating) {
  124.                                             echo '<i class="fa fa-star"></i> ';
  125.                                         } else {
  126.                                             echo '<i class="fa fa-star-o"></i> ';
  127.                                         }                      
  128.                                     } ?>
  129.                                     </span>
  130.                                     <span class="rating-text pull-right">
  131.                                         <?php echo JText::_('COM_VIRTUEMART_RATING') . ' ' . round( $rating->rating) . '/' . $maxrating; ?>
  132.                                     </span>
  133.                                     <div class="clearfix"></div>
  134.                                 </div>
  135.                         <?php
  136.                             }
  137.                         } ?>
  138.                     </div>
  139.                      
  140.                     <?php
  141.                     // Product Short Description
  142.                     if (!empty($this->product->product_s_desc)) { ?>
  143.                        <div class="product_short-description">
  144.                             <?php
  145.                             /** @todo Test if content plugins modify the product description */
  146.                             echo nl2br($this->product->product_s_desc); ?>
  147.                         </div>
  148.                     <?php
  149.                     }
  150.  
  151.                     if (!empty($this->product->customfieldsSorted['ontop'])) {
  152.                         $this->position = 'ontop';
  153.                         echo $this->loadTemplate('customfields');
  154.                     } ?>
  155.                    
  156.                     <?php
  157.                     if (is_array($this->productDisplayShipments)) { ?>
  158.                     <div class="product_shipments">
  159.                         <?php
  160.                             foreach ($this->productDisplayShipments as $productDisplayShipment) {
  161.                                 echo $productDisplayShipment;
  162.                             } ?>
  163.                     </div>
  164.                     <?php } ?>
  165.  
  166.  
  167.                     <?php if (is_array($this->productDisplayPayments)) { ?>
  168.                     <div class="product_payments">
  169.                         <?php
  170.                             foreach ($this->productDisplayPayments as $productDisplayPayment) {
  171.                                 echo $productDisplayPayment;
  172.                             } ?>
  173.                     </div>
  174.                     <?php }
  175.                     if ($this->product->product_availability) {
  176.                     ?>         
  177.  
  178.                     <div class="product_availability">
  179.                         <?php
  180.                         // Availability
  181.                         $stockhandle = VmConfig::get('stockhandle', 'none');
  182.                         $product_available_date = substr($this->product->product_available_date,0,10);
  183.                         $current_date = date("Y-m-d");
  184.                         if (($this->product->product_in_stock - $this->product->product_ordered) < 1) {
  185.                             if ($product_available_date != '0000-00-00' and $current_date < $product_available_date) {
  186.                             ?>  <div class="availability">
  187.                                     <?php echo JText::_('COM_VIRTUEMART_PRODUCT_AVAILABLE_DATE') .': '. JHTML::_('date', $this->product->product_available_date, JText::_('DATE_FORMAT_LC4')); ?>
  188.                                 </div>
  189.                             <?php
  190.                             } else if ($stockhandle == 'risetime' and VmConfig::get('rised_availability') and empty($this->product->product_availability)) {
  191.                             ?>  <div class="availability">
  192.                                 <?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')) : JText::_(VmConfig::get('rised_availability')); ?>
  193.                             </div>
  194.                             <?php
  195.                             } else if (!empty($this->product->product_availability)) {
  196.                             ?>
  197.                             <div class="availability">
  198.                             <?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')) : JText::_($this->product->product_availability); ?>
  199.                             </div>
  200.                             <?php
  201.                             }
  202.                         }
  203.                         else if ($product_available_date != '0000-00-00' and $current_date < $product_available_date) {
  204.                         ?>  <div class="availability">
  205.                                 <?php echo JText::_('COM_VIRTUEMART_PRODUCT_AVAILABLE_DATE') .': '. JHTML::_('date', $this->product->product_available_date, JText::_('DATE_FORMAT_LC4')); ?>
  206.                             </div>
  207.                         <?php
  208.                         }
  209.                         ?>                 
  210.                     </div>
  211.                     <?php } ?>
  212.                     <ul class="list product_details-list">
  213.  
  214.                         <?php if (!empty($this->product->product_box)): ?>
  215.                             <li>                           
  216.                                 <strong><?php echo JText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX'); ?></strong>
  217.                                 <span><?php echo $this->product->product_box; ?></span>
  218.                             </li>
  219.                         <?php endif; ?>
  220.  
  221.                         <?php
  222.                         // Manufacturer of the Product
  223.                         if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
  224.                             echo $this->loadTemplate('manufacturer');
  225.                         }
  226.                         ?>
  227.                     </ul>
  228.                 </div>
  229.                 <div class="col-md-5">
  230.                     <div class="product_price-wrap">
  231.                         <div class="product_prices">
  232.                             <?php  echo $this->loadTemplate('showprices'); ?>
  233.                         </div>
  234.  
  235.                         <div class="product_addtocart">
  236.                             <?php
  237.                                   echo shopFunctionsF::renderVmSubLayout('addtocartproduct',array('product'=>$this->product));
  238.                             ?>
  239.                         </div>
  240.  
  241.                        
  242.                       <?php   // Ask a question about this product
  243.                         if (VmConfig::get('ask_question', 0) == 1) {
  244.                             $askquestion_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', FALSE);
  245.                             ?>
  246.                             <div class="product_question ask-a-question">
  247.                                 <a class="ask-a-question" href="<?php echo $askquestion_url ?>" rel="nofollow" ><i class="fa fa-question-circle"></i><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_ENQUIRY_LBL') ?></a>
  248.                             </div>
  249.                         <?php
  250.                         }
  251.                     ?>
  252.                     </div>                 
  253.                 </div>
  254.                 <div class="clearfix"></div>
  255.             </div>
  256.             <?php // event onContentBeforeDisplay
  257.             echo $this->product->event->beforeDisplayContent; ?>
  258.  
  259.             <?php
  260.             // Product Description
  261.             if (!empty($this->product->product_desc)) { ?>
  262.                 <div class="product_description product-section">
  263.                     <h4 class="product-section_title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE') ?></h4>
  264.                     <?php echo $this->product->product_desc; ?>
  265.                 </div>
  266.             <?php
  267.             }
  268.                 echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'normal'));
  269.  
  270.             ?>
  271.             <?php
  272.             // Product Files
  273.             // foreach ($this->product->images as $fkey => $file) {
  274.             // Todo add downloadable files again
  275.             // if( $file->filesize > 0.5) $filesize_display = ' ('. number_format($file->filesize, 2,',','.')." MB)";
  276.             // else $filesize_display = ' ('. number_format($file->filesize*1024, 2,',','.')." KB)";
  277.  
  278.             /* Show pdf in a new Window, other file types will be offered as download */
  279.             // $target = stristr($file->file_mimetype, "pdf") ? "_blank" : "_self";
  280.             // $link = JRoute::_('index.php?view=productdetails&task=getfile&virtuemart_media_id='.$file->virtuemart_media_id.'&virtuemart_product_id='.$this->product->virtuemart_product_id);
  281.             // echo JHTMl::_('link', $link, $file->file_title.$filesize_display, array('target' => $target));
  282.             // }
  283.             //if (!empty($this->product->customfieldsRelatedProducts)) {
  284.                 //echo $this->loadTemplate('relatedproducts');
  285.            // } // Product customfieldsRelatedProducts END
  286.            
  287.             echo shopFunctionsF::renderVmSubLayout('customfieldsrelatedprod',array('product'=>$this->product,'position'=>'related_products','class'=> 'product-related-products' ));
  288.            echo shopFunctionsF::renderVmSubLayout('customfieldsrelatedcategories',array('product'=>$this->product,'position'=>'related_categories','class'=> 'product-related-categories'));
  289.  
  290.            
  291.             // Show child categories
  292.            
  293.             echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'onbot'));
  294.  
  295.             ?>
  296.  
  297.  
  298.             </div><?php ?>
  299.             <?php // onContentAfterDisplay event
  300.                 echo $this->product->event->afterDisplayContent; ?>
  301.             <?php
  302.                 echo $this->loadTemplate('reviews');
  303.             ?>
  304.             <!-- Product-page position modules -->
  305.             <div class="product_page-modules">
  306.             <?php  $link2 = JURI::base() .'index.php?view=productdetails&virtuemart_product_id=' . $this->product->virtuemart_product_id;
  307.                    $img_pint2 = 'index.php?tmpl=component&option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->virtuemart_product_id;
  308.                    //print_r($this->product->images[0]->file_url);
  309.             ?>
  310.  
  311.                 <?php
  312.                 foreach ($product_page_modules as $product_page_module) {
  313.                     //var_dump($product_page_module->params);
  314.                     $social=$product_page_module->params;
  315.                     $socialstyle = explode(",", $social);
  316.                     $social2=$socialstyle[1];
  317.                     $socialstyle2 = explode(":", $social2);
  318.                     if ($socialstyle2[1]=='"custom-button"'){
  319.                     ?>
  320.                    
  321.                     <meta property="og:title" content="" />
  322.                     <meta property="og:type" content="product" />
  323.                     <meta property="og:site_name" content="" />
  324.                     <meta property="og:description" content="" />
  325.                     <meta property="og:email" content="" />
  326.                     <meta property="og:phone_number" content="" />
  327.                     <meta property="og:street-address" content="" />
  328.                     <meta property="og:locality" content="" />
  329.                     <meta property="og:country-name" content="" />
  330.                     <meta property="og:postal-code" content="" />
  331.                     <meta property="og:image" content="<?php echo JURI::base() . $this->product->images[0]->file_url; ?>" />
  332.  
  333.                <script type='text/javascript'>
  334.                 jQuery(document).ready(function(){
  335.                     jQuery('.socialsharing_product .social-sharing').on('click', function(){
  336.                         type = jQuery(this).attr('data-type');
  337.                         if (type.length)
  338.                         {
  339.                             switch(type)
  340.                             {
  341.                                 case 'twitter':
  342.                                     window.open('https://twitter.com/intent/tweet?text=' + '<?php echo $this->product->product_name ?>' + ' ' + encodeURIComponent('<?php echo $link2 ?>'), 'sharertwt', 'toolbar=0,status=0,width=640,height=445');
  343.                                     break;
  344.                                 case 'facebook':
  345.                                     window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent('<?php echo $link2 ?>'), 'sharer', 'toolbar=0,status=0,width=660,height=445');
  346.                                     break;
  347.                                 case 'google-plus':
  348.                                     window.open('https://plus.google.com/share?url=' + encodeURIComponent('<?php echo $link2 ?>'), 'sharer', 'toolbar=0,status=0,width=660,height=445');
  349.                                     break;
  350.                                 case 'pinterest':
  351.                                     window.open('http://www.pinterest.com/pin/create/button/?media=' + '<?php echo JURI::base() . $this->product->images[0]->file_url; ?>' + '&url=' + encodeURIComponent('<?php echo $link2 ?>'), 'sharerpinterest', 'toolbar=0,status=0,width=660,height=445');
  352.                                     break;
  353.                             }
  354.                         }
  355.                     });
  356.                 });            
  357.                 </script>
  358.                 <?php } ?>
  359.                     <div class="<?php echo $product_page_module->name; ?>">
  360.                    
  361.                         <?php echo JModuleHelper::renderModule($product_page_module); ?>
  362.                     </div>
  363.                 <?php } ?>
  364.             </div>
  365.             <?php
  366.             // Product Navigation
  367.             if (VmConfig::get('product_navigation', 1)) {
  368.             ?>
  369.                 <div class="product_neighbours">
  370.                     <?php
  371.                     if (!empty($this->product->neighbours ['previous'][0])) {
  372.                         $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);
  373.                         echo JHTML::_('link', $prev_link, '<i class="fa fa-caret-left"></i> ' . $this->product->neighbours ['previous'][0] ['product_name'], array('rel'=>'prev', 'class' => 'previous-page'));
  374.                     }
  375.                     if (!empty($this->product->neighbours ['next'][0])) {
  376.                         $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);
  377.                         echo JHTML::_('link', $next_link, $this->product->neighbours ['next'][0] ['product_name'] . ' <i class="fa fa-caret-right"></i>', array('rel'=>'next','class' => 'next-page'));
  378.                     }
  379.                     ?>
  380.                 </div>
  381.             <?php } ?>
  382.         </div>
  383.     </div>
  384. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement