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,7 +85,9 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -72,7 +85,9 @@ 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>";
} }
...@@ -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
......
This diff is collapsed.
...@@ -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){
if(is_page($id)){
global $wp_query; 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){ if('order-received' == $endpoint){
$order_id = $wp_query->query['order-received']; $order_id = $wp_query->query['order-received'];
if(WC_QD()->db()->_is_donation($order_id)){ if(WC_QD()->db()->_is_donation($order_id)){
$title = 'Donation Received'; $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' ); 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;}
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>
......
...@@ -11,58 +11,25 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -11,58 +11,25 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
?> ?>
<header><h2><?php _e( 'Customer Details', 'woocommerce' ); ?></h2></header> <div class="col1-set addresses">
<div class="col-1">
<header class="title"> <h3><?php _e( 'Billing Address', 'woocommerce' ); ?></h3> </header>
<address style="margin-bottom: 10px;">
<?php echo ( $address = $order->get_formatted_billing_address() ) ? $address : __( 'N/A', 'woocommerce' ); ?>
</address>
<table class="shop_table shop_table_responsive customer_details">
<?php if ( $order->customer_note ) : ?> <?php if ( $order->customer_note ) : ?>
<tr> <p style="margin-bottom: 10px;"><strong><?php _e( 'Note:', 'woocommerce' ); ?></strong> <?php echo wptexturize( $order->customer_note ); ?></p>
<th><?php _e( 'Note:', 'woocommerce' ); ?></th>
<td><?php echo wptexturize( $order->customer_note ); ?></td>
</tr>
<?php endif; ?> <?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>
<td><?php echo esc_html( $order->billing_email ); ?></td>
</tr>
<?php endif; ?> <?php endif; ?>
<?php if ( $order->billing_phone ) : ?> <?php if ( $order->billing_phone ) : ?>
<tr> <p style="margin-bottom: 10px;"><strong><?php _e( 'Telephone:', WC_QD_TXT ); ?></strong> <?php echo esc_html( $order->billing_phone ); ?></p>
<th><?php _e( 'Telephone:', 'woocommerce' ); ?></th>
<td><?php echo esc_html( $order->billing_phone ); ?></td>
</tr>
<?php endif; ?> <?php endif; ?>
<?php do_action( 'woocommerce_order_details_after_customer_details', $order ); ?> <?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><!-- /.col-1 -->
<div class="col-2"> </div><!-- /.col2-set -->
<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 -->
\ No newline at end of file
<?php endif; ?>
...@@ -11,24 +11,15 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -11,24 +11,15 @@ 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 sprintf( '<a href="%s">%s</a>', get_permalink( $project_id ), get_the_title($project_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 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