Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.28 KB | None | 0 0
  1. <?php
  2. if(!empty($this->rows)){
  3.     $pagination = $this->config->get('pagination','bottom');
  4.     if(in_array($pagination,array('top','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total > $this->pageInfo->limit->value){ $this->pagination->form = '_top'; ?>
  5.     <form action="<?php echo hikashop_currentURL();?>" method="post" name="adminForm_<?php echo $this->params->get('main_div_name').$this->category_selected;?>_top">
  6.         <div class="hikashop_subcategories_pagination hikashop_subcategories_pagination_top">
  7.         <?php echo $this->pagination->getListFooter($this->params->get('limit')); ?>
  8.         <span class="hikashop_results_counter"><?php echo $this->pagination->getResultsCounter(); ?></span>
  9.         </div>
  10.         <input type="hidden" name="filter_order_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->value; ?>" />
  11.         <input type="hidden" name="filter_order_Dir_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->dir; ?>" />
  12.         <?php echo JHTML::_( 'form.token' ); ?>
  13.     </form>
  14.     <?php } ?>
  15.     <div class="hikashop_subcategories">
  16.     <?php
  17.  
  18.     $only_if_products = $this->params->get('only_if_products',0);
  19.     switch($this->params->get('child_display_type')){
  20.         case 'nochild':
  21.         default:
  22.             if(!empty($this->rows)){
  23.             ?>
  24.                 <ul class="hikashop_category_list<?php echo $this->params->get('ul_class_name'); ?>">
  25.                 <?php
  26.  
  27.                     $width = (int)(100/$this->params->get('columns'));
  28.                     if(empty($width)){
  29.                         $width='';
  30.                     }else{
  31.                         $width='style="width:'.$width.'%;"';
  32.                     }
  33.                     $app = JFactory::getApplication();
  34.                     $found = '';
  35.                     if(JRequest::getString('option')==HIKASHOP_COMPONENT && in_array(JRequest::getString('ctrl','category'),array('category','product'))){
  36.                         foreach($this->rows as $row){
  37.                             if(JRequest::getString('ctrl','category')=='product'&&JRequest::getString('task','listing')=='show'){
  38.                                 $found = $app->getUserState(HIKASHOP_COMPONENT.'.last_category_selected');
  39.                                 $config =& hikashop_config();
  40.                                 $pathway_sef_name = $config->get('pathway_sef_name','category_pathway');
  41.                                 $cid = JRequest::getInt($pathway_sef_name,0);
  42.                             }else{
  43.                                 $cid = JRequest::getInt('cid',0);
  44.                             }
  45.                             if($cid == $row->category_id){
  46.                                 $found=$row->category_id;
  47.                                 $app->setUserState(HIKASHOP_COMPONENT.'.last_category_selected',$row->category_id);
  48.                                 break;
  49.                             }
  50.                         }
  51.                     }
  52.                     foreach($this->rows as $row){
  53.                         if($only_if_products && $row->number_of_products<1) continue;
  54.                         $link = $this->getLink($row);
  55.                         $class = '';
  56.                         if($found == $row->category_id){
  57.                                 $class=' current active';
  58.                         }
  59.                         ?>
  60.                         <li class="hikashop_category_list_item<?php echo $class; ?>" <?php echo $width; ?>>
  61.                             <a href="<?php echo $link; ?>" >
  62.                             <?php
  63.                                 echo $row->category_name;
  64.                                 if($this->params->get('number_of_products',0)){
  65.                                     echo ' ('.$row->number_of_products.')';
  66.                                 }
  67.                              ?>
  68.                             </a>
  69.                         </li>
  70.                         <?php
  71.                     }
  72.                 ?>
  73.                 </ul>
  74.         <?php
  75.             }
  76.             break;
  77.         case 'allchildsexpand':
  78.             ?>
  79.             <div id="category_panel_<?php echo $this->params->get('id');?>" class="pane-sliders">
  80.             <?php
  81.             if(!empty($this->rows)){
  82.                 foreach($this->rows as $k => $row){
  83.                     if($only_if_products && $row->number_of_products<1) continue;
  84.                     if($this->params->get('number_of_products',0)){
  85.                         $row->category_name.= ' ('.$row->number_of_products.')';
  86.                     }
  87.  
  88.                     if( !$this->module || $this->params->get('links_on_main_categories')){
  89.                         $link = $this->getLink($row);
  90.                         $row->category_name = '<a href="'.$link.'">'.$row->category_name.'</a>';
  91.                     }
  92.                     ?>
  93.                     <div class="panel">
  94.                         <h4 class="jpane-toggler title" id="category_pane_<?php echo $k;?>" style="cursor:default;">
  95.                             <span>
  96.                                 <?php echo $row->category_name; ?>
  97.                             </span>
  98.                         </h4>
  99.                         <div class="jpane-slider content">
  100.                             <ul class="hikashop_category_list<?php echo $this->params->get('ul_class_name'); ?>"><?php
  101.                             if(!empty($row->childs)){
  102.                                 $app = JFactory::getApplication();
  103.                                 $found='';
  104.                                 if(JRequest::getString('option')==HIKASHOP_COMPONENT && in_array(JRequest::getString('ctrl','category'),array('category','product'))){
  105.                                     if(JRequest::getString('ctrl','category')=='product'&&JRequest::getString('task','listing')=='show'){
  106.                                         $found = $app->getUserState(HIKASHOP_COMPONENT.'.last_category_selected');
  107.                                         $config =& hikashop_config();
  108.                                         $pathway_sef_name = $config->get('pathway_sef_name','category_pathway');
  109.                                         $cid = JRequest::getInt($pathway_sef_name,0);
  110.                                     }else{
  111.                                         $cid = JRequest::getInt('cid',0);
  112.                                     }
  113.                                     foreach($row->childs as $child){
  114.  
  115.                                         if($cid == $child->category_id){
  116.  
  117.                                             $found=$child->category_id;
  118.                                             $app->setUserState(HIKASHOP_COMPONENT.'.last_category_selected',$child->category_id);
  119.                                             break;
  120.                                         }
  121.                                     }
  122.                                 }
  123.  
  124.                                 $limit = $this->params->get('child_limit');
  125.                                 $i = 0;
  126.                                 foreach($row->childs as $child){
  127.                                     if($only_if_products && $child->number_of_products<1) continue;
  128.                                     if(!empty($limit) && $i >= $limit){
  129.                                         break;
  130.                                     }
  131.                                     $i++;
  132.                                     $link = $this->getLink($child);
  133.                                     $class = '';
  134.                                     if($found==$child->category_id){
  135.                                         $class=' current active';
  136.                                     }
  137.                                     ?>
  138.                                     <li class="hikashop_category_list_item<?php echo $class; ?>">
  139.                                         <a href="<?php echo $link; ?>">
  140.                                         <?php
  141.                                             echo $child->category_name;
  142.                                             if($this->params->get('number_of_products',0)){
  143.                                                 echo ' ('.$child->number_of_products.')';
  144.                                             }
  145.                                         ?>
  146.                                         </a>
  147.                                     </li>
  148.                                     <?php
  149.                                 }
  150.                             }else {
  151.                                 echo JText::_('HIKA_LISTING_LIST_EMPTY');
  152.                             }
  153.                             ?></ul>
  154.                         </div>
  155.                     </div><?php
  156.                 }
  157.             }
  158.             ?></div><?php
  159.             break;
  160.         case 'allchilds':
  161.             jimport('joomla.html.pane');
  162.             $found = -1;
  163.             if(JRequest::getString('option')==HIKASHOP_COMPONENT && in_array(JRequest::getString('ctrl','category'),array('category','product')) && $cid = JRequest::getInt('cid',0)){
  164.                 if(JRequest::getString('ctrl','category')=='product'&&JRequest::getString('task','listing')=='show'){
  165.                     $config =& hikashop_config();
  166.                     $pathway_sef_name = $config->get('pathway_sef_name','category_pathway');
  167.                     $cid = JRequest::getInt($pathway_sef_name,0);
  168.                     if(empty($cid)){
  169.                         $database = JFactory::getDBO();
  170.                         $query = "SELECT category_id FROM ".hikashop_table('product_category').' WHERE product_id='.hikashop_getCID('product_id').' ORDER BY product_category_id ASC';
  171.                         $database->setQuery($query);
  172.                         $cid = $database->loadResult();
  173.                         if(empty($cid)){
  174.                             $class=hikashop_get('class.product');
  175.                             $product = $class->get(hikashop_getCID('product_id'));
  176.                             if($product && $product->product_type=='variant' && $product->product_parent_id){
  177.                                 $query = "SELECT category_id FROM ".hikashop_table('product_category').' WHERE product_id='.$product->product_parent_id.' ORDER BY product_category_id ASC';
  178.                                 $database->setQuery($query);
  179.                                 $cid = $database->loadResult();
  180.                             }
  181.                         }
  182.                     }
  183.                 }
  184.                 $i=0;
  185.                 if(!empty($this->rows)){
  186.                     foreach($this->rows as $k => $row){
  187.                         if($only_if_products && $row->number_of_products<1) continue;
  188.                         if($row->category_id==$cid){
  189.                             $found = $i;
  190.                             break;
  191.                         }
  192.                         if(!empty($row->childs)){
  193.                             foreach($row->childs as $child){
  194.                                 if($child->category_id==$cid){
  195.                                     $found = $i;
  196.                                     break 2;
  197.                                 }
  198.                             }
  199.                         }
  200.                         $i++;
  201.                     }
  202.                     $app = JFactory::getApplication();
  203.                     if($found>=0){
  204.                         $app->setUserState(HIKASHOP_COMPONENT.'.last_category_selected',$found);
  205.                     }elseif(JRequest::getString('ctrl','category')!='category'||JRequest::getString('task','listing')!='listing'){
  206.                         $found = (int)$app->getUserState(HIKASHOP_COMPONENT.'.last_category_selected');
  207.                     }
  208.                 }
  209.  
  210.             }else{
  211.                 $cid = 0;
  212.             }
  213.  
  214.             $this->tabs = hikashop_get('helper.sliders');
  215.             $this->tabs->setOptions(array('startOffset'=>$found,'startTransition'=>0,'displayFirst'=>0));
  216.             echo $this->tabs->startPane( 'category_panel_'.$this->params->get('id'));
  217.             if(!empty($this->rows)){
  218.                 foreach($this->rows as $k => $row){
  219.                     if($only_if_products && $row->number_of_products<1) continue;
  220.                     if($this->params->get('number_of_products',0)){
  221.                         $row->category_name.= ' ('.$row->number_of_products.')';
  222.                     }
  223.  
  224.                     if( !$this->module || $this->params->get('links_on_main_categories')){
  225.                         $link = $this->getLink($row);
  226.                         $row->category_name = '<a href="'.$link.'">'.$row->category_name.'</a>';
  227.                     }
  228.  
  229.                     // Allow to open the slider of the currently displayed category
  230.                     $toOpen = false;
  231.                     if($row->category_id == hikashop_getCid())
  232.                         $toOpen = true;
  233.                     if(!empty($row->childs)){
  234.                         foreach($row->childs as $child){
  235.                             if($child->category_id == hikashop_getCid())
  236.                                 $toOpen = true;
  237.                         }
  238.                     }
  239.  
  240.                     echo $this->tabs->startPanel($row->category_name, 'category_pane_'.$k, !empty($row->childs), $toOpen);
  241.                     if(!empty($row->childs)){
  242.                         ?><ul class="hikashop_category_list<?php echo $this->params->get('ul_class_name'); ?>"><?php
  243.                             foreach($row->childs as $child){
  244.                                 if($only_if_products && $child->number_of_products<1) continue;
  245.                                 $class = '';
  246.                                 if($cid==$child->category_id){
  247.                                     $class=' current active';
  248.                                 }
  249.                                 $link = $this->getLink($child);
  250.                                 ?>
  251.                                 <li class="hikashop_category_list_item<?php echo $class; ?>">
  252.                                     <a class="hikashop_category_list_item_link" href="<?php echo $link; ?>">
  253.                                     <?php
  254.                                         echo $child->category_name;
  255.                                         if($this->params->get('number_of_products',0)){
  256.                                             echo ' ('.$child->number_of_products.')';
  257.                                         }
  258.                                     ?>
  259.                                     </a>
  260.                                 </li>
  261.                                 <?php
  262.                             }
  263.                         ?></ul><?php
  264.                     } else {
  265.                         echo JText::_('HIKA_LISTING_LIST_EMPTY');
  266.                     }
  267.                     echo $this->tabs->endPanel();
  268.                 }
  269.             }
  270.             echo $this->tabs->endPane();
  271.  
  272.             break;
  273.     }
  274.     ?>
  275.     </div>
  276.     <?php if(in_array($pagination,array('bottom','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total > $this->pageInfo->limit->value){ $this->pagination->form = '_bottom'; ?>
  277.     <form action="<?php echo hikashop_currentURL();?>" method="post" name="adminForm_<?php echo $this->params->get('main_div_name').$this->category_selected;?>_bottom">
  278.         <div class="hikashop_subcategories_pagination hikashop_subcategories_pagination_bottom">
  279.         <?php echo $this->pagination->getListFooter($this->params->get('limit')); ?>
  280.         <span class="hikashop_results_counter"><?php echo $this->pagination->getResultsCounter(); ?></span>
  281.         </div>
  282.         <input type="hidden" name="filter_order_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->value; ?>" />
  283.         <input type="hidden" name="filter_order_Dir_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->dir; ?>" />
  284.         <?php echo JHTML::_( 'form.token' ); ?>
  285.     </form>
  286.     <?php }
  287. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement