Commit 27b0ba82 authored by Varun Sridharan's avatar Varun Sridharan

* Changes By Varun

* Added Function To Get Overrided Template Names
* CleandUp class-admin-init.php
* Added 2 News Menus (Sys Info, Tools)
* Removed Unwanted Files (8)
* Added Table Listing Of System View
* Minor Bug Fix
parent a8e3d7d4
This diff is collapsed.
...@@ -71,4 +71,37 @@ class WooCommerce_Quick_Donation_Admin_Function { ...@@ -71,4 +71,37 @@ class WooCommerce_Quick_Donation_Admin_Function {
} }
return $actions; return $actions;
} }
public function get_OverRided(){
$template_files = WC_QD_INSTALL::get_template_list();
$overrided = array();
if(is_array($template_files)){
foreach($template_files as $file){
$theme_file = false;
if ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
$theme_file = get_stylesheet_directory() . '/' . $file;
} elseif ( file_exists( get_stylesheet_directory() . WC_QD_THEME_TEMPLATE . $file ) ) {
$theme_file = get_stylesheet_directory() . WC_QD_THEME_TEMPLATE . $file;
} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
$theme_file = get_template_directory() . '/' . $file;
} elseif( file_exists( get_template_directory() . WC_QD_THEME_TEMPLATE . $file ) ) {
$theme_file = get_template_directory() . WC_QD_THEME_TEMPLATE . $file;
}
if ( $theme_file !== false ) {
$core_version = WC_Admin_Status::get_file_version(WC_QD_TEMPLATE.$file);
$theme_version = WC_Admin_Status::get_file_version( $theme_file );
if ( $core_version && $theme_version && version_compare( $theme_version, $core_version, '<' ) ) {
$overrided[] = array('file' => $file,'corev' => $core_version , 'themev' => $theme_version, 'is_old' => true);
} else {
$overrided[] = array('file' => $file,'corev' => $core_version , 'themev' => $theme_version, 'is_old' => false);
}
}
}
}
return $overrided;
}
} }
\ No newline at end of file
...@@ -26,11 +26,19 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -26,11 +26,19 @@ class WooCommerce_Quick_Donation_Admin {
$this->init_hooks(); $this->init_hooks();
} }
public function add_notice(){
wc_qd_notice(sprintf('<p>%s</p> <p class="submit"><a id="WCQDShowTXT" class="button-primary debug-report" href="javascript:;">%s</a></p>',
__('Please copy and paste this information in your ticket when contacting support:',WC_QD_TXT),
__('Get System Report',WC_QD_TXT))
,'update',array('wraper' => false));
}
public function load_required_files(){ public function load_required_files(){
WC_QD()->load_files(WC_QD_ADMIN.'metabox_framework/meta-box.php'); WC_QD()->load_files(WC_QD_ADMIN.'metabox_framework/meta-box.php');
} }
public function init_hooks(){ public function init_hooks(){
add_action( 'current_screen', array( $this, 'admin_screen' ));
add_action( 'admin_menu', array( $this, 'sub_donation_order_menu' ) ); add_action( 'admin_menu', array( $this, 'sub_donation_order_menu' ) );
add_action( 'admin_menu', array($this,'add_donation_notification_bubble'),99); add_action( 'admin_menu', array($this,'add_donation_notification_bubble'),99);
...@@ -43,6 +51,14 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -43,6 +51,14 @@ class WooCommerce_Quick_Donation_Admin {
} }
public function admin_screen(){
if($this->sys_info == $this->current_screen()){
if(!WC_QD()->is_request('ajax')){
$this->add_notice();
}
}
}
public function sub_donation_order_menu(){ public function sub_donation_order_menu(){
$this->order_menu_slug = add_submenu_page('edit.php?post_type=wcqd_project', $this->order_menu_slug = add_submenu_page('edit.php?post_type=wcqd_project',
...@@ -59,10 +75,16 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -59,10 +75,16 @@ class WooCommerce_Quick_Donation_Admin {
'wc_qd_donors', 'wc_qd_donors',
array($this,'donors_listing_page')); array($this,'donors_listing_page'));
$this->tools = add_submenu_page('edit.php?post_type=wcqd_project', $this->sys_info = add_submenu_page('edit.php?post_type=wcqd_project',
__('System Tools',WC_QD_TXT), __('System Tools',WC_QD_TXT),
__('System Tools',WC_QD_TXT), __('System Tools',WC_QD_TXT),
'administrator', 'administrator',
'wc_qd_sys_info',
array($this,'system_tools'));
$this->tools = add_submenu_page('edit.php?post_type=wcqd_project',
__('',WC_QD_TXT),
__('',WC_QD_TXT),
'administrator',
'wc_qd_tools', 'wc_qd_tools',
array($this,'system_tools')); array($this,'system_tools'));
} }
...@@ -70,11 +92,9 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -70,11 +92,9 @@ class WooCommerce_Quick_Donation_Admin {
public function reorder_donation_menu ($menu_ord ) { public function reorder_donation_menu ($menu_ord ) {
global $submenu; global $submenu;
//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;} if(empty($submenu)){return $submenu;}
$arr = array(); $arr = array();
$arr[] = $submenu[$name][18]; $arr[] = $submenu[$name][18];
$arr[] = $submenu[$name][19]; $arr[] = $submenu[$name][19];
$arr[] = $submenu[$name][5]; $arr[] = $submenu[$name][5];
...@@ -93,9 +113,7 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -93,9 +113,7 @@ class WooCommerce_Quick_Donation_Admin {
$c = $this->get_status_count(); $c = $this->get_status_count();
if(isset($submenu['edit.php?post_type='.WC_QD_PT])){ if(isset($submenu['edit.php?post_type='.WC_QD_PT])){
foreach($submenu['edit.php?post_type='.WC_QD_PT] as $menuK => $menu){ foreach($submenu['edit.php?post_type='.WC_QD_PT] as $menuK => $menu){
if($menu[2] == 'wc_qd_orders' ){ if($menu[2] == 'wc_qd_orders' ){
$submenu['edit.php?post_type='.WC_QD_PT][$menuK][0] .= "<span class='update-plugins count-1'> $submenu['edit.php?post_type='.WC_QD_PT][$menuK][0] .= "<span class='update-plugins count-1'>
<span class='update-count'>$c</span></span>"; <span class='update-count'>$c</span></span>";
} }
...@@ -134,10 +152,6 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -134,10 +152,6 @@ class WooCommerce_Quick_Donation_Admin {
public function system_tools(){ public function system_tools(){
require(WC_QD_ADMIN.'/views/tools.php'); require(WC_QD_ADMIN.'/views/tools.php');
//require(WC_QD_ADMIN.'/sysinfo/sysinfo.php');
//$sysinfo = new WooCommerce_Quick_Donation_SysInfo;
//$sysinfo->setup();
//$sysinfo->render_info();
} }
public function donation_orders_page(){ public function donation_orders_page(){
...@@ -182,7 +196,7 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -182,7 +196,7 @@ class WooCommerce_Quick_Donation_Admin {
wp_enqueue_style(WC_QD_SLUG.'_settings_style',WC_QD_CSS.'admin-settings-style.css' , array(), WC_QD()->version, 'all' ); wp_enqueue_style(WC_QD_SLUG.'_settings_style',WC_QD_CSS.'admin-settings-style.css' , array(), WC_QD()->version, 'all' );
} }
if('wcqd_project_page_wc_qd_tools' == $this->current_screen()){ if($this->sys_info == $this->current_screen()){
wp_enqueue_style(WC_QD_SLUG.'_sysinfo_style',WC_QD_CSS.'sysinfo.css' , array(), WC_QD()->version, 'all' ); wp_enqueue_style(WC_QD_SLUG.'_sysinfo_style',WC_QD_CSS.'sysinfo.css' , array(), WC_QD()->version, 'all' );
} }
...@@ -199,7 +213,7 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -199,7 +213,7 @@ class WooCommerce_Quick_Donation_Admin {
if(in_array($this->current_screen() , $this->get_screen_ids())) { if(in_array($this->current_screen() , $this->get_screen_ids())) {
wp_enqueue_script(WC_QD_SLUG.'_core_script', WC_QD_JS.'admin-script.js', array('jquery'), WC_QD()->version, false ); wp_enqueue_script(WC_QD_SLUG.'_core_script', WC_QD_JS.'admin-script.js', array('jquery'), WC_QD()->version, false );
} }
if('wcqd_project_page_wc_qd_tools' == $this->current_screen()){ if($this->sys_info == $this->current_screen()){
wp_register_script(WC_QD_SLUG.'_sysinfo_script', WC_QD_JS.'sysinfo.js', array( 'jquery' ), WC_QD()->version,false ); wp_register_script(WC_QD_SLUG.'_sysinfo_script', WC_QD_JS.'sysinfo.js', array( 'jquery' ), WC_QD()->version,false );
wp_localize_script(WC_QD_SLUG.'_sysinfo_script', 'systemInfoAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); wp_localize_script(WC_QD_SLUG.'_sysinfo_script', 'systemInfoAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
wp_enqueue_script(WC_QD_SLUG.'_sysinfo_script'); wp_enqueue_script(WC_QD_SLUG.'_sysinfo_script');
...@@ -213,6 +227,7 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -213,6 +227,7 @@ class WooCommerce_Quick_Donation_Admin {
$screen[] = 'wcqd_project_page_WC_QD_settings'; $screen[] = 'wcqd_project_page_WC_QD_settings';
$screen[] = $this->order_menu_slug; $screen[] = $this->order_menu_slug;
$screen[] = $this->donors_list; $screen[] = $this->donors_list;
$screen[] = $this->sys_info;
$screen[] = $this->tools; $screen[] = $this->tools;
return $screen; return $screen;
} }
...@@ -239,6 +254,7 @@ class WooCommerce_Quick_Donation_Admin { ...@@ -239,6 +254,7 @@ class WooCommerce_Quick_Donation_Admin {
$screen_ids[] = $this->order_menu_slug; $screen_ids[] = $this->order_menu_slug;
$screen_ids[] = $this->order_menu_slug; $screen_ids[] = $this->order_menu_slug;
$screen_ids[] = $this->donors_list; $screen_ids[] = $this->donors_list;
$screen_ids[] = $this->sys_info;
$screen_ids[] = $this->tools; $screen_ids[] = $this->tools;
return $screen_ids; return $screen_ids;
} }
......
<?php
// Example plugin class.
class WooCommerce_Quick_Donation_Admin_Settings {
private $page_hook;
private $settings;
private $settings_pages;
private $settings_section;
private $settings_fields;
function __construct($page_hook) {
$this->page_hook = $page_hook;
$this->settings_pages = array();
$this->settings_section = array();
$this->settings_fields = array();
$this->settings = new WooCommerce_Quick_Donation_Settings_Page();
}
/**
* Gets Settings Tab For Settings Page
* @return [[Type]] [[Description]]
*/
public function get_settings_page(){
$this->settings_pages[] = array('name' => __( 'Tab 2',WC_QD_TXT), 'type' => 'heading');
$this->settings_pages[] = array('name' => __( 'Tab 2',WC_QD_TXT), 'type' => 'heading');
$this->settings_pages = apply_filters('wc_quick_donation_settings_tab',$this->settings_pages);
return $this->settings_pages;
}
private function get_settings_section(){
$this->settings_section['example_page'] = array(
array('id'=> 'first_section',
'title'=> __('First Section',WC_QD_TXT),
'validate_callback' => array($this,'validate_section')
),
array('id'=> 'second_section',
'title' => __( 'Second Section.', WC_QD_TXT )
),
);
$this->settings_section['second_page'] = array(
array('id'=> 'second_page_first_section',
'title' => __( 'Welcome to the second page', WC_QD_TXT)
)
);
$this->settings_section = apply_filters('wc_quick_donation_settings_section',$this->settings_section);
return $this->settings_section;
}
private function get_settings_fields(){
$this->settings_fields['example_page']['first_section'] = array(array(
'id' => 'section_one_text', // required
'type' => 'text', // required
'label' => __( 'Text field label (required)', WC_QD_TXT),
'default' => 'default text',
'desc' => __( 'This is a required field.', WC_QD_TXT),
'attr' => array( 'class' => 'my_class' )
));
$this->settings_fields = apply_filters('wc_quick_donation_settings_fields',$this->settings_fields);
return $this->settings_fields;
}
function admin_init() {
$pages = $this->settings->add_pages($this->get_settings_page());
$sections = $this->get_settings_section();
$fields = $this->get_settings_fields();
foreach($sections as $section_id => $section){
$pages = $this->settings->add_sections($section_id,$section);
}
foreach($fields as $page_id => $fields){
foreach($fields as $section_id => $field){
$pages = $this->settings->add_fields($page_id, $section_id, $field );
}
}
$this->settings->init( $pages, $this->page_hook );
}
function admin_page() {
echo '<div class="wrap">';
settings_errors();
$this->settings->render_header( __( 'WP Settings Example', 'plugin-text-domain' ) );
//echo $this->settings->debug;
// Use the function get_settings() to get all the settings.
$settings = $this->settings->get_settings();
// Use the function get get_current_admin_page() to check what page you're on
// $page = $this->settings->get_current_admin_page();
// $current_page = $page['id'];
// Display the form(s).
$this->settings->render_form();
echo '</div>';
}
function validate_section( $fields ) {
// Validation of the section_one_text text input.
// Show an error if it's empty.
// to check the section that's being validated you can check the 'section_id'
// that was added with a hidden field in the admin page form.
//
// example
// if( 'first_section' === $fields['section_id'] ) { // do stuff }
if ( empty( $fields['section_one_text'] ) ) {
// Use add_settings_error() to show an error messages.
add_settings_error(
'section_one_text', // Form field id.
'texterror', // Error id.
__( 'Error: please enter some text.', 'plugin-text-domain' ), // Error message.
'error' // Type of message. Use 'error' or 'updated'.
);
}
// Don't forget to return the fields
return $fields;
}
} // end of class
?>
\ No newline at end of file
<?php
/**
*
* This file runs when the plugin in uninstalled (deleted).
* This will not run when the plugin is deactivated.
* Ideally you will add all your clean-up scripts here
* that will clean-up unused meta, options, etc. in the database.
*
*/
// If plugin is not being uninstalled, exit (do nothing)
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Do something here if plugin is being uninstalled.
\ No newline at end of file
...@@ -228,14 +228,28 @@ Client IP Address: <?php echo sss_get_ip() . "\n"; ?> ...@@ -228,14 +228,28 @@ Client IP Address: <?php echo sss_get_ip() . "\n"; ?>
Simple Donation Product Exist : <?php echo WC_QD()->donation_product_exist_public(); ?> Simple Donation Product Exist : <?php echo WC_QD()->donation_product_exist_public(); ?>
<?php <?php
$settings = WC_QD()->settings()->get_settings();
foreach($settings as $id => $setting){
$value = $setting;
if(is_array($setting)){$value = json_encode($setting);}
echo $id .' : '.$value."\n";
}
foreach(WC_QD()->settings()->settings_field as $setting){
foreach($setting as $setK => $set){
echo "\n ".'-- '.$setK.' Settings'. " \n";
foreach($set as $s){
$value = WC_QD()->settings()->get_option($s['id']);
if(is_array($value)) {$value = json_encode($value);}
if(empty($value)){$value = 'null';}
echo $s['id'].' : '.$value." \n";
}
}
}
?> ?>
## Template Override Information
<?php
$override = WC_QD()->admin()->functions->get_OverRided();
foreach($override as $temp){
$is_old = '';
if($temp['is_old']) { $is_old = '[You are using an outdated version. kindly update it]'; }
echo "".$temp['file']." || Core Version ".$temp['corev']." || Theme Version".$temp['themev']." $is_old". " \n";
}
?>
### End WooCommerce Quick Donation Status ### ### End WooCommerce Quick Donation Status ###
\ No newline at end of file
This diff is collapsed.
<?php
require(WC_QD_ADMIN.'/sysinfo/sysinfo.php');
$sysinfo = new WooCommerce_Quick_Donation_SysInfo;
$sysinfo->setup();
?>
<textarea style="display:none;"
readonly="readonly"
onclick="this.focus();this.select()"
id="wcqdssstextarea"
name="simple-system-status-textarea"
title="<?php _e( 'To copy the System Status, click below then press Ctrl + C (PC) or Cmd + C (Mac)',WC_QD_TXT);?>"><?php echo $sysinfo::display(); ?> </textarea>
<?php echo $sysinfo::display('table'); ?>
\ No newline at end of file
<?php
require(WC_QD_ADMIN.'/sysinfo/sysinfo.php');
$sysinfo = new WooCommerce_Quick_Donation_SysInfo;
$sysinfo->setup();
echo $sysinfo::display('table');
?>
<table cellspacing="0" id="status" class="wc_status_table widefat">
<thead>
<tr>
<th data-export-label="WordPress Environment" colspan="3">WordPress Environment</th>
</tr>
</thead>
<tbody>
<tr>
<td data-export-label="Home URL">Home URL:</td>
<td class="help"><a class="help_tip" href="#">[?]</a></td>
<td>http://localhost/wpdev</td>
</tr>
<tr>
<td data-export-label="Language">Language:</td>
<td class="help"><a class="help_tip" href="#">[?]</a></td>
<td>en_US</td>
</tr>
</tbody>
</table>
\ No newline at end of file
<div class="wrap woocommerce"> <div class="wrap woocommerce">
<?php <?php
$active = 'sysinfo'; $active = 'wc_qd_sys_info';
if(isset($_REQUEST['ntab'])){$active == $_GET['ntab'];}
if(isset($_GET['page'])){$active = $_GET['page'];}
$pageToOpen = str_replace('wc_qd_','',$active);
$pages= array(); $pages= array();
$pages['sysinfo'] = __('System Status',WC_QD_TXT); $pages['wc_qd_sys_info'] = __('System Status',WC_QD_TXT);
$pages['tools'] = __('Tools',WC_QD_TXT); $pages['wc_qd_tools'] = __('Tools',WC_QD_TXT);
$url = menu_page_url('wc_qd_tools', false );
$links = ''; $links = '';
foreach($pages as $pageid => $page){ foreach($pages as $pageid => $page){
$class = 'nav-tab '; $class = 'nav-tab ';
$url = menu_page_url($pageid, false );
if($active == $pageid){$class .= ' nav-tab-active'; } if($active == $pageid){$class .= ' nav-tab-active'; }
$links .= '<a class="'.$class.'" href="'.$url.'&ntba='.$pageid.'">'.$page.'</a>'; $links .= '<a class="'.$class.'" href="'.$url.'">'.$page.'</a>';
} }
?> ?>
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper"><?php echo $links; ?></h2> <h2 class="nav-tab-wrapper woo-nav-tab-wrapper"><?php echo $links; ?></h2>
<?php require(WC_QD_ADMIN.'views/'.$active.'-view.php'); ?> <?php require(WC_QD_ADMIN.'views/'.$pageToOpen.'_view.php'); ?>
</div> </div>
\ No newline at end of file
...@@ -490,7 +490,7 @@ if(!has_action('init', array('WP_Admin_Notices', 'getInstance'))){ ...@@ -490,7 +490,7 @@ if(!has_action('init', array('WP_Admin_Notices', 'getInstance'))){
if ( ! function_exists( 'wc_qd_notice' ) ) { if ( ! function_exists( 'wc_qd_notice' ) ) {
function wc_qd_notice( $message, $type = 'update',$args = array()) { function wc_qd_notice( $message, $type = 'update',$args = array()) {
$notice = ''; $notice = '';
$defaults = array('times' => 11,'screen' => array(),'users' => array(), 'wraper' => true); $defaults = array('times' => 1,'screen' => array(),'users' => array(), 'wraper' => true);
$args = wp_parse_args( $args, $defaults ); $args = wp_parse_args( $args, $defaults );
extract($args); extract($args);
if($type == 'error'){$notice = new WP_Error_Notice($message,$times, $screen, $users);} if($type == 'error'){$notice = new WP_Error_Notice($message,$times, $screen, $users);}
......
...@@ -23,8 +23,9 @@ p.submit { ...@@ -23,8 +23,9 @@ p.submit {
text-align: left; text-align: left;
} }
textarea#sss-textarea { textarea#wcqdssstextarea {
height: 500px; height: 450px;
width: 100%;
font-family: Menlo,Monaco,monospace; font-family: Menlo,Monaco,monospace;
background: 0 0; background: 0 0;
white-space: pre; white-space: pre;
......
jQuery(document).ready(function(){
jQuery('#wcqdssstextarea').hide();
jQuery('#WCQDShowTXT').click(function(){
jQuery('#wcqdssstextarea').slideToggle();
});
});
\ No newline at end of file
...@@ -55,7 +55,7 @@ if(! function_exists('wcqd_get_project_name')){ ...@@ -55,7 +55,7 @@ if(! function_exists('wcqd_get_project_name')){
* @return int / boolean [returns project id if exist or returns false] * @return int / boolean [returns project id if exist or returns false]
*/ */
function wcqd_get_project_name($order_id = '', $default_title = ''){ function wcqd_get_project_name($order_id = '', $default_title = ''){
$project_id = wcqd_get_project($order_id); $project_id = wcqd_get_project_from_order($order_id);
$title = get_the_title($project_id); $title = get_the_title($project_id);
if(empty($title)){return $default_title;} if(empty($title)){return $default_title;}
return $title; return $title;
......
<?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">&nbsp;</th>
<th class="product-thumbnail">&nbsp;</th>
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
<th class="product-price"><?php _e( 'Price', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
<th class="product-subtotal"><?php _e( 'Total', '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
if ( ! $_product->is_visible() ) {
echo apply_filters( 'woocommerce_cart_item_name', $_product->get_title(), $cart_item, $cart_item_key ) . '&nbsp;';
} else {
echo apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s </a>', esc_url( $_product->get_permalink( $cart_item ) ), $_product->get_title() ), $cart_item, $cart_item_key );
}
// Meta data
echo WC()->cart->get_item_data( $cart_item );
// Backorder notification
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
echo '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>';
}
?>
</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>
<td class="product-quantity">
<?php
if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
} else {
$product_quantity = woocommerce_quantity_input( array(
'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'],
'max_value' => $_product->backorders_allowed() ? '' : $_product->get_stock_quantity(),
'min_value' => '0'
), $_product, false );
}
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item );
?>
</td>
<td class="product-subtotal">
<?php
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key );
?>
</td>
</tr>
<?php
}
}
do_action( 'woocommerce_cart_contents' );
?>
<tr>
<td colspan="6" class="actions">
<?php if ( WC()->cart->coupons_enabled() ) { ?>
<div class="coupon">
<label for="coupon_code"><?php _e( 'Coupon', 'woocommerce' ); ?>:</label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" /> <input type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply Coupon', 'woocommerce' ); ?>" />
<?php do_action( 'woocommerce_cart_coupon' ); ?>
</div>
<?php } ?>
<input type="submit" class="button" name="update_cart" value="<?php esc_attr_e( 'Update Cart', 'woocommerce' ); ?>" />
<?php do_action( 'woocommerce_cart_actions' ); ?>
<?php wp_nonce_field( 'woocommerce-cart' ); ?>
</td>
</tr>
<?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
/**
* Donation Tracking
*
* @author Varun Sridharan
* @package WooCommerce Quick Donation/Templates/order
* @version 0.1
*/
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>
\ No newline at end of file
<?php
/**
* Donate Again
*
* @author Varun Sridharan
* @package WooCommerce Quick Donation/Templates/order
* @version 0.1
*/
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
/**
* Donation tracking
*
* @author Varun Sridharan
* @package WooCommerce Quick Donation/Templates/order
* @version 0.1
*/
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 ); ?>
...@@ -267,7 +267,7 @@ class WooCommerce_Quick_Donation { ...@@ -267,7 +267,7 @@ class WooCommerce_Quick_Donation {
* string $type ajax, frontend or admin * string $type ajax, frontend or admin
* @return bool * @return bool
*/ */
private function is_request( $type ) { public function is_request( $type ) {
switch ( $type ) { switch ( $type ) {
case 'admin' : case 'admin' :
return is_admin(); return is_admin();
......
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