tribulant

Widget Cart

Apr 26th, 2011
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.02 KB | None | 0 0
  1. <?php $order_id = $Order -> current_order_id(); ?>
  2. <?php $items_count = $Item -> item_count($order_id, 'items'); ?>
  3. <?php $units_count = $Item -> item_count($order_id, 'units'); ?>
  4. <?php $subtotal = $Order -> total($order_id, false, false, true, true, false); ?>
  5. <?php $discount = $Discount -> total($order_id); ?>
  6. <?php $shipping = $Order -> shipping_total($subtotal, $order_id); ?>
  7. <?php $tax_total = $Order -> tax_total($order_id); ?>
  8. <?php $total_price = $Order -> total($order_id, true, true); ?>
  9.  
  10. <?php if (!empty($options['hide_when_empty']) && $options['hide_when_empty'] == 1 && empty($items_count)) : ?>
  11.  
  12. <?php else : ?>
  13.     <?php if (empty($isajax) || $isajax == false) : ?>
  14.         <?php echo $args['before_title']; ?><span class="cart"><?php echo $options['title']; ?></span><?php echo $args['after_title']; ?>
  15.         <div id="<?php echo $this -> pre; ?>_cart_widget"> 
  16.     <?php endif; ?>
  17.         <?php if (!empty($errors)) : ?>
  18.             <ul>
  19.                 <?php foreach ($errors as $err) : ?>
  20.                     <li class="<?php echo $this -> pre; ?>error"><?php echo $err; ?></li>
  21.                 <?php endforeach; ?>
  22.             </ul>
  23.             <br/>
  24.         <?php endif; ?>
  25.        
  26.         <div id="widget-cart-errors" style="display:none;"></div>
  27.        
  28.         <?php if (!empty($successmsg)) : ?>
  29.             <ul>
  30.                 <li class="<?php echo $this -> pre; ?>successmsg"><?php echo $successmsg; ?></li>
  31.             </ul>
  32.             <br/>
  33.         <?php endif; ?>
  34.        
  35.         <?php if (empty($options['show']) || $options['show'] == "normal") : ?>
  36.             <ul>
  37.                 <li><?php _e('Total Items', $this -> plugin_name); ?>: <b><?php echo $items_count; ?></b></li>
  38.                 <li><?php _e('Total Units', $this -> plugin_name); ?>: <b><?php echo $units_count; ?></b></li>
  39.                 <?php if (!empty($items_count) && $items_count != 0) : ?>
  40.                     <?php if ($this -> get_option('shippingcalc') == "Y" || $this -> get_option('enablecoupons') == "Y") : ?>
  41.                         <li><?php _e('Sub Total', $this -> plugin_name); ?>: <b><?php echo $wpcoHtml -> currency_price($subtotal); ?></b></li>
  42.                         <?php if ($this -> get_option('shippingcalc') == "Y" && !empty($shipping) && $shipping != 0) : ?>
  43.                             <li><?php _e('Shipping', $this -> plugin_name); ?>: <b><?php echo $wpcoHtml -> currency_price($shipping); ?></b></li>
  44.                         <?php endif; ?>
  45.                         <?php if ($this -> get_option('enablecoupons') && !empty($discount) && $discount != 0) : ?>
  46.                             <li><?php _e('Discount', $this -> plugin_name); ?>: <b><?php echo $wpcoHtml -> currency_price($discount); ?></b></li>
  47.                         <?php endif; ?>
  48.                     <?php endif; ?>
  49.                 <?php endif; ?>
  50.                 <?php if ($this -> get_option('tax_calculate') == "Y" && !empty($tax_total)) : ?>
  51.                     <li><?php echo $this -> get_option('tax_name'); ?> (<?php echo $wpcoTax -> get_tax_percentage(); ?>&#37;): <strong><?php echo $wpcoHtml -> currency_price($tax_total); ?></strong></li>
  52.                 <?php endif; ?>
  53.                 <li><?php _e('Total Price', $this -> plugin_name); ?>: <b><?php echo $wpcoHtml -> currency_price($total_price); ?></b></li>
  54.             </ul>
  55.         <?php else : ?>
  56.             <ul>
  57.                 <li><?php _e('Total', $this -> plugin_name); ?>: <strong><?php echo $wpcoHtml -> currency_price($total_price); ?></strong></li>
  58.             </ul>
  59.         <?php endif; ?>
  60.        
  61.         <?php if (!empty($items_count) && $items_count != 0) : ?>  
  62.             <br/>
  63.            
  64.             <ul>
  65.                 <li><a href="<?php echo $wpcoHtml -> cart_url(); ?>" title="<?php _e('View your shopping cart', $this -> plugin_name); ?>"><?php _e('View Shopping Cart', $this -> plugin_name); ?></a></li>
  66.                 <?php if ($wpcoField -> globalfields()) : ?>
  67.                     <?php $method = 'cart'; ?>
  68.                     <?php $completeurl = $wpcoHtml -> cart_url(); ?>
  69.                 <?php else : ?>
  70.                     <?php global $user_ID; ?>
  71.                     <?php $tempmethod = ($this -> get_option('shippingdetails') == "Y") ? 'shipping' : 'billing'; ?>
  72.                     <?php $method = ($user_ID) ? $tempmethod : 'contacts'; ?>
  73.                     <?php
  74.                    
  75.                     $completeurl = $wpcoHtml -> cart_url();
  76.                    
  77.                     switch ($method) {
  78.                         case 'contacts'         :
  79.                             $completeurl = $wpcoHtml -> contacts_url(true);
  80.                             break;
  81.                         case 'shipping'         :
  82.                             $completeurl = $wpcoHtml -> ship_url();
  83.                             break;
  84.                         case 'billing'          :
  85.                             $completeurl = $wpcoHtml -> bill_url();
  86.                             break;
  87.                         default                 :
  88.                             $completeurl = $wpcoHtml -> cart_url();
  89.                             break;
  90.                     }
  91.                    
  92.                     ?>
  93.                 <?php endif; ?>
  94.                 <li><a href="<?php echo $completeurl; ?>" title="<?php _e('Complete your order', $this -> plugin_name); ?>"><?php _e('Complete Order', $this -> plugin_name); ?></a></li>
  95.                 <li><a href="#wpco_cart_widget" onclick="if (!confirm('<?php _e('Are you sure you wish to remove all items from your shopping cart?', $this -> plugin_name); ?>')) { return false; } else { wpco_emptycart('wpco_cart_widget'); }" title="<?php _e('Remove all items from your shopping cart', $this -> plugin_name); ?>"><?php _e('Empty Shopping Cart', $this -> plugin_name); ?></a></li>
  96.             </ul>
  97.         <?php endif; ?>
  98. <!--        //neha -->
  99.         <?php if ($options['enablecoupons'] == "Y") : ?>
  100.                 <?php $wpcoDb -> model = $Coupon -> model; ?>
  101.                 <?php $couponscount = $wpcoDb -> count(); ?>
  102.                 <?php if ($this -> get_option('enablecoupons') == "Y" && !empty($couponscount)) : ?>
  103.                     <?php $wpcoDb -> model = $Discount -> model; ?>
  104.                     <?php $dcount = $wpcoDb -> count(array('order_id' => $order_id)); ?>
  105.                     <?php if ($this -> get_option('multicoupon') == "Y" || (empty($dcount) && $this -> get_option('multicoupon') == "N")) : ?>
  106.                         <br/>
  107.                         <small><?php _e('Do you have a discount coupon code?', $this -> plugin_name); ?></small>
  108.                         <form class="<?php echo $this -> pre; ?>" action="" method="post">
  109.                             <input type="hidden" name="<?php echo $this -> pre; ?>method" value="applycoupon" />
  110.                             <input type="text" name="code" value="" />
  111.                             <input class="button" style="cursor:pointer;" type="submit" name="applycode" value="<?php _e('Apply Code', $this -> plugin_name); ?>" />
  112.                         </form>
  113.                     <?php endif; ?>
  114.                 <?php endif; ?>
  115.          <?php endif; ?>
  116.         <?php global $user_ID; ?>
  117.         <?php if ($user_ID) : ?>
  118.             <?php $wpcoDb -> model = $Order -> model; ?>
  119.             <?php $orderscount = $wpcoDb -> count(array('completed' => "Y", 'user_id' => $user_ID)); ?>
  120.             <?php $hasorders = (!empty($orderscount)) ? true : false; ?>
  121.         <?php endif; ?>
  122.        
  123.         <?php if ($this -> has_downloads() || $hasorders == true) : ?>
  124.             <br/>
  125.             <ul>
  126.                 <?php if ($this -> has_downloads()) : ?>
  127.                     <li><a href="<?php echo $wpcoHtml -> downloads_url(); ?>" title="<?php _e('View all your downloads', $this -> plugin_name); ?>"><?php _e('Downloads Management', $this -> plugin_name); ?></a></li>
  128.                 <?php endif; ?>
  129.                 <?php if ($hasorders == true) : ?>
  130.                     <li><a href="<?php echo $wpcoHtml -> account_url(); ?>" title="<?php _e('View your complete orders history', $this -> plugin_name); ?>"><?php _e('Orders History', $this -> plugin_name); ?></a></li>
  131.                 <?php endif; ?>
  132.             </ul>
  133.         <?php endif; ?>
  134.     <?php if (empty($isajax) || $isajax == false) : ?>
  135.         </div>
  136.     <?php endif; ?>
  137. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment