Commit b7831763 authored by Varun Sridharan's avatar Varun Sridharan

Changes By Varun S

Seperate Page For Listing Donors
Function To Get Grouped Donation IDS By User & Project
3 New Templates Added Used for my account in front end
myaccount/view-donation.php
order/order-details-item.php
order/order-details-customer.php
Added 3 Functions
parent 55a7c0fc
...@@ -45,8 +45,19 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -45,8 +45,19 @@ class WooCommerce_Quick_Donation_Admin {
public function sub_donation_order_menu(){ public function sub_donation_order_menu(){
$this->order_menu_slug = add_submenu_page('edit.php?post_type=wcqd_project','Donation Orders','Donation\'s','administrator','wc_qd_orders',array($this,'donation_orders_page')); $this->order_menu_slug = add_submenu_page('edit.php?post_type=wcqd_project',
__('Donation Orders',WC_QD_TXT),
__('Donation\'s',WC_QD_TXT),
'administrator',
'wc_qd_orders',
array($this,'donation_orders_page'));
$this->donors_list = add_submenu_page('edit.php?post_type=wcqd_project',
__('Donors List',WC_QD_TXT),
__('Donors List',WC_QD_TXT),
'administrator',
'wc_qd_donors',
array($this,'donors_listing_page'));
} }
...@@ -56,7 +67,9 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -56,7 +67,9 @@ class WooCommerce_Quick_Donation_Admin {
$name = 'edit.php?post_type='.WC_QD_PT; $name = 'edit.php?post_type='.WC_QD_PT;
if(empty($submenu)){return $submenu;} if(empty($submenu)){return $submenu;}
$arr = array(); $arr = array();
$arr[] = $submenu[$name][18]; $arr[] = $submenu[$name][18];
$arr[] = $submenu[$name][19];
$arr[] = $submenu[$name][5]; $arr[] = $submenu[$name][5];
$arr[] = $submenu[$name][10]; $arr[] = $submenu[$name][10];
$arr[] = $submenu[$name][15]; $arr[] = $submenu[$name][15];
...@@ -72,12 +85,14 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -72,12 +85,14 @@ class WooCommerce_Quick_Donation_Admin {
$c = $this->get_status_count(); $c = $this->get_status_count();
if(isset($submenu['edit.php?post_type='.WC_QD_PT])){ if(isset($submenu['edit.php?post_type='.WC_QD_PT])){
foreach($submenu['edit.php?post_type='.WC_QD_PT] as $menuK => $menu){ foreach($submenu['edit.php?post_type='.WC_QD_PT] as $menuK => $menu){
if($menu[2] === 'wc_qd_orders' ){
if($menu[2] == 'wc_qd_orders' ){
$submenu['edit.php?post_type='.WC_QD_PT][$menuK][0] .= "<span class='update-plugins count-1'> $submenu['edit.php?post_type='.WC_QD_PT][$menuK][0] .= "<span class='update-plugins count-1'>
<span class='update-count'>$c</span></span>"; <span class='update-count'>$c</span></span>";
} }
} }
} }
} }
private function get_status_count(){ private function get_status_count(){
...@@ -101,6 +116,15 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -101,6 +116,15 @@ class WooCommerce_Quick_Donation_Admin {
} }
public function donors_listing_page(){
$ids = WC_QD()->db()->get_doners_ids();
$ids = WC_QD()->db()->extract_donation_id($ids);
$args = array('include' => $ids);
require('wp-donors-listing-table.php');
donor_render_list_page($args);
}
public function donation_orders_page(){ public function donation_orders_page(){
global $wpdb; global $wpdb;
......
...@@ -1087,7 +1087,7 @@ function tt_render_list_page($shop = ''){ ...@@ -1087,7 +1087,7 @@ function tt_render_list_page($shop = ''){
<div id="icon-users" class="icon32"><br/></div> <div id="icon-users" class="icon32"><br/></div>
<h2>Donations</h2> <h2>Donations</h2>
<form id="movies-filter" method="get"> <form id="movies-filter" method="get">
<input type="hidden" name="post_type" value="<?php echo $_REQUEST['post_type'] ?>" /> <input type="hidden" name="post_type" value="wc_qd_orders" />
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" /> <input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
<?php $wc_qd_donation_orders_listing->search_box(__('Search Donations',WC_QD_TXT), 'post' ); ?> <?php $wc_qd_donation_orders_listing->search_box(__('Search Donations',WC_QD_TXT), 'post' ); ?>
<?php <?php
......
<?php
/**
* Users List Table class.
*
* @since 3.1.0
* @access private
*
* @package WordPress
* @subpackage List_Table
*/
class WP_Donors_Listing_Table extends WP_List_Table {
/**
* Site ID to generate the Users list table for.
*
* @since 3.1.0
* @access public
* @var int
*/
public $site_id;
/**
* Whether or not the current Users list table is for Multisite.
*
* @since 3.1.0
* @access public
* @var bool
*/
public $is_site_users;
public $user_args;
/**
* Constructor.
*
* @since 3.1.0
* @access public
*
* @see WP_List_Table::__construct() for more information on default arguments.
*
* @param array $args An associative array of arguments.
*/
public function __construct($userA, $args = array() ) {
$this->user_args = $userA;
set_current_screen('users');
parent::__construct( array(
'singular' => 'user',
'plural' => 'users',
'screen' => get_current_screen(),
) );
$this->screen->id = 'users';
$this->is_site_users = 'site-users-network' == $this->screen->id;
if ( $this->is_site_users )
$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
}
/**
* Check the current user's permissions.
*
* @since 3.1.0
* @access public
*
* @return bool
*/
public function ajax_user_can() {
if ( $this->is_site_users )
return current_user_can( 'manage_sites' );
else
return current_user_can( 'list_users' );
}
/**
* Prepare the users list for display.
*
* @since 3.1.0
* @access public
*
* @global string $role
* @global string $usersearch
*/
public function prepare_items() {
global $role, $usersearch;
$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
$role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
$per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page';
$users_per_page = $this->get_items_per_page( $per_page );
$paged = $this->get_pagenum();
$args = $this->user_args;
$args['number'] = $users_per_page;
$args['offset'] = ( $paged-1 ) * $users_per_page;
$args['role'] = 'customer';
$args['fields'] = 'all_with_meta';
$args['search'] = '';
if ( '' !== $args['search'] )
$args['search'] = '*' . $args['search'] . '*';
if ( $this->is_site_users )
$args['blog_id'] = $this->site_id;
if ( isset( $_REQUEST['orderby'] ) )
$args['orderby'] = $_REQUEST['orderby'];
if ( isset( $_REQUEST['order'] ) )
$args['order'] = $_REQUEST['order'];
// Query the user IDs for this page
$wp_user_search = new WP_User_Query( $args );
$this->items = $wp_user_search->get_results();
$this->set_pagination_args( array(
'total_items' => $wp_user_search->get_total(),
'per_page' => $users_per_page,
) );
}
/**
* Output 'no users' message.
*
* @since 3.1.0
* @access public
*/
public function no_items() {
_e( 'No users found.' );
}
/**
* Return an associative array listing all the views that can be used
* with this table.
*
* Provides a list of roles and user count for that role for easy
* filtering of the user table.
*
* @since 3.1.0
* @access protected
*
* @global string $role
*
* @return array An array of HTML links, one for each view.
*/
protected function get_views() {
global $role;
$wp_roles = wp_roles();
if ( $this->is_site_users ) {
$url = 'site-users.php?id=' . $this->site_id;
switch_to_blog( $this->site_id );
$users_of_blog = count_users();
restore_current_blog();
} else {
$url = 'users.php';
$users_of_blog = count_users();
}
$total_users = $users_of_blog['total_users'];
$avail_roles =& $users_of_blog['avail_roles'];
unset($users_of_blog);
$class = empty($role) ? ' class="current"' : '';
$role_links = array();
$role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
foreach ( $wp_roles->get_names() as $this_role => $name ) {
if ( !isset($avail_roles[$this_role]) )
continue;
$class = '';
if ( $this_role == $role ) {
$class = ' class="current"';
}
$name = translate_user_role( $name );
/* translators: User role name with count */
$name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles[$this_role] ) );
$role_links[$this_role] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$class>$name</a>";
}
return $role_links;
}
/**
* Retrieve an associative array of bulk actions available on this table.
*
* @since 3.1.0
* @access protected
*
* @return array Array of bulk actions.
*/
protected function get_bulk_actions() {
$actions = array();
return $actions;
}
/**
* Output the controls to allow user roles to be changed in bulk.
*
* @since 3.1.0
* @access protected
*
* @param string $which Whether this is being invoked above ("top")
* or below the table ("bottom").
*/
protected function extra_tablenav( $which ) {
if ( 'top' != $which )
return;
}
/**
* Capture the bulk action required, and return it.
*
* Overridden from the base class implementation to capture
* the role change drop-down.
*
* @since 3.1.0
* @access public
*
* @return string The bulk action required.
*/
public function current_action() {
if ( isset($_REQUEST['changeit']) && !empty($_REQUEST['new_role']) )
return 'promote';
return parent::current_action();
}
/**
* Get a list of columns for the list table.
*
* @since 3.1.0
* @access public
*
* @return array Array in which the key is the ID of the column,
* and the value is the description.
*/
public function get_columns() {
$c = array(
'cb' => '<input type="checkbox" />',
'username' => __( 'Username' ),
'name' => __( 'Name' ),
'email' => __( 'E-mail' ),
'projects' => __( 'Contribute To', WC_QD_TXT ),
'donations' => __( 'Total Donations',WC_QD_TXT ),
);
if ( $this->is_site_users )
unset( $c['posts'] );
return $c;
}
/**
* Get a list of sortable columns for the list table.
*
* @since 3.1.0
* @access protected
*
* @return array Array of sortable columns.
*/
protected function get_sortable_columns() {
$c = array(
'username' => 'login',
'name' => 'name',
'email' => 'email',
);
if ( $this->is_site_users )
unset( $c['posts'] );
return $c;
}
/**
* Generate the list table rows.
*
* @since 3.1.0
* @access public
*/
public function display_rows() {
// Query the post counts for this page
if ( ! $this->is_site_users )
$post_counts = count_many_users_posts( array_keys( $this->items ) );
$editable_roles = array_keys( get_editable_roles() );
foreach ( $this->items as $userid => $user_object ) {
if ( count( $user_object->roles ) <= 1 ) {
$role = reset( $user_object->roles );
} elseif ( $roles = array_intersect( array_values( $user_object->roles ), $editable_roles ) ) {
$role = reset( $roles );
} else {
$role = reset( $user_object->roles );
}
if ( is_multisite() && empty( $user_object->allcaps ) )
continue;
echo "\n\t" . $this->single_row( $user_object, $style = '', $role, isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
}
}
/**
* Generate HTML for a single row on the users.php admin panel.
*
* @since 3.1.0
* @since 4.2.0 The `$style` argument was deprecated.
* @access public
*
* @param object $user_object The current user object.
* @param string $style Deprecated. Not used.
* @param string $role Optional. Key for the $wp_roles array. Default empty.
* @param int $numposts Optional. Post count to display for this user. Defaults
* to zero, as in, a new user has made zero posts.
* @return string Output for a single row.
*/
public function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
$wp_roles = wp_roles();
if ( ! ( $user_object instanceof WP_User ) ) {
$user_object = get_userdata( (int) $user_object );
}
$user_object->filter = 'display';
$email = $user_object->user_email;
if ( $this->is_site_users )
$url = "site-users.php?id={$this->site_id}&amp;";
else
$url = 'users.php?';
$checkbox = '';
// Check if the user for this row is editable
if ( current_user_can( 'list_users' ) ) {
// Set up the user editing link
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
// Set up the hover actions for this user
$actions = array();
if ( current_user_can( 'edit_user', $user_object->ID ) ) {
$edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong>";
$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
} else {
$edit = "<strong>$user_object->user_login</strong>";
}
if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) )
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>";
if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) )
$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
/**
* Filter the action links displayed under each user in the Users list table.
*
* @since 2.8.0
*
* @param array $actions An array of action links to be displayed.
* Default 'Edit', 'Delete' for single site, and
* 'Edit', 'Remove' for Multisite.
* @param WP_User $user_object WP_User object for the currently-listed user.
*/
$actions = apply_filters( 'user_row_actions', $actions, $user_object );
// Set up the checkbox ( because the user is editable, otherwise it's empty )
$checkbox = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>'
. "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />";
} else {
$edit = '<strong>' . $user_object->user_login . '</strong>';
}
$role_name = isset( $wp_roles->role_names[$role] ) ? translate_user_role( $wp_roles->role_names[$role] ) : __( 'None' );
$avatar = get_avatar( $user_object->ID, 32 );
$r = "<tr id='user-$user_object->ID'>";
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
$classes = "$column_name column-$column_name";
if ( $primary === $column_name ) {
$classes .= ' has-row-actions column-primary';
}
if ( 'posts' === $column_name ) {
$classes .= ' num'; // Special case for that column
}
if ( in_array( $column_name, $hidden ) ) {
$classes .= ' hidden';
}
$data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
$attributes = "class='$classes' $data";
if ( 'cb' === $column_name ) {
$r .= "<th scope='row' class='check-column'>$checkbox</th>";
} else {
$r .= "<td $attributes>";
switch ( $column_name ) {
case 'username':
$r .= "$avatar $edit";
break;
case 'name':
$r .= "$user_object->first_name $user_object->last_name";
break;
case 'email':
$r .= "<a href='" . esc_url( "mailto:$email" ) . "'>$email</a>";
break;
case 'projects':
$projects = WC_QD()->db()->get_donation_grouped_count($user_object->ID);
foreach($projects as $project){
$r .= '<span> <strong> <a href="'.get_permalink($project['projectid']).'" > '.get_the_title($project['projectid']).' </a>';
$r .= ' </strong> x '.$project['num_posts'].'</span> <br/>';
}
break;
case 'donations':
$donation_ids = WC_QD()->db()->get_user_donations_ids($user_object->ID);
$donation_ids = WC_QD()->db()->extract_donation_id($donation_ids);
$price = array();
foreach($donation_ids as $donation){
$order = wc_get_order($donation);
$prices = $order->get_total();
$currname = $order->get_order_currency();
if(! isset($price[$currname])){$price[$currname] = 0;}
$price[$currname] = $price[$currname] + $prices;
}
foreach($price as $pk => $pv){
$r .= " <strong> {$pk} : {$pv} <strong> <br/>";
}
break;
default:
/**
* Filter the display output of custom columns in the Users list table.
*
* @since 2.8.0
*
* @param string $output Custom column output. Default empty.
* @param string $column_name Column name.
* @param int $user_id ID of the currently-listed user.
*/
$r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
}
if ( $primary === $column_name ) {
$r .= $this->row_actions( $actions );
}
$r .= "</td>";
}
}
$r .= '</tr>';
return $r;
}
/**
* Gets the name of the default primary column.
*
* @since 4.3.0
* @access protected
*
* @return string Name of the default primary column, in this case, 'username'.
*/
protected function get_default_primary_column_name() {
return 'username';
}
}
function donor_render_list_page($shop = ''){
$wc_qd_donation_orders_listing = new WP_Donors_Listing_Table($shop);
$wc_qd_donation_orders_listing->prepare_items();
?>
<div class="wrap">
<div id="icon-users" class="icon32"><br/></div>
<h2>Donors</h2>
<form id="donors_listing" method="get">
<input type="hidden" name="post_type" value="wc_qd_orders" />
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
<?php $wc_qd_donation_orders_listing->display() ?>
</form>
</div>
<?php } ?>
\ No newline at end of file
...@@ -76,6 +76,30 @@ class WooCommerce_Quick_Donation_DB { ...@@ -76,6 +76,30 @@ class WooCommerce_Quick_Donation_DB {
return array(); return array();
} }
public function get_donation_grouped_count($user_id = ''){
global $wpdb;
$query = 'SELECT projectid, userid,COUNT( * ) AS num_posts FROM '.WC_QD_TB;
if(!empty($user_id)){ $query .= ' WHERE userid = '.$user_id; }
$query .= ' GROUP BY projectid';
$query .= ' , userid ';
$db_request = $wpdb->get_results($query,ARRAY_A);
if(!empty($db_request)){
return $db_request;
}
return array();
}
public function get_doners_ids(){
global $wpdb;
$db_request = $wpdb->get_results("SELECT DISTINCT `userid` FROM ".WC_QD_TB,ARRAY_A);
if(!empty($db_request)){
return $db_request;
}
return array();
}
public function extract_donation_id($ids){ public function extract_donation_id($ids){
$return_ids = array(); $return_ids = array();
foreach($ids as $i){ foreach($ids as $i){
......
...@@ -13,10 +13,8 @@ class WooCommerce_Quick_Donation_Functions { ...@@ -13,10 +13,8 @@ class WooCommerce_Quick_Donation_Functions {
'field-radio.php' => 'fields/field-radio.php', 'field-radio.php' => 'fields/field-radio.php',
'field-select.php' => 'fields/field-select.php', 'field-select.php' => 'fields/field-select.php',
'field-text.php' => 'fields/field-text.php', 'field-text.php' => 'fields/field-text.php',
'emails/donation-customer-invoice.php' => 'emails/donation-customer-invoice.php', 'emails/donation-customer-invoice.php' => 'emails/donation-customer-invoice.php',
'emails/plaint/donation-customer-invoice.php' => 'emails/plain/donation-customer-invoice.php', 'emails/plaint/donation-customer-invoice.php' => 'emails/plain/donation-customer-invoice.php',
'myaccount/my-donations.php' => 'myaccount/my-donations.php', 'myaccount/my-donations.php' => 'myaccount/my-donations.php',
), ),
...@@ -41,6 +39,10 @@ class WooCommerce_Quick_Donation_Functions { ...@@ -41,6 +39,10 @@ class WooCommerce_Quick_Donation_Functions {
'after_order' => array( 'after_order' => array(
'order/order-details.php' => 'order/donation-order-details.php', 'order/order-details.php' => 'order/donation-order-details.php',
'checkout/thankyou.php' => 'checkout/donation-thankyou.php', 'checkout/thankyou.php' => 'checkout/donation-thankyou.php',
'myaccount/view-order.php' => 'myaccount/view-donation.php',
'order/order-details-item.php' => 'order/order-details-item.php',
'order/order-details-customer.php' => 'order/order-details-customer.php',
) )
...@@ -51,24 +53,34 @@ class WooCommerce_Quick_Donation_Functions { ...@@ -51,24 +53,34 @@ class WooCommerce_Quick_Donation_Functions {
add_filter( 'woocommerce_email_classes', array($this,'add_email_classes')); add_filter( 'woocommerce_email_classes', array($this,'add_email_classes'));
add_action( 'woocommerce_available_payment_gateways',array($this,'remove_gateway')); add_action( 'woocommerce_available_payment_gateways',array($this,'remove_gateway'));
add_filter( 'woocommerce_locate_template' , array($this,'wc_locate_template'),10,3); add_filter( 'woocommerce_locate_template' , array($this,'wc_locate_template'),10,3);
add_filter( 'the_title', array($this,'wc_page_endpoint_title' ),1); add_filter( 'the_title', array($this,'wc_page_endpoint_title' ),10,2);
} }
public function wc_page_endpoint_title($title){ public function wc_page_endpoint_title($title, $id){
global $wp_query; if(is_page($id)){
global $wp_query;
if ( ! is_null( $wp_query ) && ! is_admin() && is_main_query() && in_the_loop() && is_page() && is_wc_endpoint_url() ) { if ( ! is_null( $wp_query ) && ! is_admin() && is_main_query() && in_the_loop() && is_page() && is_wc_endpoint_url() ) {
$endpoint = WC()->query->get_current_endpoint(); $endpoint = WC()->query->get_current_endpoint();
if('order-received' == $endpoint){
$order_id = $wp_query->query['order-received']; if('order-received' == $endpoint){
if(WC_QD()->db()->_is_donation($order_id)){ $order_id = $wp_query->query['order-received'];
$title = 'Donation Received'; if(WC_QD()->db()->_is_donation($order_id)){
remove_filter( 'the_title', 'wc_page_endpoint_title' ); $title = 'Donation Received';
}
} }
}
}
if('view-order' == $endpoint){
$order_id = $wp_query->query['view-order'];
if(WC_QD()->db()->_is_donation($order_id)){
$title = 'Donation #'.$order_id;
remove_filter( 'the_title', 'wc_page_endpoint_title' );
}
}
}
}
return $title; return $title;
} }
......
#woocommerce-quick-donation-order-data > h3,#woocommerce-quick-donation-order-data > .handlediv{display: none;} #woocommerce-quick-donation-order-data > h3,#woocommerce-quick-donation-order-data > .handlediv{display: none;}
\ No newline at end of file
form#donors_listing div.tablenav {margin-top:0; height: auto;}
form#donors_listing div.tablenav span.displaying-num {margin-top:0;}
form#donors_listing div.bulkactions{display: none !important;}
form#donors_listing div.tablenav-pages{height: auto; margin: 0;}
\ No newline at end of file
<?php
if(! function_exists('qd_get_message')){
function get_message($id,$search_replace = array()){
$message = WC_QD()->db()->get_message($id,$search_replace);
return $message;
}
}
if(! function_exists('qd_min_amount_project'){
function qd_min_amount_project($id = ''){
$min = WC_QD()->db()->min_project($id);
return $min;
}
}
if(! function_exists('qd_max_amount_project'){
function qd_max_amount_project($id = ''){
$max = WC_QD()->db()->max_project($id);
return $max;
}
}
?>
\ No newline at end of file
...@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php else : ?> <?php else : ?>
<h3><?php _e( 'Doner Details', 'woocommerce' ); ?></h3> <h3><?php _e( 'Donor Details', 'woocommerce' ); ?></h3>
<?php endif; ?> <?php endif; ?>
......
<?php
/**
* View Order
*
* Shows the details of a particular order on the account page
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.2.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<?php wc_print_notices(); ?>
<p style="margin-bottom: 10px;" class="order-info"><?php printf( __( 'Placed on <mark class="order-date">%s</mark> and is currently <mark class="order-status">%s</mark>.', WC_QD_TXT ), 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() ) :
?>
<h2><?php _e( 'Order Updates', 'woocommerce' ); ?></h2>
<ol class="commentlist notes">
<?php foreach ( $notes as $note ) : ?>
<li class="comment note">
<div class="comment_container">
<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>
<div class="description">
<?php echo wpautop( wptexturize( $note->comment_content ) ); ?>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</li>
<?php endforeach; ?>
</ol>
<?php
endif;
do_action( 'woocommerce_view_order', $order_id );
...@@ -37,6 +37,7 @@ $order = wc_get_order( $order_id ); ...@@ -37,6 +37,7 @@ $order = wc_get_order( $order_id );
<tfoot> <tfoot>
<?php <?php
foreach ( $order->get_order_item_totals() as $key => $total ) { foreach ( $order->get_order_item_totals() as $key => $total ) {
if('cart_subtotal' == $key || 'order_total' == $key){continue;}
?> ?>
<tr> <tr>
<th scope="row"><?php echo $total['label']; ?></th> <th scope="row"><?php echo $total['label']; ?></th>
......
...@@ -10,59 +10,26 @@ ...@@ -10,59 +10,26 @@
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
?> ?>
<header><h2><?php _e( 'Customer Details', 'woocommerce' ); ?></h2></header> <div class="col1-set addresses">
<div class="col-1">
<table class="shop_table shop_table_responsive customer_details"> <header class="title"> <h3><?php _e( 'Billing Address', 'woocommerce' ); ?></h3> </header>
<?php if ( $order->customer_note ) : ?> <address style="margin-bottom: 10px;">
<tr> <?php echo ( $address = $order->get_formatted_billing_address() ) ? $address : __( 'N/A', 'woocommerce' ); ?>
<th><?php _e( 'Note:', 'woocommerce' ); ?></th> </address>
<td><?php echo wptexturize( $order->customer_note ); ?></td>
</tr> <?php if ( $order->customer_note ) : ?>
<?php endif; ?> <p style="margin-bottom: 10px;"><strong><?php _e( 'Note:', 'woocommerce' ); ?></strong> <?php echo wptexturize( $order->customer_note ); ?></p>
<?php endif; ?>
<?php if ( $order->billing_email ) : ?> <?php if ( $order->billing_email ) : ?>
<tr> <p style="margin-bottom: 10px;"><strong><?php _e( 'Email:', WC_QD_TXT ); ?></strong> <?php echo esc_html( $order->billing_email ); ?></p>
<th><?php _e( 'Email:', 'woocommerce' ); ?></th> <?php endif; ?>
<td><?php echo esc_html( $order->billing_email ); ?></td>
</tr> <?php if ( $order->billing_phone ) : ?>
<?php endif; ?> <p style="margin-bottom: 10px;"><strong><?php _e( 'Telephone:', WC_QD_TXT ); ?></strong> <?php echo esc_html( $order->billing_phone ); ?></p>
<?php endif; ?>
<?php if ( $order->billing_phone ) : ?> <?php do_action( 'woocommerce_order_details_after_customer_details', $order ); ?>
<tr>
<th><?php _e( 'Telephone:', 'woocommerce' ); ?></th> </div><!-- /.col-1 -->
<td><?php echo esc_html( $order->billing_phone ); ?></td> </div><!-- /.col2-set -->
</tr>
<?php endif; ?> \ No newline at end of file
<?php do_action( 'woocommerce_order_details_after_customer_details', $order ); ?>
</table>
<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() ) : ?>
<div class="col2-set addresses">
<div class="col-1">
<?php endif; ?>
<header class="title">
<h3><?php _e( 'Billing Address', 'woocommerce' ); ?></h3>
</header>
<address>
<?php echo ( $address = $order->get_formatted_billing_address() ) ? $address : __( 'N/A', 'woocommerce' ); ?>
</address>
<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() ) : ?>
</div><!-- /.col-1 -->
<div class="col-2">
<header class="title">
<h3><?php _e( 'Shipping Address', 'woocommerce' ); ?></h3>
</header>
<address>
<?php echo ( $address = $order->get_formatted_shipping_address() ) ? $address : __( 'N/A', 'woocommerce' ); ?>
</address>
</div><!-- /.col-2 -->
</div><!-- /.col2-set -->
<?php endif; ?>
...@@ -10,25 +10,16 @@ ...@@ -10,25 +10,16 @@
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
return;
}
?> ?>
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>"> <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>">
<td class="product-name"> <td class="product-name">
<?php <?php
$is_visible = $product && $product->is_visible(); $is_visible = $product && $product->is_visible();
$project_id = WC_QD()->db()->get_project_id($order->id);
echo apply_filters( 'woocommerce_order_item_name', $is_visible ? sprintf( '<a href="%s">%s</a>', get_permalink( $item['product_id'] ), $item['name'] ) : $item['name'], $item, $is_visible ); echo sprintf( '<a href="%s">%s</a>', get_permalink( $project_id ), get_the_title($project_id ));
echo apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '&times; %s', $item['qty'] ) . '</strong>', $item );
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order );
$order->display_item_meta( $item );
$order->display_item_downloads( $item );
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order );
?> ?>
</td> </td>
<td class="product-total"> <td class="product-total">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment