My account initial navigation

This commit is contained in:
Claudio Sanches 2016-01-15 18:34:37 -02:00
parent 23ea60e0a6
commit 8a13e057f6
13 changed files with 207 additions and 143 deletions

File diff suppressed because one or more lines are too long

View File

@ -1509,6 +1509,20 @@ p.demo_store {
* Account page * Account page
*/ */
.woocommerce-account { .woocommerce-account {
.woocommerce {
@include clearfix();
}
.my-account-navigation {
float: left;
width: 30%;
}
.my-account-content {
float: right;
width: 68%;
}
.addresses { .addresses {
.title { .title {
@include clearfix(); @include clearfix();
@ -1880,7 +1894,7 @@ p.demo_store {
} }
/** /**
* Password strength meter * Password strength meter
*/ */
.woocommerce-password-strength { .woocommerce-password-strength {
text-align: center; text-align: center;

View File

@ -68,3 +68,22 @@ function wc_edit_address_i18n( $id, $flip = false ) {
return $slugs[ $id ]; return $slugs[ $id ];
} }
/**
* Get My Account menu items.
*
* @since 2.6.0
* @return array
*/
function wc_get_account_menu_items() {
$pages = apply_filters( 'woocommerce_account_menu_items', array(
'recent-orders' => __( 'Recent Orders', 'woocommerce' ),
'available-downloads' => __( 'Downloads', 'woocommerce' ),
'edit-address' => __( 'Addresses', 'woocommerce' ),
'edit-account' => __( 'Account Details', 'woocommerce' ),
) );
$pages['customer-logout'] = __( 'Logout', 'woocommerce' );
return $pages;
}

View File

@ -9,10 +9,10 @@
* as little as possible, but it does happen. When this occurs the version of the template file will. * as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes. * be bumped and the readme will list any important changes.
* *
* @see http://docs.woothemes.com/document/template-structure/ * @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.1 * @version 2.1
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {

View File

@ -9,64 +9,67 @@
* as little as possible, but it does happen. When this occurs the version of the template file will. * as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes. * be bumped and the readme will list any important changes.
* *
* @see http://docs.woothemes.com/document/template-structure/ * @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.2.7 * @version 2.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit;
} }
?>
<?php wc_print_notices(); ?> wc_print_notices(); ?>
<form action="" method="post"> <?php wc_get_template( 'myaccount/navigation.php' ); ?>
<?php do_action( 'woocommerce_edit_account_form_start' ); ?> <div class="my-account-content">
<form action="" method="post">
<p class="form-row form-row-first"> <?php do_action( 'woocommerce_edit_account_form_start' ); ?>
<label for="account_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="account_first_name" id="account_first_name" value="<?php echo esc_attr( $user->first_name ); ?>" />
</p>
<p class="form-row form-row-last">
<label for="account_last_name"><?php _e( 'Last name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="account_last_name" id="account_last_name" value="<?php echo esc_attr( $user->last_name ); ?>" />
</p>
<div class="clear"></div>
<p class="form-row form-row-wide"> <p class="form-row form-row-first">
<label for="account_email"><?php _e( 'Email address', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="account_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="email" class="input-text" name="account_email" id="account_email" value="<?php echo esc_attr( $user->user_email ); ?>" /> <input type="text" class="input-text" name="account_first_name" id="account_first_name" value="<?php echo esc_attr( $user->first_name ); ?>" />
</p> </p>
<p class="form-row form-row-last">
<fieldset> <label for="account_last_name"><?php _e( 'Last name', 'woocommerce' ); ?> <span class="required">*</span></label>
<legend><?php _e( 'Password Change', 'woocommerce' ); ?></legend> <input type="text" class="input-text" name="account_last_name" id="account_last_name" value="<?php echo esc_attr( $user->last_name ); ?>" />
</p>
<div class="clear"></div>
<p class="form-row form-row-wide"> <p class="form-row form-row-wide">
<label for="password_current"><?php _e( 'Current Password (leave blank to leave unchanged)', 'woocommerce' ); ?></label> <label for="account_email"><?php _e( 'Email address', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="password" class="input-text" name="password_current" id="password_current" /> <input type="email" class="input-text" name="account_email" id="account_email" value="<?php echo esc_attr( $user->user_email ); ?>" />
</p> </p>
<p class="form-row form-row-wide">
<label for="password_1"><?php _e( 'New Password (leave blank to leave unchanged)', 'woocommerce' ); ?></label> <fieldset>
<input type="password" class="input-text" name="password_1" id="password_1" /> <legend><?php _e( 'Password Change', 'woocommerce' ); ?></legend>
<p class="form-row form-row-wide">
<label for="password_current"><?php _e( 'Current Password (leave blank to leave unchanged)', 'woocommerce' ); ?></label>
<input type="password" class="input-text" name="password_current" id="password_current" />
</p>
<p class="form-row form-row-wide">
<label for="password_1"><?php _e( 'New Password (leave blank to leave unchanged)', 'woocommerce' ); ?></label>
<input type="password" class="input-text" name="password_1" id="password_1" />
</p>
<p class="form-row form-row-wide">
<label for="password_2"><?php _e( 'Confirm New Password', 'woocommerce' ); ?></label>
<input type="password" class="input-text" name="password_2" id="password_2" />
</p>
</fieldset>
<div class="clear"></div>
<?php do_action( 'woocommerce_edit_account_form' ); ?>
<p>
<?php wp_nonce_field( 'save_account_details' ); ?>
<input type="submit" class="button" name="save_account_details" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" />
<input type="hidden" name="action" value="save_account_details" />
</p> </p>
<p class="form-row form-row-wide">
<label for="password_2"><?php _e( 'Confirm New Password', 'woocommerce' ); ?></label>
<input type="password" class="input-text" name="password_2" id="password_2" />
</p>
</fieldset>
<div class="clear"></div>
<?php do_action( 'woocommerce_edit_account_form' ); ?> <?php do_action( 'woocommerce_edit_account_form_end' ); ?>
</form>
</div>
<p>
<?php wp_nonce_field( 'save_account_details' ); ?>
<input type="submit" class="button" name="save_account_details" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" />
<input type="hidden" name="action" value="save_account_details" />
</p>
<?php do_action( 'woocommerce_edit_account_form_end' ); ?>
</form>

View File

@ -9,10 +9,10 @@
* as little as possible, but it does happen. When this occurs the version of the template file will. * as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes. * be bumped and the readme will list any important changes.
* *
* @see http://docs.woothemes.com/document/template-structure/ * @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.1.0 * @version 2.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -29,32 +29,34 @@ get_currentuserinfo();
<?php wc_print_notices(); ?> <?php wc_print_notices(); ?>
<?php if ( ! $load_address ) : ?> <?php wc_get_template( 'myaccount/navigation.php' ); ?>
<?php wc_get_template( 'myaccount/my-address.php' ); ?> <div class="my-account-content">
<?php if ( ! $load_address ) : ?>
<?php wc_get_template( 'myaccount/my-address.php' ); ?>
<?php else : ?>
<?php else : ?> <form method="post">
<form method="post"> <h3><?php echo apply_filters( 'woocommerce_my_account_edit_address_title', $page_title ); ?></h3>
<h3><?php echo apply_filters( 'woocommerce_my_account_edit_address_title', $page_title ); ?></h3> <?php do_action( "woocommerce_before_edit_address_form_{$load_address}" ); ?>
<?php do_action( "woocommerce_before_edit_address_form_{$load_address}" ); ?> <?php foreach ( $address as $key => $field ) : ?>
<?php foreach ( $address as $key => $field ) : ?> <?php woocommerce_form_field( $key, $field, ! empty( $_POST[ $key ] ) ? wc_clean( $_POST[ $key ] ) : $field['value'] ); ?>
<?php woocommerce_form_field( $key, $field, ! empty( $_POST[ $key ] ) ? wc_clean( $_POST[ $key ] ) : $field['value'] ); ?> <?php endforeach; ?>
<?php endforeach; ?> <?php do_action( "woocommerce_after_edit_address_form_{$load_address}" ); ?>
<?php do_action( "woocommerce_after_edit_address_form_{$load_address}" ); ?> <p>
<input type="submit" class="button" name="save_address" value="<?php esc_attr_e( 'Save Address', 'woocommerce' ); ?>" />
<?php wp_nonce_field( 'woocommerce-edit_address' ); ?>
<input type="hidden" name="action" value="edit_address" />
</p>
<p> </form>
<input type="submit" class="button" name="save_address" value="<?php esc_attr_e( 'Save Address', 'woocommerce' ); ?>" />
<?php wp_nonce_field( 'woocommerce-edit_address' ); ?>
<input type="hidden" name="action" value="edit_address" />
</p>
</form> <?php endif; ?>
</div>
<?php endif; ?>

View File

@ -9,10 +9,10 @@
* as little as possible, but it does happen. When this occurs the version of the template file will. * as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes. * be bumped and the readme will list any important changes.
* *
* @see http://docs.woothemes.com/document/template-structure/ * @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.2.6 * @version 2.2.6
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {

View File

@ -9,7 +9,7 @@
* as little as possible, but it does happen. When this occurs the version of the template file will. * as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes. * be bumped and the readme will list any important changes.
* *
* @see http://docs.woothemes.com/document/template-structure/ * @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.3.0 * @version 2.3.0

View File

@ -9,38 +9,34 @@
* as little as possible, but it does happen. When this occurs the version of the template file will. * as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes. * be bumped and the readme will list any important changes.
* *
* @see http://docs.woothemes.com/document/template-structure/ * @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.0.0 * @version 2.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit;
} }
wc_print_notices(); ?> wc_print_notices(); ?>
<p class="myaccount_user"> <?php wc_get_template( 'myaccount/navigation.php' ); ?>
<?php
printf(
__( 'Hello <strong>%1$s</strong> (not %1$s? <a href="%2$s">Sign out</a>).', 'woocommerce' ) . ' ',
$current_user->display_name,
wc_get_endpoint_url( 'customer-logout', '', wc_get_page_permalink( 'myaccount' ) )
);
printf( __( 'From your account dashboard you can view your recent orders, manage your shipping and billing addresses and <a href="%s">edit your password and account details</a>.', 'woocommerce' ), <div class="my-account-content">
wc_customer_edit_account_url() <p class="myaccount_user">
); <?php
?> printf(
</p> __( 'Hello <strong>%1$s</strong> (not %1$s? <a href="%2$s">Sign out</a>).', 'woocommerce' ) . ' ',
$current_user->display_name,
wc_get_endpoint_url( 'customer-logout', '', wc_get_page_permalink( 'myaccount' ) )
);
<?php do_action( 'woocommerce_before_my_account' ); ?> _e( 'From your account dashboard you can view your recent orders, manage your shipping and billing addresses and edit your password and account details</a>.', 'woocommerce' );
?>
</p>
<?php wc_get_template( 'myaccount/my-downloads.php' ); ?> <?php do_action( 'woocommerce_before_my_account' ); ?>
<?php wc_get_template( 'myaccount/my-orders.php', array( 'order_count' => $order_count ) ); ?> <?php do_action( 'woocommerce_after_my_account' ); ?>
</div>
<?php wc_get_template( 'myaccount/my-address.php' ); ?>
<?php do_action( 'woocommerce_after_my_account' ); ?>

View File

@ -9,10 +9,10 @@
* as little as possible, but it does happen. When this occurs the version of the template file will. * as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes. * be bumped and the readme will list any important changes.
* *
* @see http://docs.woothemes.com/document/template-structure/ * @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.2.0 * @version 2.2.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* My Orders * My Downloads
* *
* Shows recent orders on the account page. * Shows downloads on the account page.
* *
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/my-downloads.php. * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/my-downloads.php.
* *
@ -11,10 +11,10 @@
* as little as possible, but it does happen. When this occurs the version of the template file will. * as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes. * be bumped and the readme will list any important changes.
* *
* @see http://docs.woothemes.com/document/template-structure/ * @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.0.0 * @version 2.0.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {

View File

@ -0,0 +1,30 @@
<?php
/**
* My Account navigation
*
* This template can be overridden by copying it to yourtheme/woocommerce/myaccount/navigation.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
* will need to copy the new files to your theme to maintain compatibility. We try to do this.
* as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes.
*
* @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.6.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<nav class="my-account-navigation">
<ul>
<?php foreach ( wc_get_account_menu_items() as $endpoint => $label ) : ?>
<li class="my-account-menu-item-<?php echo sanitize_html_class( $endpoint ); ?>"><a href="<?php echo esc_url( wc_get_endpoint_url( $endpoint ) ); ?>"><?php echo esc_html( $label ); ?></a></li>
<?php endforeach; ?>
</ul>
</nav>

View File

@ -11,42 +11,42 @@
* as little as possible, but it does happen. When this occurs the version of the template file will. * as little as possible, but it does happen. When this occurs the version of the template file will.
* be bumped and the readme will list any important changes. * be bumped and the readme will list any important changes.
* *
* @see http://docs.woothemes.com/document/template-structure/ * @see http://docs.woothemes.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.2.0 * @version 2.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit;
} }
?> wc_print_notices(); ?>
<?php wc_print_notices(); ?> <?php wc_get_template( 'myaccount/navigation.php' ); ?>
<p class="order-info"><?php printf( __( 'Order #<mark class="order-number">%s</mark> was placed on <mark class="order-date">%s</mark> and is currently <mark class="order-status">%s</mark>.', 'woocommerce' ), $order->get_order_number(), date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ), wc_get_order_status_name( $order->get_status() ) ); ?></p> <div class="my-account-content">
<p class="order-info"><?php printf( __( 'Order #<mark class="order-number">%s</mark> was placed on <mark class="order-date">%s</mark> and is currently <mark class="order-status">%s</mark>.', 'woocommerce' ), $order->get_order_number(), date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ), wc_get_order_status_name( $order->get_status() ) ); ?></p>
<?php if ( $notes = $order->get_customer_order_notes() ) : <?php if ( $notes = $order->get_customer_order_notes() ) : ?>
?> <h2><?php _e( 'Order Updates', 'woocommerce' ); ?></h2>
<h2><?php _e( 'Order Updates', 'woocommerce' ); ?></h2> <ol class="commentlist notes">
<ol class="commentlist notes"> <?php foreach ( $notes as $note ) : ?>
<?php foreach ( $notes as $note ) : ?> <li class="comment note">
<li class="comment note"> <div class="comment_container">
<div class="comment_container"> <div class="comment-text">
<div class="comment-text"> <p class="meta"><?php echo date_i18n( __( 'l jS \o\f F Y, h:ia', 'woocommerce' ), strtotime( $note->comment_date ) ); ?></p>
<p class="meta"><?php echo date_i18n( __( 'l jS \o\f F Y, h:ia', 'woocommerce' ), strtotime( $note->comment_date ) ); ?></p> <div class="description">
<div class="description"> <?php echo wpautop( wptexturize( $note->comment_content ) ); ?>
<?php echo wpautop( wptexturize( $note->comment_content ) ); ?> </div>
</div> <div class="clear"></div>
<div class="clear"></div> </div>
</div> <div class="clear"></div>
<div class="clear"></div> </div>
</div> </li>
</li> <?php endforeach; ?>
<?php endforeach; ?> </ol>
</ol> <?php endif; ?>
<?php
endif;
do_action( 'woocommerce_view_order', $order_id ); <?php do_action( 'woocommerce_view_order', $order_id ); ?>
</div>