Commit a1e127ca authored by Varun Sridharan's avatar Varun Sridharan

Released V 1.3.4 BETA

**Fixes**

* Menu Error In Front End When Logged In Using Custom ID

**Tweaks**

* Removed Unwated Metabox For Donation order Page
* Added New Custom Metabox For Donation Order details
* Added Few Functions In WC Quick Donation DB Class
* Modifed Core WC Quick Donation Templates

**Added**

* Custom Cart Page Template Support
* Custom Order Thank You Page & Order Details Tables Support
parent b17a8087
...@@ -21,11 +21,8 @@ class WooCommerce_Quick_Donation_Admin_Function { ...@@ -21,11 +21,8 @@ class WooCommerce_Quick_Donation_Admin_Function {
add_action( 'post_row_actions', array($this,'protect_donation_product'),99,2); add_action( 'post_row_actions', array($this,'protect_donation_product'),99,2);
add_action( 'parse_query', array( $this, 'hide_donation_order_woocommerce_order' ) ); add_action( 'parse_query', array( $this, 'hide_donation_order_woocommerce_order' ) );
add_filter( 'wc_order_types',array($this,'add_wc_order_types'),99,2); add_filter( 'wc_order_types',array($this,'add_wc_order_types'),99,2);
} }
public function hide_donation_order_woocommerce_order($query) { public function hide_donation_order_woocommerce_order($query) {
global $pagenow,$post_type; global $pagenow,$post_type;
$query = $query; $query = $query;
...@@ -43,6 +40,7 @@ class WooCommerce_Quick_Donation_Admin_Function { ...@@ -43,6 +40,7 @@ class WooCommerce_Quick_Donation_Admin_Function {
$order_type = $order_types; $order_type = $order_types;
if('' == $type){ if('' == $type){
$order_type[] = WC_QD_PT; $order_type[] = WC_QD_PT;
$order_type[] = 'wc_qd_orders';
} }
return $order_type; return $order_type;
} }
......
...@@ -54,6 +54,7 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -54,6 +54,7 @@ class WooCommerce_Quick_Donation_Admin {
global $submenu; global $submenu;
//echo '<pre>'.print_r($submenu,true).'</pre>'; exit; //echo '<pre>'.print_r($submenu,true).'</pre>'; exit;
$name = 'edit.php?post_type='.WC_QD_PT; $name = 'edit.php?post_type='.WC_QD_PT;
if(empty($submenu)){return $submenu;}
$arr = array(); $arr = array();
$arr[] = $submenu[$name][18]; $arr[] = $submenu[$name][18];
$arr[] = $submenu[$name][5]; $arr[] = $submenu[$name][5];
...@@ -104,9 +105,14 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -104,9 +105,14 @@ class WooCommerce_Quick_Donation_Admin {
* Register the stylesheets for the admin area. * Register the stylesheets for the admin area.
*/ */
public function enqueue_styles() { public function enqueue_styles() {
wp_enqueue_style(WC_QD_SLUG.'_quick_hacks',WC_QD_CSS.'admin-hack-style.css' , array(), WC_QD()->version, 'all' );
if('wcqd_project_page_WC_QD_settings' == $this->current_screen()){ if('wcqd_project_page_WC_QD_settings' == $this->current_screen()){
wp_enqueue_style(WC_QD_SLUG.'_core_style',WC_QD_CSS.'admin-settings-style.css' , array(), WC_QD()->version, 'all' ); wp_enqueue_style(WC_QD_SLUG.'_core_style',WC_QD_CSS.'admin-settings-style.css' , array(), WC_QD()->version, 'all' );
} }
if(in_array($this->current_screen() , $this->get_screen_ids())) { if(in_array($this->current_screen() , $this->get_screen_ids())) {
wp_enqueue_style(WC_QD_SLUG.'_core_style',WC_QD_CSS.'admin-style.css' , array(), WC_QD()->version, 'all' ); wp_enqueue_style(WC_QD_SLUG.'_core_style',WC_QD_CSS.'admin-style.css' , array(), WC_QD()->version, 'all' );
} }
......
...@@ -17,7 +17,82 @@ if ( ! defined( 'WPINC' ) ) { die; } ...@@ -17,7 +17,82 @@ if ( ! defined( 'WPINC' ) ) { die; }
class WooCommerce_Quick_Donation_Admin_Order_Page_Functions { class WooCommerce_Quick_Donation_Admin_Order_Page_Functions {
public function __construct(){ public function __construct(){
add_action('add_meta_boxes_shop_order',array($this,'remove_metabox'),99,2); WC_QD()->load_files(WC_QD_ADMIN.'metabox/*.php');
add_filter( 'manage_shop_order_posts_columns', array( $this, 'shop_order_columns' ) );
add_action( 'add_meta_boxes_shop_order',array($this,'remove_metabox'),99,2);
add_action( 'manage_shop_order_posts_custom_column', array( $this, 'render_shop_order_columns' ), 10 );
add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 );
add_action( 'woocommerce_quick_donation_process_shop_order_meta', 'WC_Quick_Donation_Meta_Box_Order_Data::save', 40, 2 );
}
/**
* Define custom columns for orders
* @param array $existing_columns
* @return array
*/
public function shop_order_columns( $existing_columns ) {
$existingc = $existing_columns;
if("wcqd_project_page_wc_qd_orders" == WC_QD()->admin()->current_screen()){
$existingc = '';
$existingc['cb'] = $existing_columns['cb'];
$existingc['order_status'] = $existing_columns['order_status'];
$existingc['order_id'] = __('ID',WC_QD_TXT);
$existingc['by_user'] = __('Donor',WC_QD_TXT);
$existingc['donation_project'] = __("Project",WC_QD_TXT);
$existingc['customer_message'] = $existing_columns['customer_message'];
$existingc['order_notes'] = $existing_columns['order_notes'];
$existingc['order_date'] = $existing_columns['order_date'];
$existingc['order_total'] = $existing_columns['order_total'];
$existingc['order_actions'] = $existing_columns['order_actions'];
}
return $existingc;
}
public function render_shop_order_columns( $column ){
global $post, $woocommerce, $the_order;
if ( empty( $the_order ) || $the_order->id != $post->ID ) {
$the_order = wc_get_order( $post->ID );
}
if('donation_project' == $column){
$project_ID = WC_QD()->db()->get_project_id($post->ID);
$title = get_the_title($project_ID);
$link = get_permalink($project_ID);
printf('<a href="%s"> %s </a> ',$link,$title);
} else if('order_id' == $column){
printf( _x( '%s ', 'Order number by X', 'woocommerce' ), '<a href="' . admin_url( 'post.php?post=' . absint( $post->ID ) . '&action=edit' ) . '" class="row-title"><strong>#' . esc_attr( $the_order->get_order_number() ) . '</strong></a>' );
} else if ('by_user' == $column){
if ( $the_order->user_id ) {
$user_info = get_userdata( $the_order->user_id );
}
if ( ! empty( $user_info ) ) {
$username = '<a href="user-edit.php?user_id=' . absint( $user_info->ID ) . '">';
if ( $user_info->first_name || $user_info->last_name ) {
$username .= esc_html( ucfirst( $user_info->first_name ) . ' ' . ucfirst( $user_info->last_name ) );
} else {
$username .= esc_html( ucfirst( $user_info->display_name ) );
}
$username .= '</a>';
} else {
if ( $the_order->billing_first_name || $the_order->billing_last_name ) {
$username = trim( $the_order->billing_first_name . ' ' . $the_order->billing_last_name );
} else {
$username = __( 'Guest', 'woocommerce' );
}
}
echo $username;
}
} }
public function remove_metabox($post){ public function remove_metabox($post){
...@@ -25,8 +100,16 @@ class WooCommerce_Quick_Donation_Admin_Order_Page_Functions { ...@@ -25,8 +100,16 @@ class WooCommerce_Quick_Donation_Admin_Order_Page_Functions {
if($is_donation){ if($is_donation){
remove_meta_box('woocommerce-order-items','shop_order','normal'); remove_meta_box('woocommerce-order-items','shop_order','normal');
remove_meta_box('woocommerce-order-downloads','shop_order','normal'); remove_meta_box('woocommerce-order-downloads','shop_order','normal');
remove_meta_box('woocommerce-order-data','shop_order','normal');
add_meta_box( 'woocommerce-quick-donation-order-data', sprintf( __( '%s Data', 'woocommerce' ), 'Donation' ), 'WC_Quick_Donation_Meta_Box_Order_Data::output', 'shop_order', 'normal', 'high' );
remove_action( 'woocommerce_process_shop_order_meta', 'WC_Meta_Box_Order_Data::save', 40);
}
} }
public function save_meta_boxes( $post_id, $post ) {
if('shop_order' == $post->post_type)
do_action( 'woocommerce_quick_donation_process_shop_order_meta', $post_id, $post );
} }
} }
......
<?php
/**
* Order Data
*
* Functions for displaying the order data meta box.
*
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin/Meta Boxes
* @version 2.2.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* WC_Meta_Box_Order_Data Class
*/
class WC_Quick_Donation_Meta_Box_Order_Data {
/**
* Billing fields
*
* @var array
*/
protected static $billing_fields = array();
/**
* Shipping fields
*
* @var array
*/
protected static $shipping_fields = array();
/**
* Init billing and shipping fields we display + save
*/
public static function init_address_fields() {
self::$billing_fields = apply_filters( 'woocommerce_admin_billing_fields', array(
'first_name' => array(
'label' => __( 'First Name', 'woocommerce' ),
'show' => false
),
'last_name' => array(
'label' => __( 'Last Name', 'woocommerce' ),
'show' => false
),
'company' => array(
'label' => __( 'Company', 'woocommerce' ),
'show' => false
),
'address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'show' => false
),
'address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'show' => false
),
'city' => array(
'label' => __( 'City', 'woocommerce' ),
'show' => false
),
'postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'show' => false
),
'country' => array(
'label' => __( 'Country', 'woocommerce' ),
'show' => false,
'class' => 'js_field-country select short',
'type' => 'select',
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries()
),
'state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'class' => 'js_field-state select short',
'show' => false
),
'email' => array(
'label' => __( 'Email', 'woocommerce' ),
),
'phone' => array(
'label' => __( 'Phone', 'woocommerce' ),
),
) );
self::$shipping_fields = apply_filters( 'woocommerce_admin_shipping_fields', array(
'first_name' => array(
'label' => __( 'First Name', 'woocommerce' ),
'show' => false
),
'last_name' => array(
'label' => __( 'Last Name', 'woocommerce' ),
'show' => false
),
'company' => array(
'label' => __( 'Company', 'woocommerce' ),
'show' => false
),
'address_1' => array(
'label' => __( 'Address 1', 'woocommerce' ),
'show' => false
),
'address_2' => array(
'label' => __( 'Address 2', 'woocommerce' ),
'show' => false
),
'city' => array(
'label' => __( 'City', 'woocommerce' ),
'show' => false
),
'postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'show' => false
),
'country' => array(
'label' => __( 'Country', 'woocommerce' ),
'show' => false,
'type' => 'select',
'class' => 'js_field-country select short',
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_shipping_countries()
),
'state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'class' => 'js_field-state select short',
'show' => false
),
) );
}
/**
* Output the metabox
*/
public static function output( $post ) {
global $theorder;
if ( ! is_object( $theorder ) ) {
$theorder = wc_get_order( $post->ID );
}
$order = $theorder;
self::init_address_fields();
if ( WC()->payment_gateways() ) {
$payment_gateways = WC()->payment_gateways->payment_gateways();
} else {
$payment_gateways = array();
}
$payment_method = ! empty( $order->payment_method ) ? $order->payment_method : '';
$order_type_object = get_post_type_object( $post->post_type );
$donation_type_object = get_post_type_object( 'wcqd_project' );
wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
?>
<style type="text/css">
#post-body-content, #titlediv { display:none }
</style>
<div class="panel-wrap woocommerce">
<input name="post_title" type="hidden" value="<?php echo empty( $post->post_title ) ? __( 'Order', 'woocommerce' ) : esc_attr( $post->post_title ); ?>" />
<input name="post_status" type="hidden" value="<?php echo esc_attr( $post->post_status ); ?>" />
<div id="order_data" class="panel">
<h2><?php echo esc_html( sprintf( __( '%s %s details', 'woocommerce' ), $donation_type_object->labels->menu_name, $order->get_order_number() ) ); ?></h2>
<p class="order_number"><?php
if ( $payment_method ) {
printf( __( 'Payment via %s', 'woocommerce' ), ( isset( $payment_gateways[ $payment_method ] ) ? esc_html( $payment_gateways[ $payment_method ]->get_title() ) : esc_html( $payment_method ) ) );
if ( $transaction_id = $order->get_transaction_id() ) {
if ( isset( $payment_gateways[ $payment_method ] ) && ( $url = $payment_gateways[ $payment_method ]->get_transaction_url( $order ) ) ) {
echo ' (<a href="' . esc_url( $url ) . '" target="_blank">' . esc_html( $transaction_id ) . '</a>)';
} else {
echo ' (' . esc_html( $transaction_id ) . ')';
}
}
echo '. ';
}
if ( $ip_address = get_post_meta( $post->ID, '_customer_ip_address', true ) ) {
echo __( 'Customer IP', 'woocommerce' ) . ': ' . esc_html( $ip_address );
}
?></p>
<div class="order_data_column_container">
<div class="order_data_column">
<h4><?php _e( 'General Details', 'woocommerce' ); ?></h4>
<p class="form-field form-field-wide"><label for="order_date"><?php _e( 'Order date:', 'woocommerce' ) ?></label>
<input type="text" class="date-picker" name="order_date" id="order_date" maxlength="10" value="<?php echo date_i18n( 'Y-m-d', strtotime( $post->post_date ) ); ?>" pattern="[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])" />@<input type="text" class="hour" placeholder="<?php esc_attr_e( 'h', 'woocommerce' ) ?>" name="order_date_hour" id="order_date_hour" maxlength="2" size="2" value="<?php echo date_i18n( 'H', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />:<input type="text" class="minute" placeholder="<?php esc_attr_e( 'm', 'woocommerce' ) ?>" name="order_date_minute" id="order_date_minute" maxlength="2" size="2" value="<?php echo date_i18n( 'i', strtotime( $post->post_date ) ); ?>" pattern="\-?\d+(\.\d{0,})?" />
</p>
<p class="form-field form-field-wide"><label for="order_status"><?php _e( 'Order status:', 'woocommerce' ) ?></label>
<select id="order_status" name="order_status" class="wc-enhanced-select">
<?php
$statuses = wc_get_order_statuses();
foreach ( $statuses as $status => $status_name ) {
echo '<option value="' . esc_attr( $status ) . '" ' . selected( $status, 'wc-' . $order->get_status(), false ) . '>' . esc_html( $status_name ) . '</option>';
}
?>
</select></p>
<p class="form-field form-field-wide wc-customer-user">
<label for="customer_user"><?php _e( 'Customer:', 'woocommerce' ) ?> <?php
if ( ! empty( $order->customer_user ) ) {
$args = array( 'post_status' => 'all',
'post_type' => 'shop_order',
'_customer_user' => absint( $order->customer_user )
);
printf( '<a href="%s">%s &rarr;</a>',
esc_url( add_query_arg( $args, admin_url( 'edit.php' ) ) ),
__( 'View other orders', 'woocommerce' )
);
}
?></label>
<?php
$user_string = '';
$user_id = '';
if ( ! empty( $order->customer_user ) ) {
$user_id = absint( $order->customer_user );
$user = get_user_by( 'id', $user_id );
$user_string = esc_html( $user->display_name ) . ' (#' . absint( $user->ID ) . ' &ndash; ' . esc_html( $user->user_email ) . ')';
}
?>
<input type="hidden" class="wc-customer-search" id="customer_user" name="customer_user" data-placeholder="<?php esc_attr_e( 'Guest', 'woocommerce' ); ?>" data-selected="<?php echo htmlspecialchars( $user_string ); ?>" value="<?php echo $user_id; ?>" data-allow_clear="true" />
</p>
<?php do_action( 'woocommerce_admin_order_data_after_order_details', $order ); ?>
</div>
<div class="order_data_column">
<h4>
<?php _e( 'Donor Details', 'woocommerce' ); ?>
<a href="#" class="edit_address"><?php _e( 'Edit', 'woocommerce' ); ?></a>
<a href="#" class="tips load_customer_billing" data-tip="<?php esc_attr_e( 'Load billing address', 'woocommerce' ); ?>" style="display:none;"><?php _e( 'Load billing address', 'woocommerce' ); ?></a>
</h4>
<?php
// Display values
echo '<div class="address">';
if ( $order->get_formatted_billing_address() ) {
echo '<p><strong>' . __( 'Address', 'woocommerce' ) . ':</strong>' . wp_kses( $order->get_formatted_billing_address(), array( 'br' => array() ) ) . '</p>';
} else {
echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No billing address set.', 'woocommerce' ) . '</p>';
}
foreach ( self::$billing_fields as $key => $field ) {
if ( isset( $field['show'] ) && false === $field['show'] ) {
continue;
}
$field_name = 'billing_' . $key;
if ( $order->$field_name ) {
echo '<p><strong>' . esc_html( $field['label'] ) . ':</strong> ' . make_clickable( esc_html( $order->$field_name ) ) . '</p>';
}
}
echo '</div>';
// Display form
echo '<div class="edit_address">';
foreach ( self::$billing_fields as $key => $field ) {
if ( ! isset( $field['type'] ) ) {
$field['type'] = 'text';
}
if ( ! isset( $field['id'] ) ){
$field['id'] = '_billing_' . $key;
}
switch ( $field['type'] ) {
case 'select' :
woocommerce_wp_select( $field );
break;
default :
woocommerce_wp_text_input( $field );
break;
}
}
?>
<p class="form-field form-field-wide">
<label><?php _e( 'Payment Method:', 'woocommerce' ); ?></label>
<select name="_payment_method" id="_payment_method" class="first">
<option value=""><?php _e( 'N/A', 'woocommerce' ); ?></option>
<?php
$found_method = false;
foreach ( $payment_gateways as $gateway ) {
if ( $gateway->enabled == "yes" ) {
echo '<option value="' . esc_attr( $gateway->id ) . '" ' . selected( $payment_method, $gateway->id, false ) . '>' . esc_html( $gateway->get_title() ) . '</option>';
if ( $payment_method == $gateway->id ) {
$found_method = true;
}
}
}
if ( ! $found_method && ! empty( $payment_method ) ) {
echo '<option value="' . esc_attr( $payment_method ) . '" selected="selected">' . __( 'Other', 'woocommerce' ) . '</option>';
} else {
echo '<option value="other">' . __( 'Other', 'woocommerce' ) . '</option>';
}
?>
</select>
</p>
<?php
woocommerce_wp_text_input( array( 'id' => '_transaction_id', 'label' => __( 'Transaction ID', 'woocommerce' ) ) );
echo '</div>';
do_action( 'woocommerce_admin_order_data_after_billing_address', $order );
?>
</div>
<div class="order_data_column">
<h4> <?php _e( 'Donation Details', WC_QD_TXT ); ?> </h4>
<?php
// Display values
echo '<div class="">';
require(WC_QD_ADMIN.'metabox/html/html-donation-info.php');
if ( apply_filters( 'woocommerce_enable_order_notes_field', 'yes' == get_option( 'woocommerce_enable_order_comments', 'yes' ) ) && $post->post_excerpt ) {
echo '<p><strong>' . __( 'Customer Provided Note', 'woocommerce' ) . ':</strong> ' . nl2br( esc_html( $post->post_excerpt ) ) . '</p>';
}
echo '</div>';
?>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<?php
}
/**
* Save meta box data
*/
public static function save( $post_id, $post ) {
global $wpdb;
self::init_address_fields();
// Add key
add_post_meta( $post_id, '_order_key', uniqid( 'order_' ), true );
// Update meta
update_post_meta( $post_id, '_customer_user', absint( $_POST['customer_user'] ) );
if ( ! empty( self::$billing_fields ) ) {
foreach ( self::$billing_fields as $key => $field ) {
if ( ! isset( $field['id'] ) ){
$field['id'] = '_billing_' . $key;
}
update_post_meta( $post_id, $field['id'], wc_clean( $_POST[ $field['id'] ] ) );
}
}
if ( isset( $_POST['_transaction_id'] ) ) {
update_post_meta( $post_id, '_transaction_id', wc_clean( $_POST[ '_transaction_id' ] ) );
}
// Payment method handling
if ( get_post_meta( $post_id, '_payment_method', true ) !== stripslashes( $_POST['_payment_method'] ) ) {
$methods = WC()->payment_gateways->payment_gateways();
$payment_method = wc_clean( $_POST['_payment_method'] );
$payment_method_title = $payment_method;
if ( isset( $methods) && isset( $methods[ $payment_method ] ) ) {
$payment_method_title = $methods[ $payment_method ]->get_title();
}
update_post_meta( $post_id, '_payment_method', $payment_method );
update_post_meta( $post_id, '_payment_method_title', $payment_method_title );
}
// Update date
if ( empty( $_POST['order_date'] ) ) {
$date = current_time('timestamp');
} else {
$date = strtotime( $_POST['order_date'] . ' ' . (int) $_POST['order_date_hour'] . ':' . (int) $_POST['order_date_minute'] . ':00' );
}
// Order data saved, now get it so we can manipulate status
$order = wc_get_order( $post_id );
// Order status
$order->update_status( $_POST['order_status'], '', true );
// Finally, set the date
$date = date_i18n( 'Y-m-d H:i:s', $date );
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_date = %s, post_date_gmt = %s WHERE ID = %s", $date, get_gmt_from_date( $date ), $post_id ) );
wc_delete_shop_order_transients( $post_id );
}
}
<table class="wc-order-totals">
<tr>
<td class="label"><strong> <?php _e( 'Project Name', WC_QD_TXT ); ?> : </strong></td>
<td class="total">
<div class="view"><?php
$project_ID = WC_QD()->db()->get_project_id($post->ID);
$title = get_the_title($project_ID);
$link = get_permalink($project_ID);
printf('<a href="%s"> %s </a> ',$link,$title);
?></div>
</td>
</tr>
<?php if ( wc_tax_enabled() ) : ?>
<?php foreach ( $order->get_tax_totals() as $code => $tax ) : ?>
<tr>
<td class="label"><?php echo $tax->label; ?>:</td>
<td class="total"><?php
if ( ( $refunded = $order->get_total_tax_refunded_by_rate_id( $tax->rate_id ) ) > 0 ) {
echo '<del>' . strip_tags( $tax->formatted_amount ) . '</del> <ins>' . wc_price( $tax->amount - $refunded, array( 'currency' => $order->get_order_currency() ) ) . '</ins>';
} else {
echo $tax->formatted_amount;
}
?></td>
<td width="1%"></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<tr>
<td class="label"><strong> <?php _e( 'Donation Amount', WC_QD_TXT ); ?> : </strong></td>
<td class="total">
<div class="view"><?php echo $order->get_formatted_order_total(); ?></div>
<div class="edit" style="display: none;">
<input type="text" class="wc_input_price" id="_order_total" name="_order_total" placeholder="<?php echo wc_format_localized_price( 0 ); ?>" value="<?php echo ( isset( $data['_order_total'][0] ) ) ? esc_attr( wc_format_localized_price( $data['_order_total'][0] ) ) : ''; ?>" />
<div class="clear"></div>
</div>
</td>
<td><?php if ( $order->is_editable() ) : ?>
<div class="wc-order-edit-line-item-actions"><a class="edit-order-item" href="#"></a> </div><?php endif; ?>
</td>
</tr>
</table>
<div class="order_data_column" style="display:none; visibility: hidden;">
<?php
echo '<div class="address">';
if ( $order->get_formatted_shipping_address() ) { echo '<p><strong>' . __( 'Address', 'woocommerce' ) . ':</strong>' . wp_kses( $order->get_formatted_shipping_address(), array( 'br' => array() ) ) . '</p>'; } else { echo '<p class="none_set"><strong>' . __( 'Address', 'woocommerce' ) . ':</strong> ' . __( 'No shipping address set.', 'woocommerce' ) . '</p>'; }
if ( ! empty( self::$shipping_fields ) ) { foreach ( self::$shipping_fields as $key => $field ) { if ( isset( $field['show'] ) && false === $field['show'] ) { continue; } $field_name = 'shipping_' . $key; if ( ! empty( $order->$field_name ) ) { echo '<p><strong>' . esc_html( $field['label'] ) . ':</strong> ' . make_clickable( esc_html( $order->$field_name ) ) . '</p>'; } } }
if ( apply_filters( 'woocommerce_enable_order_notes_field', 'yes' == get_option( 'woocommerce_enable_order_comments', 'yes' ) ) && $post->post_excerpt ) { echo '<p><strong>' . __( 'Customer Provided Note', 'woocommerce' ) . ':</strong> ' . nl2br( esc_html( $post->post_excerpt ) ) . '</p>'; }
echo '</div>';
echo '<div class="edit_address">';
if ( ! empty( self::$shipping_fields ) ) { foreach ( self::$shipping_fields as $key => $field ) { if ( ! isset( $field['type'] ) ) { $field['type'] = 'hidden'; } if ( ! isset( $field['id'] ) ){ $field['id'] = '_shipping_' . $key; }
switch ( $field['type'] ) {
case 'select' :
woocommerce_wp_select( $field );
break;
default :
woocommerce_wp_text_input( $field );
break;
} } }
if ( apply_filters( 'woocommerce_enable_order_notes_field', 'yes' == get_option( 'woocommerce_enable_order_comments', 'yes' ) ) ) {
?>
<p class="form-field form-field-wide"><label for="excerpt"><?php _e( 'Customer Provided Note', 'woocommerce' ) ?>:</label>
<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php esc_attr_e( 'Customer\'s notes about the order', 'woocommerce' ); ?>"><?php echo wp_kses_post( $post->post_excerpt ); ?></textarea></p>
<?php
}
echo '</div>';
?>
</div>
\ No newline at end of file
...@@ -48,7 +48,7 @@ class WC_QD_Post_Types { ...@@ -48,7 +48,7 @@ class WC_QD_Post_Types {
'name' => _x( 'Quick Donation Projects', 'Post Type General Name', WC_QD_TXT ), 'name' => _x( 'Quick Donation Projects', 'Post Type General Name', WC_QD_TXT ),
'singular_name' => _x( 'Quick Donation Project', 'Post Type Singular Name', WC_QD_TXT ), 'singular_name' => _x( 'Quick Donation Project', 'Post Type Singular Name', WC_QD_TXT ),
'menu_name' => __( 'Quick Donation', WC_QD_TXT ), 'menu_name' => __( 'Quick Donation', WC_QD_TXT ),
'name_admin_bar' => __( 'Quick Donation', WC_QD_TXT ), 'name_admin_bar' => __( 'Donation', WC_QD_TXT ),
'parent_item_colon' => __( 'Parent Project :', WC_QD_TXT ), 'parent_item_colon' => __( 'Parent Project :', WC_QD_TXT ),
'all_items' => __( 'All Project', WC_QD_TXT ), 'all_items' => __( 'All Project', WC_QD_TXT ),
'add_new_item' => __( 'Add New Project', WC_QD_TXT ), 'add_new_item' => __( 'Add New Project', WC_QD_TXT ),
......
...@@ -45,6 +45,11 @@ class WooCommerce_Quick_Donation_DB { ...@@ -45,6 +45,11 @@ class WooCommerce_Quick_Donation_DB {
return false; return false;
} }
public function get_project_id($id){
$project_id = intval($this->post_meta($id,'_project_details',true));
return $project_id;
}
public function add_db_option($order_id,$project_id,$user_id){ public function add_db_option($order_id,$project_id,$user_id){
global $wpdb; global $wpdb;
$data_c = array('date' => current_time( 'mysql' ),'userid' => $user_id,'donationid' => $order_id,'projectid' => $project_id); $data_c = array('date' => current_time( 'mysql' ),'userid' => $user_id,'donationid' => $order_id,'projectid' => $project_id);
......
...@@ -19,6 +19,11 @@ class WooCommerce_Quick_Donation_Functions { ...@@ -19,6 +19,11 @@ class WooCommerce_Quick_Donation_Functions {
), ),
'is_donation' => array( 'is_donation' => array(
'cart/cart-item-data.php' => 'cart/donation-cart-item-data',
'cart/cart-shipping.php' => 'cart/donation-cart-shipping.php',
'cart/cart-totals.php' => 'cart/donation-cart-totals.php',
'cart/cart.php' => 'cart/donation-cart.php',
'cart/proceed-to-checkout-button.php' => 'cart/donation-proceed-to-checkout-button.php',
'checkout/cart-errors.php' => 'checkout/donation-cart-errors.php', 'checkout/cart-errors.php' => 'checkout/donation-cart-errors.php',
'checkout/form-billing.php' => 'checkout/donation-form-billing.php', 'checkout/form-billing.php' => 'checkout/donation-form-billing.php',
'checkout/form-checkout.php' => 'checkout/donation-form-checkout.php', 'checkout/form-checkout.php' => 'checkout/donation-form-checkout.php',
...@@ -29,9 +34,13 @@ class WooCommerce_Quick_Donation_Functions { ...@@ -29,9 +34,13 @@ class WooCommerce_Quick_Donation_Functions {
'checkout/payment-method.php' => 'checkout/donation-payment-method.php', 'checkout/payment-method.php' => 'checkout/donation-payment-method.php',
'checkout/payment.php' => 'checkout/donation-payment.php', 'checkout/payment.php' => 'checkout/donation-payment.php',
'checkout/review-order.php' => 'checkout/donation-review-order.php', 'checkout/review-order.php' => 'checkout/donation-review-order.php',
'checkout/thankyou.php' => 'checkout/donation-thankyou.php',
), ),
'after_order' => array(
'order/order-details.php' => 'order/donation-order-details.php',
'checkout/thankyou.php' => 'checkout/donation-thankyou.php',
)
); );
...@@ -40,10 +49,27 @@ class WooCommerce_Quick_Donation_Functions { ...@@ -40,10 +49,27 @@ 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);
}
public function wc_page_endpoint_title($title){
global $wp_query;
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();
if('order-received' == $endpoint){
$order_id = $wp_query->query['order-received'];
if(WC_QD()->db()->_is_donation($order_id)){
$title = 'Donation Received';
remove_filter( 'the_title', 'wc_page_endpoint_title' );
}
}
} }
return $title;
}
public function add_email_classes($email_classes){ public function add_email_classes($email_classes){
$email_classes[WC_QD_DB.'new_donation_email'] = require(WC_QD_INC.'emails/class-new-email.php'); $email_classes[WC_QD_DB.'new_donation_email'] = require(WC_QD_INC.'emails/class-new-email.php');
...@@ -140,6 +166,7 @@ class WooCommerce_Quick_Donation_Functions { ...@@ -140,6 +166,7 @@ class WooCommerce_Quick_Donation_Functions {
} }
public function load_template($file,$path){ public function load_template($file,$path){
$wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woocommerce_get_template'; $wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woocommerce_get_template';
$wc_get_template( $file,array(), '', $path); $wc_get_template( $file,array(), '', $path);
} }
...@@ -205,15 +232,21 @@ class WooCommerce_Quick_Donation_Functions { ...@@ -205,15 +232,21 @@ class WooCommerce_Quick_Donation_Functions {
public function get_template($located, $template_name, $args, $template_path, $default_path ){ public function get_template($located, $template_name, $args, $template_path, $default_path ){
$file = $located; $file = $located;
if(isset($args['order_id'])){ $order_id = $args['order_id']; }
if(isset($args['order']->id)){ $order_id = $args['order']->id; }
if(isset(self::$search_template['general'][$template_name])){ if(isset(self::$search_template['general'][$template_name])){
$file = WC_QD()->f()->locate_template(self::$search_template['general'][$template_name]); $file = WC_QD()->f()->locate_template(self::$search_template['general'][$template_name]);
} } else if(WC_QD()->check_donation_exists_cart()){
if(WC_QD()->check_donation_exists_cart()){
if(isset(self::$search_template['is_donation'][$template_name])){ if(isset(self::$search_template['is_donation'][$template_name])){
$file = WC_QD()->f()->locate_template(self::$search_template['is_donation'][$template_name]); $file = WC_QD()->f()->locate_template(self::$search_template['is_donation'][$template_name]);
} }
} else {
if(WC_QD()->db()->_is_donation($order_id)){
if(isset(self::$search_template['after_order'][$template_name])){
$file = WC_QD()->f()->locate_template(self::$search_template['after_order'][$template_name]);
}
}
} }
return $file; return $file;
} }
......
...@@ -22,7 +22,7 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation { ...@@ -22,7 +22,7 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
add_action( 'woocommerce_checkout_update_order_meta',array($this,'update_order_meta')); add_action( 'woocommerce_checkout_update_order_meta',array($this,'update_order_meta'));
add_action( 'woocommerce_checkout_update_order_meta', array($this,'save_order_id_db')); add_action( 'woocommerce_checkout_update_order_meta', array($this,'save_order_id_db'));
add_action( 'woocommerce_email',array($this,'remove_email_actions')); add_action( 'woocommerce_email',array($this,'remove_email_actions'));
add_filter( 'woocommerce_cart_item_name', array($this,'change_donation_name')); add_filter( 'wc_quick_donation_cart_project_name', array($this,'change_donation_name'));
} }
$this->process_donation(); $this->process_donation();
} }
...@@ -30,7 +30,9 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation { ...@@ -30,7 +30,9 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
public function change_donation_name(){ public function change_donation_name(){
$post_id = $this->get_checkout_project_id(); $post_id = $this->get_checkout_project_id();
$title = get_the_title($post_id); $title = get_the_title($post_id);
return $title; $link = get_permalink($post_id);
$link = sprintf('<a href="%s"> %s </a> ',$link,$title);
return $link;
} }
......
#woocommerce-quick-donation-order-data > h3,#woocommerce-quick-donation-order-data > .handlediv{display: none;}
\ No newline at end of file
...@@ -6,7 +6,7 @@ Requires at least: 3.0 or higher ...@@ -6,7 +6,7 @@ Requires at least: 3.0 or higher
Tested up to: 4.4 Tested up to: 4.4
WC requires at least: 1.0 WC requires at least: 1.0
WC tested up to: 2.4.8 WC tested up to: 2.4.8
Stable tag: 1.3.3 Beta Stable tag: 1.3.4 Beta
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
...@@ -18,6 +18,10 @@ Turns WooCommerce Into Online Donation. ...@@ -18,6 +18,10 @@ Turns WooCommerce Into Online Donation.
WooCommerce Shopping Cart Donation which makes WooComerce to use for online donation purpose. WooCommerce Shopping Cart Donation which makes WooComerce to use for online donation purpose.
This plugin will create a new product in the name of **donation**. This plugin will create a new product in the name of **donation**.
<h3> Plugin Support / Feature Request </h3>
Dear User, if you need any help regarding this plugin or require any new feature in this plugin kindly contact me via
Email : plugin@varunsridharan.in / kindly post it in github.
<h3> Features </h3> <h3> Features </h3>
* Redirect User After Donation Added To Cart [Cart Page / Checkout Page] * Redirect User After Donation Added To Cart [Cart Page / Checkout Page]
* Select Your Preferred Payment Gateway For Donation * Select Your Preferred Payment Gateway For Donation
...@@ -27,20 +31,20 @@ This plugin will create a new product in the name of **donation**. ...@@ -27,20 +31,20 @@ This plugin will create a new product in the name of **donation**.
* Custom Error Messages * Custom Error Messages
**This Plugin Can called by using the below short code** **This Plugin Can called by using the below short code** `[wc_quick_donation]`
`[wc_quick_donation]`
**Shortcode Variables** **Shortcode Variables**
<code>
1. type : select | radio 1. type : select | radio
2. grouped : true | false 2. grouped : true | false
</code>
**Modifying Template** **Modifying Template**
<code>
1. Create A folder named *donation* under <code> your-theme/woocommerce/</code> 1. Create A folder named *donation* under <code> your-theme/woocommerce/</code>
2. Copy all files from <code>woocommerce-quick-donation/template/</code> 2. Copy all files from <code>woocommerce-quick-donation/template/</code>
3. Paste in <code> your-theme/woocommerce/donation/</code> 3. Paste in <code> your-theme/woocommerce/donation/</code>
</code>
<h3>Plugin Template List</h3> <h3>Plugin Template List</h3>
**Checkout Page Template** **Checkout Page Template**
...@@ -56,6 +60,17 @@ checkout/donation-payment-method.php ...@@ -56,6 +60,17 @@ checkout/donation-payment-method.php
checkout/donation-payment.php checkout/donation-payment.php
checkout/donation-review-order.php checkout/donation-review-order.php
checkout/donation-thankyou.php checkout/donation-thankyou.php
order/donation-order-details.php
</code>
**Cart Page Template**
<code>
cart/donation-cart-item-data
cart/donation-cart-shipping.php
cart/donation-cart-totals.php
cart/donation-cart.php
cart/donation-proceed-to-checkout-button.php
</code> </code>
**Email Template** **Email Template**
...@@ -91,6 +106,16 @@ wc_quick_donation_settings_section ...@@ -91,6 +106,16 @@ wc_quick_donation_settings_section
wc_quick_donation_settings_fields wc_quick_donation_settings_fields
</code> </code>
== Screenshots ==
1. Menu In WP-ADMIN View
2. Donation Project Listing View
3. New Donation Project View
4. General Settings View
5. Custom Error Message View
6. 2 Types Of Donation Form
7. Donation Cart View
8. Donation Checkout View
9. Donation Order Success View
== Upgrade Notice == == Upgrade Notice ==
Note this release is in beta and from now this plugin is totally rebuild. it may not work with or like older version's Note this release is in beta and from now this plugin is totally rebuild. it may not work with or like older version's
...@@ -160,8 +185,26 @@ Yes you can! Join in on our <a href="https://github.com/technofreaky/woocomerce- ...@@ -160,8 +185,26 @@ Yes you can! Join in on our <a href="https://github.com/technofreaky/woocomerce-
== Changelog == == Changelog ==
= 1.3.4 BETA =
**Fixes**
* Menu Error In Front End When Logged In Using Custom ID
**Tweaks**
* Removed Unwated Metabox For Donation order Page
* Added New Custom Metabox For Donation Order details
* Added Few Functions In WC Quick Donation DB Class
* Modifed Core WC Quick Donation Templates
**Added**
* Custom Cart Page Template Support
* Custom Order Thank You Page & Order Details Tables Support
= 1.3.3 BETA = = 1.3.3 BETA =
**Fixes** **Fixes**
* Moved Few DB functions from Functions class to db class * Moved Few DB functions from Functions class to db class
* Fixed template override issue [https://github.com/technofreaky/woocomerce-quick-donation/issues/12] * Fixed template override issue [https://github.com/technofreaky/woocomerce-quick-donation/issues/12]
* Removed Unwated Metabox For Donation order Page * Removed Unwated Metabox For Donation order Page
...@@ -169,24 +212,29 @@ Yes you can! Join in on our <a href="https://github.com/technofreaky/woocomerce- ...@@ -169,24 +212,29 @@ Yes you can! Join in on our <a href="https://github.com/technofreaky/woocomerce-
= 1.3.2 BETA = = 1.3.2 BETA =
**New** **New**
* Added Quick Links At Plugin Listing Table * Added Quick Links At Plugin Listing Table
* Error Message When User Trying To Add Another Donation To Cart * Error Message When User Trying To Add Another Donation To Cart
* Already Exist Donation Error Message Option Added In Settings * Already Exist Donation Error Message Option Added In Settings
**Tweaks** **Tweaks**
* Standardized Coding * Standardized Coding
* Settings Page Modified * Settings Page Modified
**Fixes** **Fixes**
* Changed `Donation` Name To `Project Name` at Checkout in Review Order Section * Changed `Donation` Name To `Project Name` at Checkout in Review Order Section
* Quick Donation Menu Not Listed In Some WP Settings. * Quick Donation Menu Not Listed In Some WP Settings.
= 1.3.1 BETA = = 1.3.1 BETA =
**Fixes** **Fixes**
* Error At WooCommerce Settings Page * Error At WooCommerce Settings Page
= 1.3 Beta = = 1.3 Beta =
**New** **New**
* Created Separate Custom Post Type For Donation * Created Separate Custom Post Type For Donation
* Created Separate Custom Settings Page * Created Separate Custom Settings Page
* Total Plugin Redeveloped * Total Plugin Redeveloped
......
<?php
/**
* Cart item data (when outputting non-flat)
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<dl class="variation">
<?php foreach ( $item_data as $data ) : ?>
<dt class="variation-<?php echo sanitize_html_class( $data['key'] ); ?>"><?php echo wp_kses_post( $data['key'] ); ?>:</dt>
<dd class="variation-<?php echo sanitize_html_class( $data['key'] ); ?>"><?php echo wp_kses_post( wpautop( $data['display'] ) ); ?></dd>
<?php endforeach; ?>
</dl>
<?php
/**
* Shipping Methods Display
*
* In 2.1 we show methods per package. This allows for multiple methods per order if so desired.
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<tr class="shipping">
<th><?php
if ( $show_package_details ) {
printf( __( 'Shipping #%d', 'woocommerce' ), $index + 1 );
} else {
_e( 'Shipping', 'woocommerce' );
}
?></th>
<td>
<?php if ( ! empty( $available_methods ) ) : ?>
<?php if ( 1 === count( $available_methods ) ) :
$method = current( $available_methods );
echo wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); ?>
<input type="hidden" name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>" value="<?php echo esc_attr( $method->id ); ?>" class="shipping_method" />
<?php elseif ( get_option( 'woocommerce_shipping_method_format' ) === 'select' ) : ?>
<select name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>" class="shipping_method">
<?php foreach ( $available_methods as $method ) : ?>
<option value="<?php echo esc_attr( $method->id ); ?>" <?php selected( $method->id, $chosen_method ); ?>><?php echo wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); ?></option>
<?php endforeach; ?>
</select>
<?php else : ?>
<ul id="shipping_method">
<?php foreach ( $available_methods as $method ) : ?>
<li>
<input type="radio" name="shipping_method[<?php echo $index; ?>]" data-index="<?php echo $index; ?>" id="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>" value="<?php echo esc_attr( $method->id ); ?>" <?php checked( $method->id, $chosen_method ); ?> class="shipping_method" />
<label for="shipping_method_<?php echo $index; ?>_<?php echo sanitize_title( $method->id ); ?>"><?php echo wp_kses_post( wc_cart_totals_shipping_method_label( $method ) ); ?></label>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php elseif ( ( WC()->countries->get_states( WC()->customer->get_shipping_country() ) && ! WC()->customer->get_shipping_state() ) || ! WC()->customer->get_shipping_postcode() ) : ?>
<?php if ( is_cart() && get_option( 'woocommerce_enable_shipping_calc' ) === 'yes' ) : ?>
<p><?php _e( 'Please use the shipping calculator to see available shipping methods.', 'woocommerce' ); ?></p>
<?php elseif ( is_cart() ) : ?>
<p><?php _e( 'Please continue to the checkout and enter your full address to see if there are any available shipping methods.', 'woocommerce' ); ?></p>
<?php else : ?>
<p><?php _e( 'Please fill in your details to see available shipping methods.', 'woocommerce' ); ?></p>
<?php endif; ?>
<?php else : ?>
<?php if ( is_cart() ) : ?>
<?php echo apply_filters( 'woocommerce_cart_no_shipping_available_html',
'<p>' . __( 'There are no shipping methods available. Please double check your address, or contact us if you need any help.', 'woocommerce' ) . '</p>'
); ?>
<?php else : ?>
<?php echo apply_filters( 'woocommerce_no_shipping_available_html',
'<p>' . __( 'There are no shipping methods available. Please double check your address, or contact us if you need any help.', 'woocommerce' ) . '</p>'
); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ( $show_package_details ) : ?>
<?php
foreach ( $package['contents'] as $item_id => $values ) {
if ( $values['data']->needs_shipping() ) {
$product_names[] = $values['data']->get_title() . ' &times;' . $values['quantity'];
}
}
echo '<p class="woocommerce-shipping-contents"><small>' . __( 'Shipping', 'woocommerce' ) . ': ' . implode( ', ', $product_names ) . '</small></p>';
?>
<?php endif; ?>
<?php if ( is_cart() ) : ?>
<?php woocommerce_shipping_calculator(); ?>
<?php endif; ?>
</td>
</tr>
<?php
/**
* Cart totals
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.3.6
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class=" <?php if ( WC()->customer->has_calculated_shipping() ) echo 'calculated_shipping'; ?>">
<?php do_action( 'woocommerce_before_cart_totals' ); ?>
<div class="wc-proceed-to-checkout">
<?php do_action( 'woocommerce_proceed_to_checkout' ); ?>
</div>
<?php do_action( 'woocommerce_after_cart_totals' ); ?>
</div>
<?php
/**
* Cart Page
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.3.8
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
wc_print_notices();
do_action( 'woocommerce_before_cart' ); ?>
<form action="<?php echo esc_url( WC()->cart->get_cart_url() ); ?>" method="post">
<?php do_action( 'woocommerce_before_cart_table' ); ?>
<table class="shop_table cart" cellspacing="0">
<thead>
<tr>
<th class="product-remove" style="width:10%;">&nbsp;</th>
<th class="product-thumbnail" style="width:20%;">&nbsp;</th>
<th class="product-name"><?php _e( 'Project', WC_QD_TXT ); ?></th>
<th class="product-price"><?php _e( 'Amount', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php do_action( 'woocommerce_before_cart_contents' ); ?>
<?php
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
?>
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
<td class="product-remove">
<?php
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
'<a href="%s" class="remove" title="%s" data-product_id="%s" data-product_sku="%s">&times;</a>',
esc_url( WC()->cart->get_remove_url( $cart_item_key ) ),
__( 'Remove this item', 'woocommerce' ),
esc_attr( $product_id ),
esc_attr( $_product->get_sku() )
), $cart_item_key );
?>
</td>
<td class="product-thumbnail">
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $_product->is_visible() ) {
echo $thumbnail;
} else {
printf( '<a href="%s">%s</a>', esc_url( $_product->get_permalink( $cart_item ) ), $thumbnail );
}
?>
</td>
<td class="product-name">
<?php echo apply_filters('wc_quick_donation_cart_project_name',$_product->get_title(),$cart_item); ?>
</td>
<td class="product-price">
<?php
echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key );
?>
</td>
</tr>
<?php
}
}
do_action( 'woocommerce_cart_contents' );
?>
<?php do_action( 'woocommerce_after_cart_contents' ); ?>
</tbody>
</table>
<?php do_action( 'woocommerce_after_cart_table' ); ?>
</form>
<div class="cart-collaterals">
<?php do_action( 'woocommerce_cart_collaterals' ); ?>
</div>
<?php do_action( 'woocommerce_after_cart' ); ?>
<?php
/**
* Proceed to checkout button
*
* Contains the markup for the proceed to checkout button on the cart
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
echo '<a href="' . esc_url( WC()->cart->get_checkout_url() ) . '" class="checkout-button button alt wc-forward">' . __( 'Donate Now :) ', WC_QD_TXT ) . '</a>';
...@@ -31,15 +31,9 @@ $get_checkout_url = apply_filters( 'woocommerce_get_checkout_url', WC()->cart->g ...@@ -31,15 +31,9 @@ $get_checkout_url = apply_filters( 'woocommerce_get_checkout_url', WC()->cart->g
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?> <?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
<div class="col2-set" id="customer_details"> <div class="col2-set" id="customer_details">
<div class="col-1">
<?php do_action( 'woocommerce_checkout_billing' ); ?> <?php do_action( 'woocommerce_checkout_billing' ); ?>
</div> </div>
<div class="col-2">
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
</div>
</div>
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?> <?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
<h3 id="order_review_heading"><?php _e( 'Your Donation', 'woocommerce' ); ?></h3> <h3 id="order_review_heading"><?php _e( 'Your Donation', 'woocommerce' ); ?></h3>
......
...@@ -11,23 +11,6 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -11,23 +11,6 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
if ( ! WC()->cart->coupons_enabled() ) {
return;
}
$info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ) . ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>' );
wc_print_notice( $info_message, 'notice' );
?>
<form class="checkout_coupon" method="post" style="display:none">
<p class="form-row form-row-first"> ?>
<input type="text" name="coupon_code" class="input-text" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" id="coupon_code" value="" /> \ No newline at end of file
</p>
<p class="form-row form-row-last">
<input type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply Coupon', 'woocommerce' ); ?>" />
</p>
<div class="clear"></div>
</form>
...@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<thead> <thead>
<tr> <tr>
<th class="product-name"><?php _e( 'Donation for', 'woocommerce' ); ?></th> <th class="product-name"><?php _e( 'Donation for', 'woocommerce' ); ?></th>
<th class="product-total"><?php _e( 'Total', 'woocommerce' ); ?></th> <th class="product-total"><?php _e( 'Amount', 'woocommerce' ); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -29,13 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -29,13 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
?> ?>
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>"> <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
<td class="product-name"> <td class="product-name">
<?php <?php echo apply_filters('wc_quick_donation_cart_project_name',$_product->get_title(),$cart_item); ?>
$project = apply_filters('woocommerce_cart_item_name', $_product->get_title(),$cart_item,$cart_item_key);
echo '<strong>'.$project.'</strong>';
?>
<?php echo WC()->cart->get_item_data( $cart_item ); ?>
</td> </td>
<td class="product-total"> <td class="product-total">
<?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?> <?php echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); ?>
...@@ -49,60 +43,7 @@ if ( ! defined( 'ABSPATH' ) ) { ...@@ -49,60 +43,7 @@ if ( ! defined( 'ABSPATH' ) ) {
?> ?>
</tbody> </tbody>
<tfoot> <tfoot>
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
<?php foreach ( WC()->cart->get_coupons() as $code => $coupon ) : ?>
<tr class="cart-discount coupon-<?php echo esc_attr( sanitize_title( $code ) ); ?>">
<th><?php wc_cart_totals_coupon_label( $coupon ); ?></th>
<td><?php wc_cart_totals_coupon_html( $coupon ); ?></td>
</tr>
<?php endforeach; ?>
<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
<?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
<?php wc_cart_totals_shipping_html(); ?>
<?php do_action( 'woocommerce_review_order_after_shipping' ); ?>
<?php endif; ?>
<?php foreach ( WC()->cart->get_fees() as $fee ) : ?>
<tr class="fee">
<th><?php echo esc_html( $fee->name ); ?></th>
<td><?php wc_cart_totals_fee_html( $fee ); ?></td>
</tr>
<?php endforeach; ?>
<?php if ( wc_tax_enabled() && WC()->cart->tax_display_cart === 'excl' ) : ?>
<?php if ( get_option( 'woocommerce_tax_total_display' ) === 'itemized' ) : ?>
<?php foreach ( WC()->cart->get_tax_totals() as $code => $tax ) : ?>
<tr class="tax-rate tax-rate-<?php echo sanitize_title( $code ); ?>">
<th><?php echo esc_html( $tax->label ); ?></th>
<td><?php echo wp_kses_post( $tax->formatted_amount ); ?></td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr class="tax-total">
<th><?php echo esc_html( WC()->countries->tax_or_vat() ); ?></th>
<td><?php wc_cart_totals_taxes_total_html(); ?></td>
</tr>
<?php endif; ?>
<?php endif; ?>
<?php do_action( 'woocommerce_review_order_before_order_total' ); ?> <?php do_action( 'woocommerce_review_order_before_order_total' ); ?>
<tr class="order-total">
<th><?php _e( 'Total', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_order_total_html(); ?></td>
</tr>
<?php do_action( 'woocommerce_review_order_after_order_total' ); ?> <?php do_action( 'woocommerce_review_order_after_order_total' ); ?>
</tfoot> </tfoot>
</table> </table>
\ No newline at end of file
...@@ -33,21 +33,18 @@ if ( $order ) : ?> ...@@ -33,21 +33,18 @@ if ( $order ) : ?>
<?php else : ?> <?php else : ?>
<p><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), $order ); ?></p> <p><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your Donation has been received.', WC_QD_TXT), $order ); ?></p>
<ul class="order_details"> <ul class="order_details">
<li class="order"> <li class="order">
<?php _e( 'Order Number:', 'woocommerce' ); ?> <?php _e( 'Reference Number :', 'woocommerce' ); ?>
<strong><?php echo $order->get_order_number(); ?></strong> <strong><?php echo $order->get_order_number(); ?></strong>
</li> </li>
<li class="date"> <li class="date">
<?php _e( 'Date:', 'woocommerce' ); ?> <?php _e( 'Date:', 'woocommerce' ); ?>
<strong><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></strong> <strong><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></strong>
</li> </li>
<li class="total">
<?php _e( 'Total:', 'woocommerce' ); ?>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
<?php if ( $order->payment_method_title ) : ?> <?php if ( $order->payment_method_title ) : ?>
<li class="method"> <li class="method">
<?php _e( 'Payment Method:', 'woocommerce' ); ?> <?php _e( 'Payment Method:', 'woocommerce' ); ?>
......
<?php
/**
* Order details
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$order = wc_get_order( $order_id );
?>
<h2><?php _e( 'Donation Details', WC_QD_TXT ); ?></h2>
<table class="shop_table order_details">
<thead>
<tr>
<th class="product-name"><?php _e( 'Project', WC_QD_TXT ); ?></th>
<th class="product-total"><?php _e( 'Amount', WC_QD_TXT ); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach( $order->get_items() as $item_id => $item ) {
wc_get_template( 'order/order-details-item.php', array(
'order' => $order,
'item_id' => $item_id,
'item' => $item,
'product' => apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item )
) );
}
?>
<?php do_action( 'woocommerce_order_items_table', $order ); ?>
</tbody>
<tfoot>
<?php
foreach ( $order->get_order_item_totals() as $key => $total ) {
?>
<tr>
<th scope="row"><?php echo $total['label']; ?></th>
<td><?php echo $total['value']; ?></td>
</tr>
<?php
}
?>
</tfoot>
</table>
<?php do_action( 'woocommerce_order_details_after_order_table', $order ); ?>
<?php wc_get_template( 'order/order-details-customer.php', array( 'order' => $order ) ); ?>
<?php
/**
* Order tracking form
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
global $post;
?>
<form action="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" method="post" class="track_order">
<p><?php _e( 'To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.', 'woocommerce' ); ?></p>
<p class="form-row form-row-first"><label for="orderid"><?php _e( 'Order ID', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="orderid" id="orderid" placeholder="<?php esc_attr_e( 'Found in your order confirmation email.', 'woocommerce' ); ?>" /></p>
<p class="form-row form-row-last"><label for="order_email"><?php _e( 'Billing Email', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="order_email" id="order_email" placeholder="<?php esc_attr_e( 'Email you used during checkout.', 'woocommerce' ); ?>" /></p>
<div class="clear"></div>
<p class="form-row"><input type="submit" class="button" name="track" value="<?php esc_attr_e( 'Track', 'woocommerce' ); ?>" /></p>
<?php wp_nonce_field( 'woocommerce-order_tracking' ); ?>
</form>
<?php
/**
* Order again button
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<p class="order-again">
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'order_again', $order->id ) , 'woocommerce-order_again' ) ); ?>" class="button"><?php _e( 'Order Again', 'woocommerce' ); ?></a>
</p>
<?php
/**
* Order Customer Details
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<header><h2><?php _e( 'Customer Details', 'woocommerce' ); ?></h2></header>
<table class="shop_table shop_table_responsive customer_details">
<?php if ( $order->customer_note ) : ?>
<tr>
<th><?php _e( 'Note:', 'woocommerce' ); ?></th>
<td><?php echo wptexturize( $order->customer_note ); ?></td>
</tr>
<?php endif; ?>
<?php if ( $order->billing_email ) : ?>
<tr>
<th><?php _e( 'Email:', 'woocommerce' ); ?></th>
<td><?php echo esc_html( $order->billing_email ); ?></td>
</tr>
<?php endif; ?>
<?php if ( $order->billing_phone ) : ?>
<tr>
<th><?php _e( 'Telephone:', 'woocommerce' ); ?></th>
<td><?php echo esc_html( $order->billing_phone ); ?></td>
</tr>
<?php endif; ?>
<?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; ?>
<?php
/**
* Order Item Details
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.4.0
*/
if ( ! defined( 'ABSPATH' ) ) {
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 ) ); ?>">
<td class="product-name">
<?php
$is_visible = $product && $product->is_visible();
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 class="product-total">
<?php echo $order->get_formatted_line_subtotal( $item ); ?>
</td>
</tr>
<?php if ( $order->has_status( array( 'completed', 'processing' ) ) && ( $purchase_note = get_post_meta( $product->id, '_purchase_note', true ) ) ) : ?>
<tr class="product-purchase-note">
<td colspan="3"><?php echo wpautop( do_shortcode( wp_kses_post( $purchase_note ) ) ); ?></td>
</tr>
<?php endif; ?>
<?php
/**
* Order tracking
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.2.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
$order_status_text = sprintf( __( 'Order #%s which was made %s has the status &ldquo;%s&rdquo;', 'woocommerce' ), $order->get_order_number(), human_time_diff( strtotime( $order->order_date ), current_time( 'timestamp' ) ) . ' ' . __( 'ago', 'woocommerce' ), wc_get_order_status_name( $order->get_status() ) );
if ( $order->has_status( 'completed' ) ) $order_status_text .= ' ' . __( 'and was completed', 'woocommerce' ) . ' ' . human_time_diff( strtotime( $order->completed_date ), current_time( 'timestamp' ) ) . __( ' ago', 'woocommerce' );
$order_status_text .= '.';
echo wpautop( esc_attr( apply_filters( 'woocommerce_order_tracking_status', $order_status_text, $order ) ) );
$notes = $order->get_customer_order_notes();
if ( $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( wp_kses_post( $note->comment_content ) ) ); ?>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</li>
<?php endforeach; ?>
</ol>
<?php endif; ?>
<?php do_action( 'woocommerce_view_order', $order->id ); ?>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Quick Donation * Plugin Name: WooCommerce Quick Donation
* Plugin URI: https://wordpress.org/plugins/woocommerce-plugin-boiler-plate/ * Plugin URI: https://wordpress.org/plugins/woocommerce-plugin-boiler-plate/
* Description: Turns WooCommerce Into Online Donation * Description: Turns WooCommerce Into Online Donation
* Version: 1.3.3 BETA * Version: 1.3.4 BETA
* Author: Varun Sridharan * Author: Varun Sridharan
* Author URI: http://varunsridharan.in * Author URI: http://varunsridharan.in
* Text Domain: woocommerce-quick-donation * Text Domain: woocommerce-quick-donation
...@@ -18,7 +18,7 @@ class WooCommerce_Quick_Donation { ...@@ -18,7 +18,7 @@ class WooCommerce_Quick_Donation {
/** /**
* @var string * @var string
*/ */
public $version = '1.3.3'; public $version = '1.3.4';
/** /**
* @var WooCommerce The single instance of the class * @var WooCommerce The single instance of the class
......
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