Advertisement
Guest User

product/cart.php

a guest
Jul 25th, 2014
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 27.26 KB | None | 0 0
  1. <?php
  2. global $Itemid;
  3. $url_itemid='';
  4. //check that the current menu is a HikaShop menu item and remove the Itemid if that's not the case
  5. if(!empty($Itemid)){
  6.     $menuClass = hikashop_get('class.menus');
  7.     $current_id = $menuClass->loadAMenuItemId('','',$Itemid);
  8.     if($current_id){
  9.         $url_itemid='&Itemid='.$Itemid;
  10.     }
  11. }
  12. //if the current itemid is not a HikaShop mneu item load one
  13. if(empty($url_itemid)){
  14.     $menuClass = hikashop_get('class.menus');
  15.     $random_id = $menuClass->loadAMenuItemId('','');
  16.     if($random_id){
  17.         $url_itemid='&Itemid='.$random_id;
  18.     }
  19. }
  20. //try to load the itemid of the checkout from the config in order to directly display the correct link to the checkout
  21. $itemid_for_checkout = (int)$this->config->get('checkout_itemid','0');
  22. if(empty($itemid_for_checkout)){
  23.     $menuClass = hikashop_get('class.menus');
  24.     $itemid_for_checkout = $menuClass->getCheckoutMenuIdForURL();
  25. }
  26. if(!empty($itemid_for_checkout)){
  27.     $url_checkout = hikashop_completeLink('checkout&Itemid='.$itemid_for_checkout);
  28. }else{
  29.     $url_checkout = hikashop_completeLink('checkout'.$url_itemid);
  30. }
  31. $this->setLayout('listing_price');
  32. $this->params->set('show_quantity_field', 0);
  33. $desc = $this->params->get('msg');
  34. $cart_type = $this->params->get('cart_type','cart');
  35. $cart_itemid = $url_itemid;
  36. if($cart_type == 'wishlist'){
  37.     $convertText = JText::_('WISHLIST_TO_CART');
  38.     $displayText = JText::_('DISPLAY_THE_WISHLIST');
  39.     $displayAllText = JText::_('DISPLAY_THE_WISHLISTS');
  40.     $emptyText = JText::_('WISHLIST_EMPTY');
  41.  
  42.     // Set a custom item id for the wishlist page
  43.     $menusClass = hikashop_get('class.menus');
  44.     $set = $menusClass->loadAMenuItemId('cart','showcart',$this->params->get('cart_itemid', 0));
  45.     if(!$set)
  46.         $set = $menusClass->loadAMenuItemId('cart','showcart');
  47.     if(!$set)
  48.         $set = $menusClass->loadAMenuItemId('','');
  49.     if($set)
  50.         $cart_itemid='&Itemid='.$set;
  51. }else{
  52.     $convertText = JText::_('CART_TO_WISHLIST');
  53.     $displayText = JText::_('DISPLAY_THE_CART');
  54.     $displayAllText = JText::_('DISPLAY_THE_CARTS');
  55.     $emptyText = JText::_('CART_EMPTY');
  56. }
  57. if(empty($desc) && $desc != '0'){
  58.     $this->params->set('msg',$emptyText);
  59. }
  60. if(!headers_sent()){
  61.     header( 'Cache-Control: no-store, no-cache, must-revalidate' );
  62.     header( 'Cache-Control: post-check=0, pre-check=0', false );
  63.     header( 'Pragma: no-cache' );
  64. }
  65. $cart_type=$this->params->get('cart_type','cart');
  66. if($this->params->get('from','no') == 'no'){
  67.     $this->params->set('from',JRequest::getString('from','display'));
  68. }
  69. if(empty($this->rows)){
  70.     $desc = trim($this->params->get('msg'));
  71.     if(!empty($desc) || $desc == '0'){
  72.         echo $this->notice_html;  ?>
  73.         <div id="hikashop_cart" class="hikashop_cart">
  74.             <?php echo $desc; ?>
  75.         </div>
  76.         <div class="clear_both"></div>
  77. <?php
  78.     }
  79. }else{ ?>
  80. <div id="hikashop_cart" class="hikashop_cart">
  81.     <?php
  82.     if($this->config->get('print_cart',0) && JRequest::getVar('tmpl','')!='component' && $cart_type != 'wishlist'){
  83.     ?>
  84.     <div class="_hikashop_checkout_cart_print_link">
  85.     <?php
  86.         echo $this->popup->display(
  87.             '<img src="'.HIKASHOP_IMAGES.'print.png" alt="'.JText::_('HIKA_PRINT').'" />',
  88.             'HIKA_PRINT',
  89.             hikashop_completeLink('checkout&task=printcart',true),
  90.             'hikashop_print_popup',
  91.             760, 480, '', '', 'link'
  92.         );
  93.     ?>
  94.     </div>
  95. <?php
  96.     }
  97.     else if($this->params->get('from','display') != 'module'){
  98.         echo '<div class="hikashop_product_cart_links">';
  99.             echo '<div class="hikashop_product_cart_show_carts_link">';
  100.                 echo $this->cart->displayButton($displayAllText,'cart',$this->params,hikashop_completeLink('cart&task=showcarts&cart_type='.$cart_type.$cart_itemid),'');
  101.             echo '</div>';
  102. ?>
  103.             <div class="hikashop_product_cart_mail_link">
  104.             <?php
  105.                 echo $this->popup->display(
  106.                     '<img src="'.HIKASHOP_IMAGES.'go.png" alt="'.JText::_('HIKA_EMAIL').'" />',
  107.                     'HIKA_EMAIL',
  108.                     hikashop_completeLink('product&task=sendcart',true),
  109.                     'hikashop_email_popup',
  110.                     760, 480, '', '', 'link'
  111.                 );
  112.             ?>
  113.             </div>
  114.             <div class="hikashop_product_cart_print_link">
  115.             <?php
  116.                 echo $this->popup->display(
  117.                     '<img src="'.HIKASHOP_IMAGES.'print.png" alt="'.JText::_('HIKA_PRINT').'" />',
  118.                     'HIKA_PRINT',
  119.                     hikashop_completeLink('product&task=printcart',true),
  120.                     'hikashop_print_popup',
  121.                     760, 480, '', '', 'link'
  122.                 );
  123.             ?>
  124.             </div>
  125. <?php
  126.         echo '</div><div class="clear_both"></div>';
  127.     }
  128.  
  129.     echo $this->notice_html;
  130.     $row_count = 0;
  131.  
  132.     if($this->params->get('small_cart')){
  133.         $this->row=$this->total;
  134.         if($this->params->get('show_cart_quantity',1)){
  135.             $qty = 0;
  136.             $group = $this->config->get('group_options',0);
  137.             foreach($this->rows as $i => $row){
  138.                 if(empty($row->cart_product_quantity) && $cart_type  != 'wishlist') continue;
  139.                 if($group && $row->cart_product_option_parent_id) continue;
  140.                 $qty+=$row->cart_product_quantity;
  141.             }
  142.             if($qty==1){
  143.                 if(JText::_('X_ITEM_FOR_X')=='X_ITEM_FOR_X'){
  144.                     $text = JText::sprintf('X_ITEMS_FOR_X',$qty,$this->loadTemplate());
  145.                 }else{
  146.                     $text = JText::sprintf('X_ITEM_FOR_X',$qty,$this->loadTemplate());
  147.                 }
  148.             }else{
  149.                 $text = JText::sprintf('X_ITEMS_FOR_X',$qty,$this->loadTemplate());
  150.             }
  151.         }else{
  152.             $text = JText::sprintf('TOTAL_IN_CART_X',$this->loadTemplate());
  153.         }
  154.  
  155.         if($cart_type != 'wishlist'){
  156.             ?>
  157.             <a class="hikashop_small_cart_checkout_link" href="<?php echo $url_checkout; ?>">
  158.                 <span class="hikashop_small_cart_total_title"><?php echo $text; ?></span>
  159.             </a><?php
  160.             if($this->params->get('show_cart_delete',1)){
  161.                 $delete = hikashop_completeLink('product&task=cleancart');
  162.                 if(strpos($delete,'?')){
  163.                     $delete.='&amp;';
  164.                 }else{
  165.                     $delete.='?';
  166.                 } ?>
  167.             <a class="hikashop_small_cart_clean_link" onclick="window.location='<?php echo $delete.'return_url='; ?>'+window.btoa(window.location); return false;" href="#" >
  168.                 <img src="<?php echo HIKASHOP_IMAGES . 'delete2.png';?>" border="0" alt="clean cart" />
  169.             </a><?php
  170.             }
  171.             if($this->params->get('show_cart_proceed',1) && $this->params->get('cart_type','cart') != 'wishlist'  && $this->params->get('from','display') == 'module'){
  172.                 echo $this->cart->displayButton(JText::_('PROCEED_TO_CHECKOUT'),'checkout',$this->params,$url_checkout,'window.location=\''.$url_checkout.'\';return false;');
  173.             }
  174.         }else{
  175.             foreach($this->rows as $row){
  176.                 $cart_id = $row->cart_id;
  177.             }
  178.             ?>
  179.             <a class="hikashop_small_cart_checkout_link" href="<?php echo hikashop_completeLink('cart&task=showcart&cart_id='.$cart_id.'&cart_type='.$cart_type.$cart_itemid); ?>">
  180.                 <span class="hikashop_small_cart_total_title"><?php echo $text; ?></span>
  181.             </a>
  182.             <?php
  183.         }
  184.     }else{
  185.         if($cart_type == 'wishlist'){
  186.                 $form = 'hikashop_wishlist_form';
  187.         }
  188.         else{
  189.             $form = 'hikashop_cart_form';
  190.         }
  191.     ?>
  192.     <form action="<?php echo hikashop_completeLink('product&task=updatecart'.$url_itemid,false,true); ?>" method="post" name="<?php echo $form;?>">
  193.         <table width="100%">
  194.             <thead>
  195.                 <tr>
  196.                     <?php if(@$this->params->get('image_in_cart')){
  197.                         $row_count++; ?>
  198.                     <th class="hikashop_cart_module_product_image_title hikashop_cart_title">
  199.                         <?php echo JText::_('CART_PRODUCT_IMAGE'); ?>
  200.                     </th>
  201.                     <?php }
  202.                     if($this->params->get('show_cart_product_name',1)){
  203.                         $row_count++; ?>
  204.                     <th class="hikashop_cart_module_product_name_title hikashop_cart_title">
  205.                         <?php echo JText::_('CART_PRODUCT_NAME'); ?>
  206.                     </th>
  207.                     <?php }
  208.                     if($this->params->get('show_cart_quantity',1)){
  209.                         $row_count++; ?>
  210.                         <th class="hikashop_cart_module_product_quantity_title hikashop_cart_title">
  211.                             <?php echo JText::_('CART_PRODUCT_QUANTITY'); ?>
  212.                         </th>
  213.                     <?php }
  214.                     if($this->params->get('show_price',1)){
  215.                         $row_count++; ?>
  216.                     <th class="hikashop_cart_module_product_price_title hikashop_cart_title">
  217.                         <?php echo JText::_('CART_PRODUCT_PRICE'); ?>
  218.                     </th>
  219.                     <?php }
  220.                     if($this->params->get('show_cart_delete',1)){
  221.                         $row_count++; ?>
  222.                     <th class="hikashop_cart_title">
  223.                     </th>
  224.                     <?php }
  225.                     if($row_count<1){ ?>
  226.                     <th></th>
  227.                     <?php }?>
  228.                 </tr>
  229.             </thead>
  230.             <?php if($this->params->get('show_price',1) && $this->params->get('cart_type','cart') != 'wishlist'){ ?>
  231.             <tfoot>
  232.                 <tr>
  233.                     <td colspan="<?php echo $row_count;?>">
  234.                         <hr />
  235.                     </td>
  236.                 </tr>
  237.                 <?php if($this->params->get('show_coupon',0) && !empty($this->element->coupon)){ ?>
  238.                 <tr>
  239.                     <?php
  240.                     switch($row_count){
  241.                         case 0:
  242.                         case 1: ?>
  243.                             <td class="hikashop_cart_module_coupon_value">
  244.                                 <?php
  245.                                 if(!$this->params->get('price_with_tax')){
  246.                                     echo $this->currencyHelper->format(@$this->element->coupon->discount_value_without_tax*-1,@$this->element->coupon->discount_currency_id);
  247.                                 }else{
  248.                                     echo $this->currencyHelper->format(@$this->element->coupon->discount_value*-1,@$this->element->coupon->discount_currency_id);
  249.                                 }
  250.                                 ?>
  251.                             </td>
  252.                             <?php
  253.                             break;
  254.  
  255.                         default:
  256.                             $colspan = $row_count-1;
  257.                             if($this->params->get('show_cart_delete',1)){
  258.                                 $colspan=$colspan-1;
  259.                             }
  260.                             if($colspan){
  261.                             ?>
  262.                             <td class="hikashop_cart_module_coupon_title" colspan="<?php echo $colspan; ?>">
  263.                                 <?php echo JText::_('HIKASHOP_COUPON'); ?>
  264.                             </td>
  265.                             <?php } ?>
  266.                             <td class="hikashop_cart_module_coupon_value">
  267.                                 <?php
  268.                                 if(!$this->params->get('price_with_tax')){
  269.                                     echo $this->currencyHelper->format(@$this->element->coupon->discount_value_without_tax*-1,@$this->element->coupon->discount_currency_id);
  270.                                 }else{
  271.                                     echo $this->currencyHelper->format(@$this->element->coupon->discount_value*-1,@$this->element->coupon->discount_currency_id);
  272.                                 }
  273.                                 ?>
  274.                             </td>
  275.                             <?php if($this->params->get('show_cart_delete',1)){ ?>
  276.                                 <td>
  277.                                 </td>
  278.                             <?php }
  279.                             break;
  280.                     }?>
  281.                 </tr>
  282.                 <?php } ?>
  283.                 <?php if($this->params->get('show_shipping',0) && !empty($this->element->shipping)){
  284.                             $shipping_price = null;
  285.                             foreach($this->element->shipping as $shipping) {
  286.                                 if(!isset($shipping->shipping_price) && isset($shipping->shipping_price_with_tax) ) {
  287.                                     $shipping->shipping_price = $shipping->shipping_price_with_tax;
  288.                                 }
  289.                                 if(isset($shipping->shipping_price)) {
  290.                                     if($shipping_price === null)
  291.                                         $shipping_price = 0.0;
  292.                                     if(!$this->params->get('price_with_tax') || !isset($shipping->shipping_price_with_tax)) {
  293.                                         $shipping_price += $shipping->shipping_price;
  294.                                     } else {
  295.                                         $shipping_price += $shipping->shipping_price_with_tax;
  296.                                     }
  297.                                 }
  298.                             }
  299.                             if($shipping_price !== null) {
  300.                                 $shipping_price = $this->currencyHelper->format($shipping_price, $this->total->prices[0]->price_currency_id);
  301.                             }
  302.                             if($shipping_price){
  303.                             ?>
  304.                             <tr>
  305.                                 <?php
  306.                                 switch($row_count){
  307.                                     case 0:
  308.                                     case 1: ?>
  309.                                         <td class="hikashop_cart_module_shipping_value">
  310.                                             <?php
  311.                                             echo $shipping_price;
  312.                                             ?>
  313.                                         </td>
  314.                                         <?php
  315.                                         break;
  316.  
  317.                                     default:
  318.                                         $colspan = $row_count-1;
  319.                                         if($this->params->get('show_cart_delete',1)){
  320.                                             $colspan=$colspan-1;
  321.                                         }
  322.                                         if($colspan){
  323.                                         ?>
  324.                                         <td class="hikashop_cart_module_shipping_title" colspan="<?php echo $colspan; ?>">
  325.                                             <?php echo JText::_('HIKASHOP_SHIPPING'); ?>
  326.                                         </td>
  327.                                         <?php } ?>
  328.                                         <td class="hikashop_cart_module_shipping_value">
  329.                                             <?php
  330.                                             echo $shipping_price;
  331.                                             ?>
  332.                                         </td>
  333.                                         <?php if($this->params->get('show_cart_delete',1)){ ?>
  334.                                             <td>
  335.                                             </td>
  336.                                         <?php }
  337.                                         break;
  338.                                 }?>
  339.                             </tr>
  340.                 <?php   }
  341.                     } ?>
  342.                 <tr>
  343.                     <?php
  344.                     switch($row_count){
  345.                         case 0:
  346.                         case 1: ?>
  347.                             <td class="hikashop_cart_module_product_total_value">
  348.                                 <?php
  349.                                 $this->row=$this->total;
  350.                                 echo $this->loadTemplate(); ?>
  351.                             </td>
  352.                             <?php
  353.                             break;
  354.  
  355.                         default:
  356.                             $colspan = $row_count-1;
  357.                             if($this->params->get('show_cart_delete',1)){
  358.                                 $colspan=$colspan-1;
  359.                             }
  360.                             if($colspan){
  361.                             ?>
  362.                             <td class="hikashop_cart_module_product_total_title" colspan="<?php echo $colspan; ?>">
  363.                                 <?php echo JText::_('HIKASHOP_TOTAL'); ?>
  364.                             </td>
  365.                             <?php } ?>
  366.                             <td class="hikashop_cart_module_product_total_value">
  367.                             <?php
  368.                                 $this->row=$this->total;
  369.                                 echo $this->loadTemplate();
  370.                             ?>
  371.                             </td>
  372.                             <?php if($this->params->get('show_cart_delete',1)){ ?>
  373.                                 <td>
  374.                                 </td>
  375.                             <?php }
  376.                             break;
  377.                     }?>
  378.                 </tr>
  379.             </tfoot>
  380.             <?php } ?>
  381.             <tbody>
  382.                 <?php
  383.                     $k = 0;
  384.                     $this->cart_product_price = true;
  385.                     $group = $this->config->get('group_options',0);
  386.                     $cart_id = 0;
  387.                     $app = JFactory::getApplication();
  388.                     $productClass = hikashop_get('class.product');
  389.  
  390.                     $defaultParams = $this->config->get('default_params');
  391.  
  392.                     $this->image = hikashop_get('helper.image');
  393.                     $height = $this->config->get('thumbnail_y');
  394.                     $width = $this->config->get('thumbnail_x');
  395.                     foreach($this->rows as $i => $row){
  396.                         $cart_id = $row->cart_id;
  397.                         if(empty($row->cart_product_quantity) || @$row->hide == 1) continue;
  398.                         if($group && $row->cart_product_option_parent_id) continue;
  399.                         $productClass->addAlias($row);
  400.                         ?>
  401.                         <tr class="<?php echo "row$k"; ?>">
  402.                             <?php if(@$this->params->get('image_in_cart')){ ?>
  403.                             <td class="hikashop_cart_module_product_image hikashop_cart_value" style="vertical-align:middle !important; text-align:center;">
  404.                                 <?php
  405.                                     $image_options = array('default' => true,'forcesize'=>$this->config->get('image_force_size',true),'scale'=>$this->config->get('image_scale_mode','inside'));
  406.                                     $img = $this->image->getThumbnail(@$row->images[0]->file_path, array('width' => $width, 'height' => $height), $image_options);
  407.                                     if($img->success) {
  408.                                         echo '<img class="hikashop_product_cart_image" title="'.$this->escape(@$row->images[0]->file_description).'" alt="'.$this->escape(@$row->images[0]->file_name).'" src="'.$img->url.'"/>';
  409.                                     }
  410.                                     //echo $this->image->display(@$row->images[0]->file_path,true,@$row->images[0]->file_name,'id="hikashop_main_image_'.$row->product_id.'" style="margin-top:10px;margin-bottom:10px;display:inline-block;vertical-align:middle"','', $width,  $height);
  411.                                 ?>
  412.                             </td>
  413.                             <?php }
  414.                             if($this->params->get('show_cart_product_name',1)){ ?>
  415.                             <td class="hikashop_cart_module_product_name_value hikashop_cart_value">
  416.                                 <?php if(@$defaultParams['link_to_product_page']){ ?> <a href="<?php echo hikashop_contentLink('product&task=show&cid='.$row->product_id.'&name='.$row->alias.$url_itemid,$row);?>" ><?php } ?>
  417.                                     <?php echo $row->product_name; ?>
  418.                                     <?php if ($this->config->get('show_code')) { ?>
  419.                                         <span class="hikashop_product_code_cart"><?php echo $row->product_code; ?></span>
  420.                                     <?php } ?>
  421.                                 <?php if(@$defaultParams['link_to_product_page']){ ?></a><?php }
  422.                                     ob_start();
  423.                                     if(hikashop_level(2) && !empty($this->itemFields)){
  424.                                         foreach($this->itemFields as $field){
  425.                                             $namekey = $field->field_namekey;
  426.                                             if(!empty($row->$namekey) && strlen($row->$namekey)){
  427.                                                 echo '<p class="hikashop_cart_item_'.$namekey.'">'.$this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$row->$namekey).'</p>';
  428.                                             }
  429.                                         }
  430.                                     }
  431.                                     $input='';
  432.                                     if($group){
  433.                                         foreach($this->rows as $j => $optionElement){
  434.                                             if($optionElement->cart_product_option_parent_id != $row->cart_product_id) continue;
  435.                                             echo '<p class="hikashop_cart_option_name">'. $optionElement->product_name.'</p>';
  436.                                             $input .='document.getElementById(\'cart_product_option_'.$optionElement->cart_product_id.'\').value=qty_field.value;';
  437.                                             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.'"/>';
  438.                                         }
  439.                                     }
  440.                                     $html = ob_get_clean();
  441.                                     if(!empty($html)){
  442.                                         echo '<p class="hikashop_cart_product_custom_item_fields">'.$html.'</p>';
  443.                                     }
  444.                                 ?>
  445.                             </td>
  446.                             <?php
  447.                             }
  448.                             if($group){
  449.                                 foreach($this->rows as $j => $optionElement){
  450.                                     if($optionElement->cart_product_option_parent_id != $row->cart_product_id) continue;
  451.                                     if(!empty($optionElement->prices[0])){
  452.                                         if(!isset($row->prices[0])){
  453.                                             $row->prices[0]->price_value=0;
  454.                                             $row->prices[0]->price_value_with_tax=0;
  455.                                             $row->prices[0]->price_currency_id = hikashop_getCurrency();
  456.                                         }
  457.                                         foreach(get_object_vars($row->prices[0]) as $key => $value){
  458.                                             if(is_object($value)){
  459.                                                 foreach(get_object_vars($value) as $key2 => $var2){
  460.                                                     if(strpos($key2,'price_value')!==false) $row->prices[0]->$key->$key2 +=@$optionElement->prices[0]->$key->$key2;
  461.                                                 }
  462.                                             }else{
  463.                                                 if(strpos($key,'price_value')!==false) $row->prices[0]->$key+=@$optionElement->prices[0]->$key;
  464.                                             }
  465.                                         }
  466.                                     }
  467.                                 }
  468.                             }
  469.                             if($this->params->get('show_cart_quantity',1)){
  470.                             ?>
  471.                             <td class="hikashop_cart_module_product_quantity_value hikashop_cart_value">
  472.                                 <?php
  473.                                     if(empty($session))
  474.                                         $session = new stdClass();
  475.                                     $session->cart_id = $app->getUserState( HIKASHOP_COMPONENT.'.'.$cart_type.'_id', 0, 'int' );
  476.  
  477.                                     if($row->cart_id == $session->cart_id && $this->params->get('from','display') != 'module'){
  478.                                         if($row->product_quantity_layout == 'show_select' || (empty($this->row->product_quantity_layout) && $this->config->get('product_quantity_display', '') == 'show_select')){
  479.                                             $min_quantity = $row->product_min_per_order;
  480.                                             $max_quantity = $row->product_max_per_order;
  481.                                             if($min_quantity == 0)
  482.                                                 $min_quantity = 1;
  483.                                             if($max_quantity == 0)
  484.                                                 $max_quantity = (int)$min_quantity * 15;
  485.                                             ?>
  486.                                                 <select id="hikashop_wishlist_quantity_select_<?php echo $this->params->get('id','0').'_'.$row->cart_product_id;?>" onchange="var qty_field = document.getElementById('hikashop_wishlist_quantity_<?php echo $this->params->get('id','0').'_'.$row->cart_product_id;?>'); qty_field.value = this.value; if (qty_field){<?php echo $input; ?> } document.<?php echo $form; ?>.submit(); return false;">
  487.                                                     <?php
  488.                                                     for($j = $min_quantity; $j <= $max_quantity; $j += $min_quantity){
  489.                                                         $selected = '';
  490.                                                         if($j == $row->cart_product_quantity)
  491.                                                             $selected = 'selected="selected"';
  492.                                                         echo '<option value="'.$j.'" '.$selected.'>'.$j.'</option>';
  493.                                                     }
  494.                                                     ?>
  495.                                                 </select>
  496.                                                 <input id="hikashop_wishlist_quantity_<?php echo $this->params->get('id','0').'_'.$row->cart_product_id;?>" type="hidden" name="item[<?php echo $row->cart_product_id;?>][cart_product_quantity]" value="<?php echo $row->cart_product_quantity; ?>"/>
  497.                                                 <?php
  498.                                         }else{
  499.                                             ?>
  500.                                             <input id="hikashop_wishlist_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_wishlist_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field){<?php echo $input; ?> } document.<?php echo $form; ?>.submit(); return false;" />
  501.                                             <?php
  502.                                         }
  503.                                     ?>
  504.  
  505.                                         <div class="hikashop_cart_product_quantity_refresh">
  506.                                             <a href="#" onclick="var qty_field = document.getElementById('hikashop_cart_quantity_<?php echo $row->cart_product_id;?>'); if (qty_field && qty_field.value != '<?php echo $row->cart_product_quantity; ?>'){<?php echo $input; ?> qty_field.form.submit(); } return false;" title="<?php echo JText::_('HIKA_REFRESH'); ?>">
  507.                                                 <img src="<?php echo HIKASHOP_IMAGES . 'refresh.png';?>" border="0" alt="<?php echo JText::_('HIKA_REFRESH'); ?>" />
  508.                                             </a>
  509.                                         </div>
  510.                                     <?php
  511.                                     }else{
  512.                                         if($row->product_quantity_layout == 'show_select' || (empty($row->product_quantity_layout) && $this->config->get('product_quantity_display', '') == 'show_select')){
  513.                                             $min_quantity = $row->product_min_per_order;
  514.                                             $max_quantity = $row->product_max_per_order;
  515.                                             if($min_quantity == 0)
  516.                                                 $min_quantity = 1;
  517.                                             if($max_quantity == 0)
  518.                                                 $max_quantity = (int)$min_quantity * 15;
  519.                                             ?>
  520.                                                 <select id="hikashop_cart_quantity_select_<?php echo $this->params->get('id','0').'_'.$row->cart_product_id;?>" class="tochosen" onchange="var qty_field = document.getElementById('hikashop_cart_quantity_<?php echo $this->params->get('id','0').'_'.$row->cart_product_id;?>'); qty_field.value = this.value; if (qty_field){<?php echo $input; ?> } document.<?php echo $form; ?>.submit(); return false;">
  521.                                                     <?php
  522.                                                     for($j = $min_quantity; $j <= $max_quantity; $j += $min_quantity){
  523.                                                         $selected = '';
  524.                                                         if($j == $row->cart_product_quantity)
  525.                                                             $selected = 'selected="selected"';
  526.                                                         echo '<option value="'.$j.'" '.$selected.'>'.$j.'</option>';
  527.                                                     }
  528.                                                     ?>
  529.                                                 </select>
  530.                                                 <input id="hikashop_cart_quantity_<?php echo $this->params->get('id','0').'_'.$row->cart_product_id;?>" type="hidden" name="item[<?php echo $row->cart_product_id;?>][cart_product_quantity]" value="<?php echo $row->cart_product_quantity; ?>" />
  531.                                                 <?php
  532.                                         }else{
  533.                                             ?>
  534.                                             <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.<?php echo $form; ?>.submit(); return false;" />
  535.                                             <?php
  536.                                         }
  537.                                     }
  538.                                      if($this->params->get('show_delete',1) && $this->params->get('from','display') != 'module'){ ?>
  539.                                         <div class="hikashop_cart_product_quantity_delete">
  540.                                             <a href="<?php echo hikashop_completeLink('product&task=updatecart&product_id='.$row->product_id.'&quantity=0&return_url='.urlencode(base64_encode(hikashop_currentURL('return_url')))); ?>" onclick="var qty_field = document.getElementById('hikashop_checkout_quantity_<?php echo $row->cart_product_id;?>'); if(qty_field){qty_field.value=0; <?php echo $input; ?> qty_field.form.submit();} return false;" title="<?php echo JText::_('HIKA_DELETE'); ?>">
  541.                                                 <img src="<?php echo HIKASHOP_IMAGES . 'delete2.png';?>" border="0" alt="<?php echo JText::_('HIKA_DELETE'); ?>" />
  542.                                             </a>
  543.                                         </div>
  544.                                     <?php }
  545.                                 ?>
  546.                             </td>
  547.                             <?php }
  548.                             if($this->params->get('show_price',1)){ ?>
  549.                             <td class="hikashop_cart_module_product_price_value hikashop_cart_value">
  550.                                 <?php
  551.                                 $this->row=&$row;
  552.                                 echo $this->loadTemplate();
  553.                                 ?>
  554.                             </td>
  555.                             <?php }
  556.                             if($this->params->get('show_cart_delete',1)){ ?>
  557.                             <td class="hikashop_cart_module_product_delete_value hikashop_cart_value">
  558.                                 <a href="<?php echo hikashop_completeLink('product&task=updatecart&cart_type='.$this->params->get('cart_type','cart').'&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>
  559.                             </td>
  560.                             <?php }
  561.                             if($cart_type == 'wishlist' && $this->params->get('from','display') != 'module'){ ?>
  562.                                 <td class="hikashop_wishlist_display_add_to_cart">
  563.                                     <!-- Add 'ADD_TO_CART' button -->
  564.                                     <?php
  565.                                     $form = ',\'hikashop_wishlist_form\'';
  566.  
  567.                                     $this->ajax = '
  568.                                         if(qty_field == null){
  569.                                             var qty_field = document.getElementById(\'hikashop_wishlist_quantity_'.$row->cart_product_id.'\').value;
  570.                                         }
  571.                                         if(hikashopCheckChangeForm(\'item\',\'hikashop_wishlist_form\')){
  572.                                             return hikashopModifyQuantity(\'' . $this->row->product_id . '\',qty_field,1,\'hikashop_wishlist_form\',\'cart\');
  573.                                         } else {
  574.                                             return false;
  575.                                         }
  576.                                     ';
  577.  
  578.                                     $this->setLayout('quantity');
  579.                                     echo $this->loadTemplate();
  580.                                     $this->setLayout('listing_price');
  581.                                     ?>
  582.                                 </td>
  583.                             <?php }
  584.                             if($row_count<1){ ?>
  585.                             <td></td>
  586.                             <?php }?>
  587.                         </tr>
  588.                         <?php
  589.                         $k = 1-$k;
  590.                     }
  591.                     $this->cart_product_price=false;
  592.                 ?>
  593.             </tbody>
  594.         </table>
  595.             <?php
  596.             if($this->params->get('show_cart_quantity',1)){ ?>
  597.                 <noscript>
  598.                     <input type="submit" class="btn button" name="refresh" value="<?php echo JText::_('REFRESH_CART');?>"/>
  599.                 </noscript>
  600.             <?php }
  601.         if($this->params->get('cart_type','cart') != 'wishlist'  && $this->params->get('from','display') == 'module'){
  602.             if($this->params->get('show_cart_proceed',1)) echo $this->cart->displayButton(JText::_('PROCEED_TO_CHECKOUT'),'checkout',$this->params,$url_checkout,'');
  603.         }
  604.         else{
  605.             ?><div class="hikashop_display_cart_show_convert_button"><?php
  606.             $cart_type = '&cart_type='.$this->params->get('cart_type','cart');
  607.             if($this->params->get('from','display') != 'module'){
  608.                 //echo $this->cart->displayButton(JText::_('NEW_WISHLIST'),'wishlist',$this->params,hikashop_completeLink('wishlist&task=newWishlist'.$url_itemid.$cart_type),'');
  609.                 echo $this->cart->displayButton($convertText,'wishlist',$this->params,hikashop_completeLink('cart&task=convert'.$url_itemid.$cart_type),'window.location.href = \''.hikashop_completeLink('cart&task=convert'.$url_itemid.$cart_type).'\';return false;');
  610.             }
  611.             else{
  612.                 echo $this->cart->displayButton($displayText,'wishlist',$this->params,hikashop_completeLink('cart&task=showcart&cart_id='.$cart_id.$cart_itemid.$cart_type),'window.location.href = \''.hikashop_completeLink('cart&task=showcart&cart_id='.$cart_id.$cart_itemid.$cart_type).'\';return false;');
  613.             }
  614.             ?></div><?php
  615.         }
  616.         ?>
  617.         <input type="hidden" name="url" value="<?php echo $this->params->get('url');?>"/>
  618.         <input type="hidden" name="ctrl" value="product"/>
  619.         <input type="hidden" name="cart_type" value="<?php echo $this->params->get('cart_type','cart'); ?>"/>
  620.         <input type="hidden" name="task" value="updatecart"/>
  621.     </form>
  622.     <?php } ?>
  623. </div>
  624. <div class="clear_both"></div>
  625. <?php } ?>
  626. <?php
  627. if(JRequest::getWord('tmpl','')=='component'){
  628.     if(!headers_sent()){
  629.         header('Content-Type: text/css; charset=utf-8');
  630.     }
  631.     exit;
  632. }
  633. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement