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,10 +21,7 @@ class WooCommerce_Quick_Donation_Admin_Function {
add_action( 'post_row_actions', array($this,'protect_donation_product'),99,2);
add_action( 'parse_query', array( $this, 'hide_donation_order_woocommerce_order' ) );
add_filter( 'wc_order_types',array($this,'add_wc_order_types'),99,2);
}
}
public function hide_donation_order_woocommerce_order($query) {
global $pagenow,$post_type;
......@@ -39,11 +36,12 @@ class WooCommerce_Quick_Donation_Admin_Function {
}
public function add_wc_order_types($order_types,$type){
public function add_wc_order_types($order_types,$type){
$order_type = $order_types;
if('' == $type){
$order_type[] = WC_QD_PT;
}
$order_type[] = 'wc_qd_orders';
}
return $order_type;
}
......
......@@ -54,6 +54,7 @@ class WooCommerce_Quick_Donation_Admin {
global $submenu;
//echo '<pre>'.print_r($submenu,true).'</pre>'; exit;
$name = 'edit.php?post_type='.WC_QD_PT;
if(empty($submenu)){return $submenu;}
$arr = array();
$arr[] = $submenu[$name][18];
$arr[] = $submenu[$name][5];
......@@ -104,9 +105,14 @@ class WooCommerce_Quick_Donation_Admin {
* Register the stylesheets for the admin area.
*/
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()){
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())) {
wp_enqueue_style(WC_QD_SLUG.'_core_style',WC_QD_CSS.'admin-style.css' , array(), WC_QD()->version, 'all' );
}
......
......@@ -17,17 +17,100 @@ if ( ! defined( 'WPINC' ) ) { die; }
class WooCommerce_Quick_Donation_Admin_Order_Page_Functions {
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){
$is_donation = WC_QD()->db()->_is_donation($post->ID);
if($is_donation){
remove_meta_box('woocommerce-order-items','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 );
}
}
?>
\ No newline at end of file
This diff is collapsed.
<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 {
'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 ),
'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 ),
'all_items' => __( 'All Project', WC_QD_TXT ),
'add_new_item' => __( 'Add New Project', WC_QD_TXT ),
......
......@@ -45,6 +45,11 @@ class WooCommerce_Quick_Donation_DB {
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){
global $wpdb;
$data_c = array('date' => current_time( 'mysql' ),'userid' => $user_id,'donationid' => $order_id,'projectid' => $project_id);
......
......@@ -18,7 +18,12 @@ class WooCommerce_Quick_Donation_Functions {
'emails/plaint/donation-customer-invoice.php' => 'emails/plain/donation-customer-invoice.php',
),
'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/form-billing.php' => 'checkout/donation-form-billing.php',
'checkout/form-checkout.php' => 'checkout/donation-form-checkout.php',
......@@ -29,9 +34,13 @@ class WooCommerce_Quick_Donation_Functions {
'checkout/payment-method.php' => 'checkout/donation-payment-method.php',
'checkout/payment.php' => 'checkout/donation-payment.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,11 +49,28 @@ class WooCommerce_Quick_Donation_Functions {
add_filter( 'woocommerce_email_classes', array($this,'add_email_classes'));
add_action( 'woocommerce_available_payment_gateways',array($this,'remove_gateway'));
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){
$email_classes[WC_QD_DB.'new_donation_email'] = require(WC_QD_INC.'emails/class-new-email.php');
//$email_classes[WC_QD_DB.'processing_donation_email'] = require(WC_QD_INC.'emails/class-processing-email.php');
......@@ -140,6 +166,7 @@ class WooCommerce_Quick_Donation_Functions {
}
public function load_template($file,$path){
$wc_get_template = function_exists('wc_get_template') ? 'wc_get_template' : 'woocommerce_get_template';
$wc_get_template( $file,array(), '', $path);
}
......@@ -148,7 +175,7 @@ class WooCommerce_Quick_Donation_Functions {
$default_path = WC_QD_TEMPLATE;
$template_path = WC_TEMPLATE.'donation/';
$template = $template;
$locate = wc_locate_template($template,$template_path, $default_path);
$locate = wc_locate_template($template,$template_path, $default_path);
return $locate;
}
......@@ -205,15 +232,21 @@ class WooCommerce_Quick_Donation_Functions {
public function get_template($located, $template_name, $args, $template_path, $default_path ){
$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])){
$file = WC_QD()->f()->locate_template(self::$search_template['general'][$template_name]);
}
if(WC_QD()->check_donation_exists_cart()){
} else if(WC_QD()->check_donation_exists_cart()){
if(isset(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;
}
......
......@@ -22,15 +22,17 @@ 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,'save_order_id_db'));
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();
}
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);
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
Tested up to: 4.4
WC requires at least: 1.0
WC tested up to: 2.4.8
Stable tag: 1.3.3 Beta
Stable tag: 1.3.4 Beta
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
......@@ -18,6 +18,10 @@ Turns WooCommerce Into Online Donation.
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**.
<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>
* Redirect User After Donation Added To Cart [Cart Page / Checkout Page]
* Select Your Preferred Payment Gateway For Donation
......@@ -27,20 +31,20 @@ This plugin will create a new product in the name of **donation**.
* Custom Error Messages
**This Plugin Can called by using the below short code**
`[wc_quick_donation]`
**This Plugin Can called by using the below short code** `[wc_quick_donation]`
**Shortcode Variables**
<code>
1. type : select | radio
2. grouped : true | false
</code>
**Modifying Template**
<code>
1. Create A folder named *donation* under <code> your-theme/woocommerce/</code>
2. Copy all files from <code>woocommerce-quick-donation/template/</code>
3. Paste in <code> your-theme/woocommerce/donation/</code>
</code>
<h3>Plugin Template List</h3>
**Checkout Page Template**
......@@ -56,6 +60,17 @@ checkout/donation-payment-method.php
checkout/donation-payment.php
checkout/donation-review-order.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>
**Email Template**
......@@ -91,6 +106,16 @@ wc_quick_donation_settings_section
wc_quick_donation_settings_fields
</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 ==
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-
== 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 =
**Fixes**
* Moved Few DB functions from Functions class to db class
* Fixed template override issue [https://github.com/technofreaky/woocomerce-quick-donation/issues/12]
* 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-
= 1.3.2 BETA =
**New**
* Added Quick Links At Plugin Listing Table
* Error Message When User Trying To Add Another Donation To Cart
* Already Exist Donation Error Message Option Added In Settings
**Tweaks**
* Standardized Coding
* Settings Page Modified
**Fixes**
* Changed `Donation` Name To `Project Name` at Checkout in Review Order Section
* Quick Donation Menu Not Listed In Some WP Settings.
= 1.3.1 BETA =
**Fixes**
* Error At WooCommerce Settings Page
= 1.3 Beta =
**New**
* Created Separate Custom Post Type For Donation
* Created Separate Custom Settings Page
* 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,13 +31,7 @@ $get_checkout_url = apply_filters( 'woocommerce_get_checkout_url', WC()->cart->g
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
<div class="col2-set" id="customer_details">
<div class="col-1">
<?php do_action( 'woocommerce_checkout_billing' ); ?>
</div>
<div class="col-2">
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
</div>
<?php do_action( 'woocommerce_checkout_billing' ); ?>
</div>
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
......
......@@ -10,24 +10,7 @@
if ( ! defined( 'ABSPATH' ) ) {
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="" />
</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>
?>
\ No newline at end of file
......@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<thead>
<tr>
<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>
</thead>
<tbody>
......@@ -28,14 +28,8 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_checkout_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-name">
<?php
$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 class="product-name">
<?php echo apply_filters('wc_quick_donation_cart_project_name',$_product->get_title(),$cart_item); ?>
</td>
<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 ); ?>
......@@ -49,60 +43,7 @@ if ( ! defined( 'ABSPATH' ) ) {
?>
</tbody>
<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' ); ?>
<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' ); ?>
</tfoot>
</table>
\ No newline at end of file
......@@ -33,21 +33,18 @@ if ( $order ) : ?>
<?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">
<li class="order">
<?php _e( 'Order Number:', 'woocommerce' ); ?>
<?php _e( 'Reference Number :', 'woocommerce' ); ?>
<strong><?php echo $order->get_order_number(); ?></strong>
</li>
<li class="date">
<?php _e( 'Date:', 'woocommerce' ); ?>
<strong><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></strong>
</li>
<li class="total">
<?php _e( 'Total:', 'woocommerce' ); ?>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
<?php if ( $order->payment_method_title ) : ?>
<li class="method">
<?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 @@
* Plugin Name: WooCommerce Quick Donation
* Plugin URI: https://wordpress.org/plugins/woocommerce-plugin-boiler-plate/
* Description: Turns WooCommerce Into Online Donation
* Version: 1.3.3 BETA
* Version: 1.3.4 BETA
* Author: Varun Sridharan
* Author URI: http://varunsridharan.in
* Text Domain: woocommerce-quick-donation
......@@ -18,7 +18,7 @@ class WooCommerce_Quick_Donation {
/**
* @var string
*/
public $version = '1.3.3';
public $version = '1.3.4';
/**
* @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