*/ function get_apptivo_ecommerce_cart() { global $apptivo_ecommerce; if(function_exists('custom_apptivo_ecommerce_cart')) { return custom_apptivo_ecommerce_cart(); }else { return $apptivo_ecommerce->shortcode_wrapper('apptivo_ecommerce_cart'); } } function apptivo_ecommerce_cart() { global $apptivo_ecommerce; $validation = new apptivo_ecommerce_validation(); $getcartDetails = getCartDetails(); //To get Shopping cart details. //shoppingCartLines $shooping_cart = get_shoppingcrt_baginfo(); $shoppingCart_Lines =$shooping_cart->return; $shoppingCartLines = app_convertObjectToArray($shoppingCart_Lines->shoppingCartLines); // Process Discount Codes $apply_coupan_code = false; if (isset($_POST['apply_coupon']) || ( trim($_POST['shop_cart_actions']) == 'APPLY_COUPON' )) : $coupon_code = stripslashes(trim($_POST['coupon_code'])); $apply_coupan_code = true; else: $coupon_code = $shooping_cart->return->promotionCode; endif; if(!empty($_POST)): if(isset($_POST['apply_zipcode']) || ( trim($_POST['shop_cart_actions']) == 'APPLY_ZIPCODE' )) { if(trim(strlen($_POST['zip_code'])) == 0 ): $error_message_ae100 = apptivo_ecommerce_error_message('AE-100'); $apptivo_ecommerce->add_error( __($error_message_ae100, 'apptivo_ecommerce') ); elseif (!$validation->zipcode_isvalid( trim($_POST['zip_code']), 'US' )) : $error_message_ae101 = apptivo_ecommerce_error_message('AE-101'); $apptivo_ecommerce->add_error($error_message_ae101); endif; } $item_qtys = $_POST['cart_item_qty']; $action = true; // To chk Item Quantity is invalid or not. foreach ($item_qtys as $qty) { if(!is_numeric($qty) || $qty < 1 ) : $action = false; $error_message_ae103 = apptivo_ecommerce_error_message('AE-103'); $apptivo_ecommerce->add_error( __($error_message_ae103, 'apptivo_ecommerce') ); break; endif; } endif; if ( $apptivo_ecommerce->error_count() == 0 ) : if( !isset($_SESSION['apptivo_checkout_shipping_type'])) : $_SESSION['apptivo_checkout_shipping_type'] = 'YES'; endif; if(!empty($_POST) && $action ): if(trim($_POST['shippingoptions']) == 'shipping'): $shipping_method = trim($_POST['shipping_method']); $_SESSION['apptivo_checkout_shipping_type'] = 'YES'; else: $shipping_method = trim($_POST['wiicallpickup_enabled']); $_SESSION['apptivo_checkout_shipping_type'] = 'NO'; endif; if(isset($_POST['apply_zipcode']) || ( trim($_POST['shop_cart_actions']) == 'APPLY_ZIPCODE' )) { $_SESSION['chosen_shippingandtax_zipcode'] = trim($_POST['zip_code']); $item_qtys = $_POST['cart_item_qty']; $item_color = $_POST['cart_track_color']; $item_size = $_POST['cart_track_size']; $shooping_cart = update_shopping_cart($shoppingCartLines,$item_qtys,$coupon_code,'yes',trim($_POST['zip_code']),'yes',$shipping_method,$item_color,$item_size); $shoppingCartLines = app_convertObjectToArray($shooping_cart->return->shoppingCartLines); }else { $item_qtys = $_POST['cart_item_qty']; $item_color = $_POST['cart_track_color']; $item_size = $_POST['cart_track_size']; $shooping_cart = update_shopping_cart($shoppingCartLines,$item_qtys,$coupon_code,'yes',NULL,'yes',$shipping_method,$item_color,$item_size); $shoppingCartLines = app_convertObjectToArray($shooping_cart->return->shoppingCartLines); if($_POST['proceed_to_checkout'] == 'paypalcheckout'){ $_SESSION['apptivo_ecommerce_PG'] = 'paypal'; wp_safe_redirect( get_permalink(get_option('apptivo_ecommerce_checkout_page_id')) ); exit; }elseif($_POST['proceed_to_checkout'] == 'securecheckout'){ $_SESSION['apptivo_ecommerce_PG'] = 'secure'; wp_safe_redirect( get_permalink(get_option('apptivo_ecommerce_secure_checkout_page_id')) ); exit; }elseif($_POST['proceed_to_checkout'] == 'googlecheckout'){ $_SESSION['apptivo_ecommerce_PG'] = 'google'; $page = get_permalink(get_option('apptivo_ecommerce_checkout_page_id')); wp_safe_redirect($page ); exit; } } endif; //if(!empty($_POST) && $action ) //RatedShipment $available_methods = app_convertObjectToArray($shoppingCart_Lines->ratedShipment); if($available_methods == '' || empty($available_methods[0])) { if($zipcode_disp_status = 'yes' && $auto_zipcode != '') { $shooping_cart = update_shopping_cart($shoppingCartLines,$item_qtys,$coupon_code,$zipcode_disp_status,$auto_zipcode,'no'); } $available_methods = $shooping_cart->return->ratedShipment; } endif; // if ( $apptivo_ecommerce->error_count() == 0 ) //if wiill call pickup value is > 0 or Initial Update zipcode if(!isset($shooping_cart->return->shippingAmount)) { if(isset($shooping_cart->return->ratedShipment)) { $ratedshipment = app_convertObjectToArray($shooping_cart->return->ratedShipment); $shooping_cart->return->shippingAmount = $ratedshipment[0]->totalCharges; $shooping_cart->return->totalPrice = ($shooping_cart->return->totalPrice)+($shooping_cart->return->shippingAmount); } } $promotionCode = $shooping_cart->return->promotionCode; if($apply_coupan_code){ if(strlen(trim($promotionCode)) != 0 ) { $error_message_ae104 = $shooping_cart->return->errorMessage; if(trim($_POST['coupon_code']) != trim($promotionCode) ) { $apptivo_ecommerce->add_error( 'The Coupon code "'.$promotionCode.'" is already set in your cart.' ); }else if( strlen(trim($error_message_ae104)) != 0 ) { $apptivo_ecommerce->add_error( __($error_message_ae104, 'apptivo_ecommerce') ); }else{ $error_message_ae128 = apptivo_ecommerce_error_message('AE-128'); $apptivo_ecommerce->add_message($error_message_ae128);//Coupon code updated successfully } }else{ if(strlen(trim($promotionCode)) != 0 ) { $apptivo_ecommerce->add_error( 'The Coupon code "'.$promotionCode.'" is already set in your cart.' ); }else if(trim(strlen($_POST['coupon_code'])) == 0 ) { $error_message_ae102 = apptivo_ecommerce_error_message('AE-102'); $apptivo_ecommerce->add_error( __($error_message_ae102, 'apptivo_ecommerce') ); }else{ $error_message_ae104 = apptivo_ecommerce_error_message('AE-104'); $apptivo_ecommerce->add_error( __($error_message_ae104, 'apptivo_ecommerce') ); } } } $apptivo_ecommerce->show_messages(); if (empty($shoppingCartLines[0])) : $apptivo_ecommerce->cart->emty_shopping_cart();//clear the cart session. do_action('apptivo_ecommerce_cart_is_empty'); echo '

'.apply_filters('apptivo_ecommerce_cart_empty_message','Your cart is Empty ').''.apply_filters('apptivo_ecommerce_return_to_products_label','← Continue Shopping').'

'; return; endif; ?>
'.apply_filters('apptivo_ecommerce_continue_shopping_label','← Continue shopping').'

'; ?> itemId); $cart_lineid = $cartLines->shoppingCartLineId; $item_quantity = $cartLines->quantity; if ($item_quantity>0) : ?>
trim(strip_tags( get_the_title($product_postid))), 'title' => trim(strip_tags( get_the_title($product_postid))) ); echo get_the_post_thumbnail($product_postid, 'product_thumbnail',$attr); else : $thumbnail_noproduct_image = apply_filters('apptivo_ecommerce_thumbnail_noproduct_img',$apptivo_ecommerce->plugin_url().'/assets/images/no-product-90.jpg'); echo 'Placeholder'; endif; ?> post_title; ?> color != '') :?>
Color: color; ?> size != '') :?>
Size: size;?>
effectiveUnitPrice); ?> errorCode != '') { ?> errorMessage; ?> effectiveTotalPrice); ?> Remove
return->defaultFirmShippingMethodId;//Default Willcall Pickup ID. ?>
checked="checked" type="radio" id="willcallpickup" name="shippingoptions" value="willcall" rel="" />
checked="checked" id="shipping" name="shippingoptions" value="shipping" />
nonce_field('cart') ?> payment_gateways->available_payment_gateway_lists(); $available_gateways = apply_filters('apptivo_ecommerce_add_ons_available_gateways',$available_gateways); if($available_gateways){ $paypal_checkout_method = false; $secure_checkout_method = false; $google_checkout_method = false; foreach ($available_gateways as $gateway ) : if( $gateway->id == 'paypal'): $paypal_checkout_method = true; endif; if($gateway->id == 'GoogleCheckout'): $google_checkout_method = true; endif; if( $gateway->id == 'SecureCheckout' ): $secure_checkout_method = true; endif; endforeach; } ?> -OR- -OR-