Ejemplo n.º 1
0
function avada_woocommerce_before_my_account($order_count, $edit_address = false)
{
    global $woocommerce;
    $edit_address = is_wc_endpoint_url('edit-address');
    avada_top_user_container();
    ?>

	<ul class="woocommerce-side-nav avada-myaccount-nav">
		<?php 
    if ($downloads = WC()->customer->get_downloadable_products()) {
        ?>
			<li <?php 
        if (!$edit_address) {
            echo 'class="active"';
        }
        ?>
>
				<a class="downloads" href="#">
					<?php 
        _e('View Downloads', 'Avada');
        ?>
				</a>
			</li>
		<?php 
    }
    if (function_exists('wc_get_order_types') && function_exists('wc_get_order_statuses')) {
        $customer_orders = get_posts(apply_filters('woocommerce_my_account_my_orders_query', array('numberposts' => $order_count, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => wc_get_order_types('view-orders'), 'post_status' => array_keys(wc_get_order_statuses()))));
    } else {
        $customer_orders = get_posts(apply_filters('woocommerce_my_account_my_orders_query', array('numberposts' => $order_count, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => 'shop_order', 'post_status' => 'publish')));
    }
    if ($customer_orders) {
        ?>
				<li <?php 
        if (!$edit_address && !WC()->customer->get_downloadable_products()) {
            echo 'class="active"';
        }
        ?>
>
					<a class="orders" href="#">
						<?php 
        _e('View Orders', 'Avada');
        ?>
					</a>
				</li>
			<?php 
    }
    ?>
		<li <?php 
    if ($edit_address || !WC()->customer->get_downloadable_products() && !$customer_orders) {
        echo 'class="active"';
    }
    ?>
>
			<a class="address" href="#">
				<?php 
    _e('Change Address', 'Avada');
    ?>
			</a>
		</li>
		<li>
			<a class="account" href="#">
				<?php 
    _e('Edit Account', 'Avada');
    ?>
			</a>
		</li>
	</ul>

<div class="woocommerce-content-box avada-myaccount-data">

<?php 
}
<?php

/**
 * Checkout Form
 *
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version	 	2.0.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
global $woocommerce, $current_user;
// Get the top user container markup
avada_top_user_container();
wc_print_notices();
do_action('woocommerce_before_checkout_form', $checkout);
// If checkout registration is disabled and not logged in, the user cannot checkout
if (!$checkout->enable_signup && !$checkout->enable_guest_checkout && !is_user_logged_in()) {
    echo apply_filters('woocommerce_checkout_must_be_logged_in_message', __('You must be logged in to checkout.', 'woocommerce'));
    return;
}
// filter hook for include new pages inside the payment method
$get_checkout_url = apply_filters('woocommerce_get_checkout_url', WC()->cart->get_checkout_url());
?>

<form name="checkout" method="post" class="checkout" action="<?php 
echo esc_url($get_checkout_url);
?>
" enctype="multipart/form-data">