Advertisement
Guest User

HIKA SHOP CART VIEW

a guest
Sep 26th, 2012
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.80 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @package    HikaShop for Joomla!
  4.  * @version    1.5.5
  5.  * @author    hikashop.com
  6.  * @copyright  (C) 2010-2011 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. ?>
  11. <?php
  12. $this->setLayout('listing_price');
  13. $this->params->set('show_quantity_field', 0);
  14. $desc = $this->params->get('msg');
  15. if(empty($desc)){
  16.   $this->params->set('msg',JText::_('CART_EMPTY'));
  17. }
  18. if(!headers_sent()){
  19.   header( 'Cache-Control: no-store, no-cache, must-revalidate' );
  20.   header( 'Cache-Control: post-check=0, pre-check=0', false );
  21.   header( 'Pragma: no-cache' );
  22. }
  23. if(empty($this->rows)){
  24.   $desc = trim($this->params->get('msg'));
  25.   if(!empty($desc)){
  26.     echo $this->notice_html;  ?>
  27.     <div id="hikashop_cart" class="hikashop_cart">
  28.       <?php echo $desc; ?>
  29.     </div>
  30.     <div class="clear_both"></div>
  31. <?php
  32.   }
  33. }else{ ?>
  34. <div id="hikashop_cart" class="hikashop_cart">
  35.   <?php
  36.   echo $this->notice_html;
  37.   $row_count = 1;
  38.   global $Itemid;
  39.   $url_itemid='';
  40.   if(!empty($Itemid)){
  41.     $url_itemid='&Itemid='.$Itemid;
  42.   }
  43.   if($this->params->get('small_cart')){
  44.     $this->row=$this->total;
  45.     if($this->params->get('show_cart_quantity',1)){
  46.       $qty = 0;
  47.       foreach($this->rows as $i => $row){
  48.         if(empty($row->cart_product_quantity)) continue;
  49.         $qty+=$row->cart_product_quantity;
  50.       }
  51.       $text = JText::sprintf('X_ITEMS_FOR_X',$qty,$this->loadTemplate());
  52.     }else{
  53.       $text = JText::sprintf('TOTAL_IN_CART_X',$this->loadTemplate());
  54.     } ?>
  55.     <a class="hikashop_small_cart_checkout_link" href="<?php echo hikashop_completeLink('checkout'.$url_itemid); ?>">
  56.       <span class="hikashop_small_cart_total_title"><?php echo $text; ?></span>
  57.     </a><?php
  58.     if($this->params->get('show_cart_delete',1)){
  59.       $delete = hikashop_completeLink('product&task=cleancart');
  60.       if(strpos($delete,'?')){
  61.         $delete.='&amp;';
  62.       }else{
  63.         $delete.='?';
  64.       } ?>
  65.     <a class="hikashop_small_cart_clean_link" href="<?php echo $delete.'return_url='. urlencode(base64_encode(hikashop_currentURL('url'))); ?>" >
  66.       <img src="<?php echo HIKASHOP_IMAGES . 'delete2.png';?>" border="0" alt="clean cart" />
  67.     </a><?php
  68.     }
  69.   }else{
  70.   ?>
  71.   <form action="<?php echo hikashop_completeLink('product&task=updatecart'.$url_itemid,false,true); ?>" method="post" name="hikashop_cart_form">
  72.     <table width="100%">
  73.       <thead>
  74.         <tr>
  75.           <th class="hikashop_cart_module_product_name_title hikashop_cart_title">
  76.             <?php echo JText::_('CART_PRODUCT_NAME'); ?>
  77.           </th>
  78.           <?php if($this->params->get('show_cart_quantity',1)){
  79.             $row_count++; ?>
  80.             <th class="hikashop_cart_module_product_quantity_title hikashop_cart_title">
  81.               <?php echo JText::_('CART_PRODUCT_QUANTITY'); ?>
  82.             </th>
  83.           <?php }
  84.           if($this->params->get('show_cart_price',1)){
  85.             $row_count++; ?>
  86.           <th class="hikashop_cart_module_product_price_title hikashop_cart_title">
  87.             <?php echo JText::_('CART_PRODUCT_PRICE'); ?>
  88.           </th>
  89.           <?php }
  90.           if($this->params->get('show_cart_delete',1)){
  91.             $row_count++; ?>
  92.           <th class="hikashop_cart_title">
  93.           </th>
  94.           <?php }
  95.           if($row_count<2){ ?>
  96.           <th></th>
  97.           <?php }?>
  98.         </tr>
  99.       </thead>
  100.       <?php if($this->params->get('show_cart_price',1)){ ?>
  101.       <tfoot>
  102.         <tr>
  103.           <td colspan="<?php echo $row_count;?>">
  104.             <hr></hr>
  105.           </td>
  106.         </tr>
  107.         <tr>
  108.           <?php if($this->params->get('show_cart_quantity',1)){ ?>
  109.             <td>
  110.             </td>
  111.           <?php }?>
  112.           <td class="hikashop_cart_module_product_total_title">
  113.             <?php echo JText::_('HIKASHOP_TOTAL'); ?>
  114.           </td>
  115.           <td class="hikashop_cart_module_product_total_value">
  116.           <?php
  117.             $this->row=$this->total;
  118.             echo $this->loadTemplate();
  119.           ?>
  120.           </td>
  121.           <?php if($this->params->get('show_cart_delete',1)){ ?>
  122.             <td>
  123.             </td>
  124.           <?php }?>
  125.         </tr>
  126.       </tfoot>
  127.       <?php } ?>
  128.       <tbody>
  129.         <?php
  130.           $k = 0;
  131.           $this->cart_product_price = true;
  132.           $group = $this->config->get('group_options',0);
  133.           foreach($this->rows as $i => $row){
  134.             if(empty($row->cart_product_quantity)) continue;
  135.             if($group && $row->cart_product_option_parent_id) continue;
  136.             ?>
  137.             <tr class="<?php echo "row$k"; ?>">
  138.               <td class="hikashop_cart_module_product_name_value hikashop_cart_value">
  139.                 <a href="<?php echo hikashop_completeLink('product&task=show&cid='.$row->product_id.$url_itemid);?>" ><?php echo $row->product_name; ?></a>
  140.                 <p class="hikashop_cart_product_custom_item_fields">
  141.                   <?php
  142.                   if(hikashop_level(2) && !empty($this->itemFields)){
  143.                     foreach($this->itemFields as $field){
  144.                       $namekey = $field->field_namekey;
  145.                       if(!empty($row->$namekey)){
  146.                         echo '<p class="hikashop_cart_item_'.$namekey.'">'.$this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$row->$namekey).'</p>';
  147.                       }
  148.                     }
  149.                   }
  150.                 $input='';
  151.                 if($group){
  152.                   foreach($this->rows as $j => $optionElement){
  153.                     if($optionElement->cart_product_option_parent_id != $row->cart_product_id) continue;
  154.                     if(!empty($optionElement->prices[0])){
  155.                       if(!isset($row->prices[0])) $row->prices[0]->price_value=0;
  156.                       foreach(get_object_vars($row->prices[0]) as $key => $value){
  157.                         if(is_object($value)){
  158.                           foreach(get_object_vars($value) as $key2 => $var2){
  159.                             if(strpos($key2,'price_value')!==false) $row->prices[0]->$key->$key2 +=$optionElement->prices[0]->$key->$key2;
  160.                           }
  161.                         }else{
  162.                           if(strpos($key,'price_value')!==false) $row->prices[0]->$key+=@$optionElement->prices[0]->$key;
  163.                         }
  164.                       }
  165.                     }
  166.                      ?>
  167.                       <p class="hikashop_cart_option_name">
  168.                         <?php
  169.                           echo $optionElement->product_name;
  170.                         ?>
  171.                       </p>
  172.                   <?php
  173.                   $input .='document.getElementById(\'cart_product_option_'.$optionElement->cart_product_id.'\').value=qty_field.value;';
  174.                   echo '<input type="hidden" id="cart_product_option_'.$optionElement->cart_product_id.'" name="item['.$optionElement->cart_product_id.'][cart_product_quantity]" value="'.$row->cart_product_quantity.'"/>';
  175.                   }
  176.                 }
  177.                   ?>
  178.                 </p>
  179.               </td>
  180.               <?php if($this->params->get('show_cart_quantity',1)){ ?>
  181.               <td class="hikashop_cart_module_product_quantity_value hikashop_cart_value">
  182.                 <input id="hikashop_cart_quantity_<?php echo $row->cart_product_id;?>" type="text" name="item[<?php echo $row->cart_product_id;?>][cart_product_quantity]" class="hikashop_product_quantity_field" value="<?php echo $row->cart_product_quantity; ?>" onchange="var qty_field = document.getElementById('hikashop_cart_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field){<?php echo $input; ?> } document.hikashop_cart_form.submit(); return false;" />
  183.               </td>
  184.               <?php }
  185.               if($this->params->get('show_cart_price',1)){ ?>
  186.               <td class="hikashop_cart_module_product_price_value hikashop_cart_value">
  187.                 <?php
  188.                 $this->row=&$row;
  189.                 echo $this->loadTemplate();
  190.                 ?>
  191.               </td>
  192.               <?php }
  193.               if($this->params->get('show_cart_delete',1)){ ?>
  194.               <td class="hikashop_cart_module_product_delete_value hikashop_cart_value">
  195.                 <a href="<?php echo hikashop_completeLink('product&task=updatecart&cart_product_id='.$row->cart_product_id.'&quantity=0&return_url='.urlencode(base64_encode(urldecode($this->params->get('url'))))); ?>" onclick="var qty_field = document.getElementById('hikashop_cart_quantity_<?php echo $row->cart_product_id;?>'); if(qty_field){qty_field.value=0;<?php echo $input; ?> document.hikashop_cart_form.submit(); return false;}else{ return true;}"  title="<?php echo JText::_('HIKA_DELETE'); ?>"><img src="<?php echo HIKASHOP_IMAGES . 'delete2.png';?>" border="0" alt="<?php echo JText::_('HIKA_DELETE'); ?>" /></a>
  196.               </td>
  197.               <?php }
  198.               if($row_count<2){ ?>
  199.               <td></td>
  200.               <?php }?>
  201.             </tr>
  202.             <?php
  203.             $k = 1-$k;
  204.           }
  205.           $this->cart_product_price=false;
  206.         ?>
  207.       </tbody>
  208.     </table>
  209.       <?php
  210.       if($this->params->get('show_cart_quantity',1)){ ?>
  211.         <noscript>
  212.           <input type="submit" class="button" name="refresh" value="<?php echo JText::_('REFRESH_CART');?>"/>
  213.         </noscript>
  214.   <?php }
  215.       ?>
  216.         <br />
  217.     <a href="/checkout/" id="proceed"></a>
  218.     <br />
  219.     <input type="hidden" name="url" value=<?php echo $this->params->get('url');?>/>
  220.     <input type="hidden" name="ctrl" value="product"/>
  221.     <input type="hidden" name="task" value="updatecart"/>
  222.   </form>
  223.   <?php } ?>
  224. </div>
  225. <div class="clear_both"></div>
  226. <?php } ?>
  227. <?php
  228. if(JRequest::getWord('tmpl','')=='component'){
  229.   exit;
  230. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement