roxcoder

Untitled

Feb 8th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 17.63 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @package HikaShop for Joomla!
  4.  * @version 2.3.2
  5.  * @author  hikashop.com
  6.  * @copyright   (C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
  7.  * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
  8.  */
  9. defined('_JEXEC') or die('Restricted access');
  10. ?><?php
  11. $canonical=false;
  12. if(!empty($this->element->main->product_canonical)){
  13.     $canonical = $this->element->main->product_canonical;
  14. }elseif(!empty($this->element->product_canonical)){
  15.     $canonical = $this->element->product_canonical;
  16. }
  17. if($canonical){
  18.     $doc = JFactory::getDocument();
  19.     $doc->addCustomTag( '<link rel="canonical" href="'.hikashop_cleanURL($canonical).'" />' );
  20. }
  21. ?>
  22.  
  23. <div id="hikashop_product_<?php echo preg_replace('#[^a-z0-9]#i','_',@$this->element->product_code); ?>_page" class="hikashop_product_page">
  24. <?php
  25. $app = JFactory::getApplication();
  26. if (empty ($this->element)) {
  27.     $app->enqueueMessage(JText::_('PRODUCT_NOT_FOUND'));
  28. } else {
  29.     if(!empty($this->links->previous))
  30.         echo "<a title='".JText :: _('PREVIOUS_PRODUCT')."' href='".$this->links->previous."'><span class='hikashop_previous_product'></span></a>";
  31.     if(!empty($this->links->next))
  32.         echo "<a title='".JText :: _('NEXT_PRODUCT')."' href='".$this->links->next."'><span class='hikashop_next_product'></span></a>";
  33.     echo "<div class='clear_both'></div>";
  34.     ?>
  35.     <form action="<?php echo hikashop_completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form" enctype="multipart/form-data">
  36.     <?php
  37.         $this->variant_name ='';
  38.         if(!empty($this->element->variants)&&$this->config->get('variant_increase_perf',1)&&!empty($this->element->main)){
  39.             foreach (get_object_vars($this->element->main) as $name=>$value) {
  40.                 if(!is_array($name)&&!is_object($name)){
  41.                     if(empty($this->element->$name)){
  42.                         if($name=='product_quantity' && $this->element->$name==0){
  43.                             continue;
  44.                         }
  45.                         $this->element->$name=$this->element->main->$name;
  46.                         continue;
  47.                     }
  48.  
  49.                 }
  50.                 if($this->params->get('characteristic_display')=='list' && !empty ($this->element->characteristics) && !empty($this->element->main->characteristics)){
  51.                     $this->element->$name = $this->element->main->$name;
  52.                 }
  53.             }
  54.         }
  55.         $this->setLayout($this->productlayout);
  56.         echo $this->loadTemplate();
  57.     ?>
  58.     <?php if($this->productlayout != 'show_tabular'){ ?>
  59.         <input type="hidden" name="cart_type" id="type" value="cart"/>
  60.         <input type="hidden" name="add" value="1"/>
  61.         <input type="hidden" name="ctrl" value="product"/>
  62.         <input type="hidden" name="task" value="updatecart"/>
  63.         <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
  64.     </form>
  65.  
  66.     <?php
  67.     }
  68.     if($this->params->get('characteristic_display')=='list'){
  69.         $this->setLayout('show_block_characteristic');
  70.         echo $this->loadTemplate();
  71.     } ?>
  72.  
  73.     <!-- Product details bottom -->
  74.     <div id="product-details-bottom" class="product-details-bottom">
  75.         <div class="tab">
  76.             <div class="tabbale">
  77.                 <ul class="nav nav-tabs" id="tab1">
  78.                     <li class="active">
  79.                         <a href="#tab1-tab1" data-toggle="tab"><?php echo JText::_('SP_DESCRIPTION') ?></a>
  80.                     </li>
  81.                     <?php if($this->params->get('show_vote_product')){ ?>
  82.                     <!-- if vote is enable -->
  83.                     <li class="">
  84.                         <a href="#tab1-tab2" data-toggle="tab"><?php echo JText::_('SP_REVIEWS') ?></a>
  85.                     </li>
  86.                     <?php } ?>
  87.                    
  88.                     <?php $config =& hikashop_config();
  89.                             if($config->get('enable_status_vote') == "comment" || $config->get('enable_status_vote') == "two" || $config->get('enable_status_vote') == "both" ){
  90.                     ?>
  91.                     <li class="">
  92.                         <a href="#tab1-tab3" data-toggle="tab"><?php echo JText::_('SP_LEAVE_REVIEW') ?></a>
  93.                     </li>
  94.                     <?php } ?>
  95.                 </ul>
  96.                 <div class="tab-content">
  97.                     <div class="tab-pane fade active in" id="tab1-tab1">
  98.                         <!-- Tab Product description -->
  99.                         <legend>Product Description</legend>
  100.                         <p>
  101.                             <?php
  102.                             echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description));
  103.                             ?>
  104.                         </p>
  105.                     </div> <!-- END:: tab 1 -->
  106.                     <div class="tab-pane fade" id="tab1-tab2">
  107.                         <?php
  108.                         if($this->productlayout != 'show_tabular'){
  109.                             $config =& hikashop_config();
  110.                             if($config->get('enable_status_vote') == "comment" || $config->get('enable_status_vote') == "two" || $config->get('enable_status_vote') == "both" ){ ?>
  111.                             <legend>Product Reviews</legend>
  112.                             <form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form" id="hikashop_comment_form">
  113.                                 <div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
  114.                                     <?php
  115.                                     if($this->params->get('show_vote_product')){
  116.                                         $js = '';
  117.                                         if(isset($this->element->main)){
  118.                                             $product_id = $this->element->main->product_id;
  119.                                         }else{
  120.                                             $product_id = $this->element->product_id;
  121.                                         }
  122.                                         $this->params->set('product_id',$product_id);
  123.                                         echo hikashop_getLayout('vote', 'listing', $this->params, $js);
  124.                                         ?>
  125.                                     </div>
  126.                             </form>
  127.                         <?php } } ?>
  128.                     </div> <!-- END:: tab 2 -->
  129.  
  130.                     <div class="tab-pane fade" id="tab1-tab3">
  131.                         <?php
  132.                         if($this->productlayout != 'show_tabular'){
  133.                             $config =& hikashop_config();
  134.                             if($config->get('enable_status_vote') == "comment" || $config->get('enable_status_vote') == "two" || $config->get('enable_status_vote') == "both" ){ ?>
  135.                             <form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form" id="hikashop_comment_form">
  136.                                     <legend>Write a Review</legend>
  137.                                     <div id="hikashop_product_vote_form" class="hikashop_product_vote_form">
  138.                                         <?php
  139.                                         $js = '';
  140.                                         if(isset($this->element->main)){
  141.                                             $product_id = $this->element->main->product_id;
  142.                                         }else{
  143.                                             $product_id = $this->element->product_id;
  144.                                         }
  145.                                         $this->params->set('product_id',$product_id);
  146.                                         echo hikashop_getLayout('vote', 'form', $this->params, $js);
  147.                                     }
  148.                                     ?>
  149.                                 </div>
  150.                                 <input type="hidden" name="add" value="1"/>
  151.                                 <input type="hidden" name="ctrl" value="product"/>
  152.                                 <input type="hidden" name="task" value="show"/>
  153.                                 <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
  154.                             </form>
  155.                         <?php } } ?>
  156.  
  157.                     </div> <!-- END:: tab3 -->
  158.                 </div>
  159.             </div>
  160.         </div>
  161.     </div>
  162.  
  163.     <?php $contact = $this->config->get('product_contact',0); ?>
  164.     <?php
  165.         if(empty($this->element->variants) || $this->params->get('characteristic_display')=='list'){
  166.             if(hikashop_level(1) && !empty($this->element->options)){
  167.                 $priceUsed = 0;
  168.                 if(!empty($this->row->prices)){
  169.                     foreach($this->row->prices as $price){
  170.                         if(isset($price->price_min_quantity) && empty($this->cart_product_price)){
  171.                             if($price->price_min_quantity<=1){
  172.                                 if($this->params->get('price_with_tax')){
  173.                                     $priceUsed = $price->price_value_with_tax;
  174.                                 } else {
  175.                                     $priceUsed = $price->price_value;
  176.                                 }
  177.                             }
  178.                         }
  179.                     }
  180.                 }
  181.                 echo '
  182.                 <input type="hidden" name="hikashop_price_product" value="'.$this->row->product_id.'" />
  183.                 <input type="hidden" id="hikashop_price_product_'.$this->row->product_id.'" value="'.$priceUsed.'" />
  184.                 <input type="hidden" id="hikashop_price_product_with_options_'.$this->row->product_id.'" value="'.$priceUsed.'" />';
  185.             }
  186.         } else {
  187.             $productClass = hikashop_get('class.product');
  188.             $productClass->generateVariantData($this->element);
  189.  
  190.             $main_images =& $this->element->main->images;
  191.  
  192.             foreach ($this->element->variants as $variant) {
  193.                 $this->row = & $variant;
  194.                 $variant_name = array ();
  195.                 if (!empty ($variant->characteristics)) {
  196.                     foreach ($variant->characteristics as $k => $ch) {
  197.                         $variant_name[] = $ch->characteristic_id;
  198.                     }
  199.                 }
  200.                 $this->element->images =& $main_images;
  201.                 if (!empty ($variant->images)) {
  202.                         $this->element->images =& $variant->images;
  203.                 }
  204.  
  205.                 $variant_name = implode('_', $variant_name);
  206.                 $this->variant_name = '_'.$variant_name;
  207.                 $this->setLayout('show_block_img');
  208.                 echo $this->loadTemplate();
  209.  
  210.                 if(!empty($variant->product_name)){ ?>
  211.                 <div id="hikashop_product_name_<?php echo $variant_name;?>" style="display:none;">
  212.                     <?php echo $variant->product_name;?>
  213.                 </div>
  214.                 <?php }
  215.                 if ($this->config->get('show_code') &&!empty($variant->product_code)){ ?>
  216.                 <div id="hikashop_product_code_<?php echo $variant_name;?>" style="display:none;">
  217.                     <?php echo $variant->product_code;?>
  218.                 </div>
  219.                 <?php } ?>
  220.                 <div id="hikashop_product_price_<?php echo $variant_name;?>" style="display:none;">
  221.                     <?php
  222.                     if($this->params->get('show_price','-1')=='-1'){
  223.                         $config =& hikashop_config();
  224.                         $this->params->set('show_price',$config->get('show_price'));
  225.                     }
  226.                     if ($this->params->get('show_price')) {
  227.                         $this->setLayout('listing_price');
  228.                         echo $this->loadTemplate();
  229.                     }
  230.     ?>
  231.                 </div>
  232.                 <?php
  233.                 if(hikashop_level(1) && !empty($this->element->options)){
  234.                     $priceUsed = 0;
  235.                     if(!empty($this->row->prices)){
  236.                         foreach($this->row->prices as $price){
  237.                             if(isset($price->price_min_quantity) && empty($this->cart_product_price)){
  238.                                 if($price->price_min_quantity<=1){
  239.                                     if($this->params->get('price_with_tax')){
  240.                                         $priceUsed = $price->price_value_with_tax;
  241.                                     }else{
  242.                                         $priceUsed = $price->price_value;
  243.                                     }
  244.  
  245.                                 }
  246.                             }
  247.                         }
  248.                     }
  249.                     echo '
  250.                     <input type="hidden" name="hikashop_price_product" value="'.$this->row->product_id.'" />
  251.                     <input type="hidden" id="hikashop_price_product_'.$this->row->product_id.'" value="'.$priceUsed.'" />
  252.                     <input type="hidden" id="hikashop_price_product_with_options_'.$this->row->product_id.'" value="'.$priceUsed.'" />';
  253.                 }
  254.                 ?>
  255.                 <div id="hikashop_product_quantity_<?php echo $variant_name;?>" style="display:none;">
  256.                     <?php
  257.  
  258.                     $this->row = & $variant;
  259.                     if(empty($this->formName)) {
  260.                         $this->formName = ',0';
  261.                         if (!$this->config->get('ajax_add_to_cart', 1)) {
  262.                             $this->formName = ',\'hikashop_product_form\'';
  263.                         }
  264.                     }
  265.                     $this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $this->formName . ',\'cart\'); } else { return false; }';
  266.                     $this->setLayout('quantity');
  267.                     echo $this->loadTemplate();
  268.     ?>
  269.                 </div>
  270.                 <div id="hikashop_product_contact_<?php echo $variant_name;?>" style="display:none;">
  271.                 <?php
  272.  
  273.                     if (hikashop_level(1) && ($contact == 2 || ($contact == 1 && !empty ($this->element->main->product_contact)))) {
  274.                         $params = @$this->params;
  275.                         global $Itemid;
  276.                         $url_itemid='';
  277.                         if(!empty($Itemid)){
  278.                             $url_itemid='&Itemid='.$Itemid;
  279.                         }
  280.                         echo $this->cart->displayButton(
  281.                             JText::_('CONTACT_US_FOR_INFO'),
  282.                             'contact_us',
  283.                             $params,
  284.                             ''.hikashop_completeLink('product&task=contact&cid=' . $variant->product_id.$url_itemid),
  285.                             'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $variant->product_id.$url_itemid) . '\';return false;'
  286.                         );
  287.                     }
  288.     ?>
  289.                 </div>
  290.                 <?php if(!empty($variant->product_description)){ ?>
  291.                 <div id="hikashop_product_description_<?php echo $variant_name;?>" style="display:none;">
  292.                     <?php echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$variant->product_description));?>
  293.                 </div>
  294.                 <?php
  295.                 }
  296.                 if ($this->config->get('weight_display', 0)) {
  297.  
  298.                     if(!empty($variant->product_weight) && bccomp($variant->product_weight,0,3)){ ?>
  299.                     <div id="hikashop_product_weight_<?php echo $variant_name;?>" style="display:none;">
  300.                         <?php echo JText::_('PRODUCT_WEIGHT').': '.rtrim(rtrim($variant->product_weight,'0'),',.').' '.JText::_($variant->product_weight_unit); ?><br />
  301.                     </div>
  302.                     <?php
  303.                     }
  304.                 }
  305.                 if ($this->config->get('dimensions_display', 0)) {
  306.  
  307.                     if (!empty ($variant->product_width) && bccomp($variant->product_width, 0, 3)) {
  308.     ?>
  309.                     <div id="hikashop_product_width_<?php echo $variant_name;?>" style="display:none;">
  310.                         <?php echo JText::_('PRODUCT_WIDTH').': '.rtrim(rtrim($variant->product_width,'0'),',.').' '.JText::_($variant->product_dimension_unit); ?><br />
  311.                     </div>
  312.                     <?php } ?>
  313.                     <?php if(!empty($variant->product_length) && bccomp($variant->product_length,0,3)){ ?>
  314.                     <div id="hikashop_product_length_<?php echo $variant_name;?>" style="display:none;">
  315.                         <?php echo JText::_('PRODUCT_LENGTH').': '.rtrim(rtrim($variant->product_length,'0'),',.').' '.JText::_($variant->product_dimension_unit); ?><br />
  316.                     </div>
  317.                     <?php } ?>
  318.                     <?php if(!empty($variant->product_height) && bccomp($variant->product_height,0,3)){ ?>
  319.                     <div id="hikashop_product_height_<?php echo $variant_name;?>" style="display:none;">
  320.                         <?php echo JText::_('PRODUCT_HEIGHT').': '.rtrim(rtrim($variant->product_height,'0'),',.').' '.JText::_($variant->product_dimension_unit); ?><br />
  321.                     </div>
  322.                     <?php
  323.  
  324.                     }
  325.                 }
  326.                 if(!empty($variant->product_url)){ ?>
  327.                 <span id="hikashop_product_url_<?php echo $variant_name;?>" style="display:none;">
  328.                     <?php
  329.                     if (!empty ($variant->product_url)) {
  330.                         echo JText :: sprintf('MANUFACTURER_URL', '<a href="' . $variant->product_url . '" target="_blank">' . $variant->product_url . '</a>');
  331.                     } ?>
  332.                 </span>
  333.                 <?php } ?>
  334.                 <span id="hikashop_product_id_<?php echo $variant_name;?>">
  335.                     <input type="hidden" name="product_id" value="<?php echo $variant->product_id; ?>" />
  336.                 </span>
  337.                 <?php if(!empty($this->fields)){?>
  338.                 <div id="hikashop_product_custom_info_<?php echo $variant_name;?>" style="display:none;">
  339.                     <h4><?php echo JText::_('SPECIFICATIONS');?></h4>
  340.                     <table width="100%">
  341.                     <?php
  342.  
  343.                 $this->fieldsClass->prefix = '';
  344.                 foreach ($this->fields as $fieldName => $oneExtraField) {
  345.                     if(empty($variant->$fieldName) && !empty($this->element->main->$fieldName)){
  346.                         $variant->$fieldName = $this->element->main->$fieldName;
  347.                     }
  348.                     if(!empty($variant->$fieldName)) $variant->$fieldName = trim($variant->$fieldName);
  349.                     if (!empty ($variant->$fieldName)) {
  350.     ?>
  351.                         <tr class="hikashop_product_custom_<?php echo $oneExtraField->field_namekey;?>_line">
  352.                             <td class="key">
  353.                                 <span id="hikashop_product_custom_name_<?php echo $oneExtraField->field_id;?>_<?php echo $variant_name;?>" class="hikashop_product_custom_name">
  354.                                     <?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
  355.                                 </span>
  356.                             </td>
  357.                             <td>
  358.                                 <span id="hikashop_product_custom_value_<?php echo $oneExtraField->field_id;?>_<?php echo $variant_name;?>" class="hikashop_product_custom_value">
  359.                                     <?php echo $this->fieldsClass->show($oneExtraField,$variant->$fieldName); ?>
  360.                                 </span>
  361.                             </td>
  362.                         </tr>
  363.                     <?php
  364.  
  365.                     }
  366.                 }
  367.     ?>
  368.                     </table>
  369.                 </div>
  370.             <?php
  371.  
  372.             }
  373.             if (!empty ($variant->files)) {
  374.                 $skip = true;
  375.                 foreach ($variant->files as $file) {
  376.                     if ($file->file_free_download)
  377.                         $skip = false;
  378.                 }
  379.                 if (!$skip) {
  380.     ?>
  381.                     <div id="hikashop_product_files_<?php echo $variant_name;?>" style="display:none;">
  382.                         <fieldset class="hikashop_product_files_fieldset">
  383.                             <?php
  384.  
  385.                     $html = array ();
  386.                     echo '<legend>' . JText :: _('DOWNLOADS') . '</legend>';
  387.                     foreach ($variant->files as $file) {
  388.                         if (empty ($file->file_name)) {
  389.                             $file->file_name = $file->file_path;
  390.                         }
  391.                         $fileHtml = '';
  392.                         if (!empty ($file->file_free_download)) {
  393.                             $fileHtml = '<a class="hikashop_product_file_link" href="' . hikashop_completeLink('product&task=download&file_id=' . $file->file_id) . '">' . $file->file_name . '</a><br/>';
  394.                         }
  395.                         $html[] = $fileHtml;
  396.                     }
  397.                     echo implode('<br/>', $html);
  398.     ?>
  399.                         </fieldset>
  400.                     </div>
  401.             <?php
  402.  
  403.                 }
  404.             }
  405.         }
  406.     }
  407.     $this->params->set('show_price_weight', 0);
  408.     ?>
  409.         <div class="hikashop_submodules" id="hikashop_submodules" style="clear:both">
  410.             <?php
  411.  
  412.     if (!empty ($this->modules) && is_array($this->modules)) {
  413.         jimport('joomla.application.module.helper');
  414.         foreach ($this->modules as $module) {
  415.             echo JModuleHelper :: renderModule($module);
  416.         }
  417.     }
  418.     ?>
  419.         </div>
  420.         <div class="hikashop_external_comments" id="hikashop_external_comments" style="clear:both">
  421.         <?php
  422.  
  423.     $config = & hikashop_config();
  424.     if ($config->get('comments_feature') == 'jcomments') {
  425.         $comments = HIKASHOP_ROOT . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
  426.         if (file_exists($comments)) {
  427.             require_once ($comments);
  428.             if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name)){
  429.                 $product_id = $this->element->main->product_id;
  430.                 $product_name = $this->element->main->product_name;
  431.             }else{
  432.                 $product_id = $this->element->product_id;
  433.                 $product_name = $this->element->product_name;
  434.             }
  435.             echo JComments::showComments($product_id, 'com_hikashop', $product_name);
  436.         }
  437.     }
  438.     elseif ($config->get('comments_feature') == 'jomcomment') {
  439.         $comments = HIKASHOP_ROOT . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php';
  440.         if (file_exists($comments)) {
  441.             require_once ($comments);
  442.             if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name))
  443.                 $product_id = $this->element->main->product_id;
  444.             else
  445.                 $product_id = $this->element->product_id;
  446.             echo jomcomment($product_id, 'com_hikashop');
  447.         }
  448.     }
  449.     ?>
  450.         </div><?php
  451.  
  452. }
  453. ?>
  454. </div>
Add Comment
Please, Sign In to add comment