Advertisement
Guest User

Cart woocommerce

a guest
Jun 18th, 2015
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.59 KB | None | 0 0
  1. <?php
  2.  
  3. if ( ! defined( 'ABSPATH' ) ) {
  4.     exit; // Exit if accessed directly
  5. }
  6.  
  7. $porto_woo_version = porto_get_woo_version_number();
  8.  
  9. wc_print_notices();
  10.  
  11. do_action( 'woocommerce_before_cart' ); ?>
  12.  
  13. <div class="featured-box">
  14.     <div class="box-content">
  15.         <form action="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" method="post">
  16.  
  17.         <?php do_action( 'woocommerce_before_cart_table' ); ?>
  18.  
  19.         <table class="shop_table responsive cart" cellspacing="0">
  20.             <thead>
  21.                 <tr>
  22.                     <th class="product-remove">&nbsp;</th>
  23.                     <th class="product-thumbnail">&nbsp;</th>
  24.                     <th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
  25.                     <th class="product-price"><?php _e( 'Price', 'woocommerce' ); ?></th>
  26.                     <th class="product-quantity"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
  27.                     <th class="product-subtotal"><?php _e( 'Total', 'woocommerce' ); ?></th>
  28.                 </tr>
  29.             </thead>
  30.             <tbody>
  31.                 <?php do_action( 'woocommerce_before_cart_contents' ); ?>
  32.  
  33.                 <?php
  34.                 foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
  35.                     $_product     = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
  36.                     $product_id   = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
  37.  
  38.                     if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
  39.                         ?>
  40.                         <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
  41.  
  42.                             <td class="product-remove">
  43.                                 <?php
  44.                                     echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf( '<a href="%s" class="remove" title="%s">&times;</a>', esc_url( WC()->cart->get_remove_url( $cart_item_key ) ), __( 'Remove this item', 'woocommerce' ) ), $cart_item_key );
  45.                                 ?>
  46.                             </td>
  47.  
  48.                             <td class="product-thumbnail">
  49.                                 <?php
  50.                                     $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
  51.  
  52.                                     if ( ! $_product->is_visible() ) {
  53.                                         echo $thumbnail;
  54.                                     } else {
  55.                                         if ($porto_woo_version < 2.3) {
  56.                                             printf( '<a href="%s">%s</a>', $_product->get_permalink(), $thumbnail );
  57.                                         } else {
  58.                                             printf( '<a href="%s">%s</a>', $_product->get_permalink( $cart_item ), $thumbnail );
  59.                                         }
  60.                                     }
  61.                                 ?>
  62.                             </td>
  63.  
  64.                             <td class="product-name">
  65.                                 <?php
  66.                                     if ( ! $_product->is_visible() ) {
  67.                                         echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . '&nbsp;';
  68.                                     } else {
  69.                                         if ($porto_woo_version < 2.3) {
  70.                                             echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', $_product->get_permalink(), $_product->get_title() ), $cart_item, $cart_item_key );
  71.                                         } else {
  72.                                             echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', $_product->get_permalink( $cart_item ), $_product->get_title() ), $cart_item, $cart_item_key );
  73.                                         }
  74.                                     }
  75.  
  76.                                     // Meta data
  77.                                     echo WC()->cart->get_item_data( $cart_item );
  78.  
  79.                                     // Backorder notification
  80.                                     if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) )
  81.                                         echo '<p class="backorder_notification">' . __( 'Available on backorder', 'woocommerce' ) . '</p>';
  82.                                 ?>
  83.                             </td>
  84.  
  85.                             <td class="product-price">
  86.                                 <?php
  87.                                     echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
  88.                                 ?>
  89.                             </td>
  90.  
  91.                             <td class="product-quantity">
  92.                                 <?php
  93.                                     if ( $_product->is_sold_individually() ) {
  94.                                         $product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
  95.                                     } else {
  96.                                         $product_quantity = woocommerce_quantity_input( array(
  97.                                             'input_name'  => "cart[{$cart_item_key}][qty]",
  98.                                             'input_value' => $cart_item['quantity'],
  99.                                             'max_value'   => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(),
  100.                                             'min_value'   => '0'
  101.                                         ), $_product, false );
  102.                                     }
  103.  
  104.                                     echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key );
  105.                                 ?>
  106.                             </td>
  107.  
  108.                             <td class="product-subtotal">
  109.                                 <?php
  110.                                     echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
  111.                                 ?>
  112.                             </td>
  113.                         </tr>
  114.                         <?php
  115.                     }
  116.                 }
  117.  
  118.                 do_action( 'woocommerce_cart_contents' );
  119.                 ?>
  120.                 <tr>
  121.                     <td colspan="6" class="actions">
  122.  
  123.                         <?php if ( WC()->cart->coupons_enabled() ) { ?>
  124.                             <div class="coupon pt-left">
  125.  
  126.                                 <label for="coupon_code"><?php _e( 'Coupon', 'woocommerce' ); ?>:</label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php _e( 'Coupon code', 'woocommerce' ); ?>" /> <input type="submit" class="btn btn-default" name="apply_coupon" value="<?php _e( 'Apply Coupon', 'woocommerce' ); ?>" />
  127.  
  128.                                 <?php do_action('woocommerce_cart_coupon'); ?>
  129.  
  130.                             </div>
  131.                         <?php } ?>
  132.  
  133.                         <?php if ($porto_woo_version < 2.3) : ?>
  134.                             <div class="actions pt-right">
  135.                                 <input type="submit" class="btn btn-default btn-lg" name="update_cart" value="<?php _e( 'Update Cart', 'woocommerce' ); ?>" /> <input type="submit" class="checkout-button button btn-lg alt wc-forward" name="proceed" value="<?php _e( 'Proceed to Checkout', 'woocommerce' ); ?>" />
  136.                             </div>
  137.  
  138.                             <?php do_action( 'woocommerce_proceed_to_checkout' ); ?>
  139.                         <?php else : ?>
  140.                             <div class="cart-actions pt-right">
  141.                                 <input type="submit" class="btn btn-default btn-lg" name="update_cart" value="<?php _e( 'Update Cart', 'woocommerce' ); ?>" />
  142.  
  143.                                 <?php do_action( 'woocommerce_cart_actions' ); ?>
  144.                             </div>
  145.                         <?php endif; ?>
  146.  
  147.                         <?php wp_nonce_field( 'woocommerce-cart' ); ?>
  148.                     </td>
  149.                 </tr>
  150.  
  151.                 <?php do_action( 'woocommerce_after_cart_contents' ); ?>
  152.             </tbody>
  153.         </table>
  154.  
  155.         <?php do_action( 'woocommerce_after_cart_table' ); ?>
  156.  
  157.         </form>
  158.     </div>
  159. </div>
  160.  
  161. <div class="cart-collaterals">
  162.  
  163.     <div class="row">
  164.         <?php if ($porto_woo_version < 2.3) : ?>
  165.             <div class="col-md-6 shipping-form-wrap">
  166.                 <div class="featured-box align-left">
  167.                     <div class="box-content">
  168.                         <?php woocommerce_shipping_calculator(); ?>
  169.                     </div>
  170.                 </div>
  171.             </div>
  172.         <?php endif; ?>
  173.         <?php if ($porto_woo_version < '2.3.8' ) : ?>
  174.         <div class="<?php if ($porto_woo_version < 2.3) echo 'col-md-6'; else echo 'col-md-12' ?>">
  175.             <?php woocommerce_cart_totals(); ?>
  176.         </div>
  177.         <?php endif; ?>
  178.     </div>
  179.  
  180.     <?php do_action( 'woocommerce_cart_collaterals' ); ?>
  181.  
  182. </div>
  183.  
  184. <?php do_action( 'woocommerce_after_cart' ); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement