Commit d3e03076 authored by Tech No Freaky's avatar Tech No Freaky

0.4

* Internal Server Error / php error fixed while adding donation to cart
[WP : 4.1 | WC : 2.3.3]
* Minor Bug Fix
parent 7defe97c
=== Plugin Name === === WooCommerce Quick Donation ===
Contributors: varunms Contributors: varunms
Donate link: http://varunsridharan.in Donate link: http://varunsridharan.in
Tags: Woocommerce,Quick Dontion,Donation,Online Payment,Payment,Online,Donate,Monthly Goal Tags: Woocommerce,Quick Dontion,quick donation,online donation,wordpress donation,simple donation,donation form,WC donation,Online Payment,Payment,Online,Donate,Monthly Goal
Requires at least: 3.0 plus WooCommerce 2.x or higher Requires at least: 3.0 plus WooCommerce 2.x or higher
Tested up to: 4.0.1 + WooCommerce 2.x Tested up to: 4.1 + WooCommerce 2.x
Stable tag: 0.3 Stable tag: 0.4
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
Online Donation Using Woocoomerce. for woocommerce user's Trurns WooCommerce Into Online Donation.
== Description == == Description ==
<h3> <blink> What's New In 0.2 </blink></h3> <h3> <blink> Features </blink></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
* Custom Email Template For Donation Processing * Custom Email Template For Donation Processing
...@@ -37,9 +37,11 @@ This Plugin Can called by using the below short code ...@@ -37,9 +37,11 @@ This Plugin Can called by using the below short code
1. Donation Form Template 1. Donation Form Template
`wc-quick-donation/template/donation_form.php` `wc-quick-donation/template/donation_form.php`
2. Donation Processing Email Template 2. Donation Processing Email Template
`wc-quick-donation/template/donation_processing_html.php && wc-quick-donation/template/donation_processing_plain.php` `wc-quick-donation/template/donation_processing_html.php
wc-quick-donation/template/donation_processing_plain.php`
3. Donation Completed Email Template 3. Donation Completed Email Template
`wc-quick-donation/template/donation_completed_html.php && wc-quick-donation/template/donation_completed_plain.php` `wc-quick-donation/template/donation_completed_html.php
wc-quick-donation/template/donation_completed_plain.php`
Plugin Settings : ***Woocoomerce Settings => Quick Donation*** Plugin Settings : ***Woocoomerce Settings => Quick Donation***
...@@ -92,6 +94,10 @@ Oops. Please User github / WordPress to post bugs. <a href="https://github.com/ ...@@ -92,6 +94,10 @@ Oops. Please User github / WordPress to post bugs. <a href="https://github.com/
== Changelog == == Changelog ==
= 0.4 =
* Internal Server Error / php error fixed while adding donation to cart [WP : 4.1 | WC : 2.3.3]
* Minor Bug Fix
= 0.3 = = 0.3 =
* Plugin Activation Issue Fixed. * Plugin Activation Issue Fixed.
...@@ -103,4 +109,4 @@ Oops. Please User github / WordPress to post bugs. <a href="https://github.com/ ...@@ -103,4 +109,4 @@ Oops. Please User github / WordPress to post bugs. <a href="https://github.com/
* Some Minor Bug Fix * Some Minor Bug Fix
= 0.1 = = 0.1 =
* Base Version * Base Version
\ No newline at end of file
...@@ -29,7 +29,7 @@ class WC_Quick_Donation_Settings extends WC_Settings_Page { ...@@ -29,7 +29,7 @@ class WC_Quick_Donation_Settings extends WC_Settings_Page {
* Get sections * Get sections
* *
* @return array * @return array
*/
public function get_sections() { public function get_sections() {
$sections = array( $sections = array(
...@@ -39,7 +39,7 @@ class WC_Quick_Donation_Settings extends WC_Settings_Page { ...@@ -39,7 +39,7 @@ class WC_Quick_Donation_Settings extends WC_Settings_Page {
return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections ); return apply_filters( 'woocommerce_get_sections_' . $this->id, $sections );
} }
*/
/** /**
* Get sections * Get sections
...@@ -113,18 +113,13 @@ class WC_Quick_Donation_Settings extends WC_Settings_Page { ...@@ -113,18 +113,13 @@ class WC_Quick_Donation_Settings extends WC_Settings_Page {
'id' => 'wc_quick_donation_order_notes_title', 'id' => 'wc_quick_donation_order_notes_title',
'default' =>'Project Name %s' 'default' =>'Project Name %s'
), ),
'section_end' => array( 'section_end' => array(
'type' => 'sectionend', 'type' => 'sectionend',
'id' => 'wc_settings_tab_demo_section_end' 'id' => 'wc_settings_tab_demo_section_end'
) )
); );
break; break;
case 'email_template':
break;
} }
return apply_filters( 'wc_settings_tab_'.$this->id.'_settings', $settings, $section ); return apply_filters( 'wc_settings_tab_'.$this->id.'_settings', $settings, $section );
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
Plugin Name: Woocommerce Quick Donation Plugin Name: Woocommerce Quick Donation
Plugin URI: http://varunsridharan.in/ Plugin URI: http://varunsridharan.in/
Description: Woocommerce Quick Donation Description: Woocommerce Quick Donation
Version: 0.3 Version: 0.4
Author: Varun Sridharan Author: Varun Sridharan
Author URI: http://varunsridharan.in/ Author URI: http://varunsridharan.in/
License: GPL2 License: GPL2
...@@ -29,27 +29,46 @@ define( 'wc_qd_p', plugin_dir_path( __FILE__ ) ); ...@@ -29,27 +29,46 @@ define( 'wc_qd_p', plugin_dir_path( __FILE__ ) );
class wc_quick_donation{ class wc_quick_donation{
private $donation_id; private $donation_id;
private $plugin_slug;
/** /**
* Setup The Plugin Class * Setup The Plugin Class
*/ */
function __construct() { function __construct() {
$this->donation_id = get_option('wc_quick_donation_product_id'); $this->donation_id = get_option('wc_quick_donation_product_id');
add_shortcode( 'wc_quick_donation', array($this,'shortcode_handler' )); add_shortcode( 'wc_quick_donation', array($this,'shortcode_handler' ));
add_action( 'init',array($this,'process_donation')); add_action( 'get_the_generator_html', array($this,'generate_meta_tags'), 15, 2 );
add_action( 'get_the_generator_xhtml', array($this,'generate_meta_tags'), 15, 2 );
add_action( 'wp_loaded',array($this,'process_donation'));
add_action( 'wc_qd_show_projects_list',array($this,'get_projects_list')); add_action( 'wc_qd_show_projects_list',array($this,'get_projects_list'));
add_action( 'woocommerce_checkout_update_order_meta', array($this,'add_order_meta')); add_action( 'woocommerce_checkout_update_order_meta', array($this,'add_order_meta'));
add_action( 'woocommerce_available_payment_gateways',array($this,'remove_gateway')); add_action( 'woocommerce_available_payment_gateways',array($this,'remove_gateway'));
add_action( 'woocommerce_admin_order_data_after_billing_address', array($this,'custom_order_details_page_info'), 10, 1 ); add_action( 'woocommerce_admin_order_data_after_billing_address', array($this,'custom_order_details_page_info'), 10, 1 );
add_filter( 'woocommerce_get_price', array($this,'get_price'),10,2); add_filter( 'woocommerce_get_price', array($this,'get_price'),10,2);
add_filter( 'woocommerce_get_settings_pages', array($this,'settings_page') ); add_filter( 'woocommerce_get_settings_pages', array($this,'settings_page') );
add_filter( 'woocommerce_email_classes', array($this,'email_classes')); add_filter( 'woocommerce_email_classes', array($this,'email_classes'));
} }
/**
* Adds Donation Meta Tag
* @param String $gen Refer WP.ORG
* @param String $type Refer WP.ORG
* @returns String
* @since 0.4
*/
public function generate_meta_tags( $gen, $type ) {
switch ( $type ) {
case 'html':
$gen .= "\n" . '<meta name="generator" content="WooCommerce Quick Donation 0.4">';
break;
case 'xhtml':
$gen .= "\n" . '<meta name="generator" content="WooCommerce Quick Donation 0.4" />';
break;
}
return $gen;
}
/** /**
* Adds Settings Page * Adds Settings Page
*/ */
...@@ -336,10 +355,9 @@ class wc_quick_donation{ ...@@ -336,10 +355,9 @@ class wc_quick_donation{
/** /**
* Install The Plugin * Install The Plugin
*/ */
public function install() { public static function install() {
$exist = get_option('wc_quick_donation_product_id'); $exist = get_option('wc_quick_donation_product_id');
if($exist){ if($exist){
return true; return true;
} else { } else {
$post_id = create_donation(); $post_id = create_donation();
...@@ -365,7 +383,7 @@ function create_donation(){ ...@@ -365,7 +383,7 @@ function create_donation(){
'post_type' => 'product', 'post_type' => 'product',
); );
$post_id = wp_insert_post( $post, $wp_error ); $post_id = wp_insert_post($post);
update_post_meta($post_id, '_stock_status', 'instock'); update_post_meta($post_id, '_stock_status', 'instock');
update_post_meta($post_id, '_tax_status', 'none'); update_post_meta($post_id, '_tax_status', 'none');
update_post_meta($post_id, '_tax_class', 'zero-rate'); update_post_meta($post_id, '_tax_class', 'zero-rate');
...@@ -386,8 +404,12 @@ function create_donation(){ ...@@ -386,8 +404,12 @@ function create_donation(){
*/ */
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
register_activation_hook( __FILE__, array( 'wc_quick_donation', 'install' ) ); register_activation_hook( __FILE__, array( 'wc_quick_donation', 'install' ) );
$wc_quick_buy = new wc_quick_donation; $wc_quick_buy = new wc_quick_donation;
} else {
add_action( 'admin_notices', 'wc_quick_donation_notice' );
} }
function wc_quick_donation_notice() {
echo '<div class="error"><p><strong> <i> Woocommerce Quick Donation </i> </strong> Requires <a href="'.admin_url( 'plugin-install.php?tab=plugin-information&plugin=woocommerce').'"> <strong> <u>Woocommerce</u></strong> </a> To Be Installed And Activated </p></div>';
}
?> ?>
\ No newline at end of file
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