Skip to content

Commit

Permalink
Merge pull request #9 from vbiweb/dev
Browse files Browse the repository at this point in the history
New feature (Automatic Updates) and bug fixes
  • Loading branch information
kgkrishnavbi authored Nov 6, 2019
2 parents 58652d4 + 07811c2 commit 9ba6432
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 29 deletions.
32 changes: 13 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
=== Plugin Name ===
Contributors: (this should be a list of wordpress.org userid's)
=== WC Order View ===

Contributors: kggopal12
Donate link: https://kgopalkrishna.com
Tags: woocommerce, order, view
Requires at least: 5.0.0
Tested up to: 5.2.3
Stable tag: 1.1.0
Stable tag: 1.2.0
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

This plugin gives a strict View-Only access to Woocommerce orders for specified user roles.

== Description ==

This is the long description. No limit, and you can use Markdown (as well as in the following sections).

For backwards compatibility, if this section is missing, the full length of the short description will be used, and
Markdown parsed.

A few notes about the sections above:

* "Contributors" is a comma separated list of wp.org/wp-plugins.org usernames
* "Tags" is a comma separated list of tags that apply to the plugin
* "Requires at least" is the lowest version that the plugin will work on
* "Tested up to" is the highest version that you've *successfully used to test the plugin*. Note that it might work on
higher versions... this is just the highest one you've verified.
* Stable tag should indicate the Subversion "tag" of the latest stable version, or "trunk," if you use `/trunk/` for
stable.
This plugin gives a strict view only access to woocommerce orders. All you need to do is create a new user role 'products_admin' using any role editor plugin available. All users with this role will be able to view orders, the items in the order, total amount paid including taxes and shipping, and the order notes all in read-only mode. This plugin also provides support for select 3rd party Woocommerce premium plugins like Woocommerce Subscriptions, PDF Invoices and Woocommerce API Manager. Planned features include CSV Exporting options and Custom Order actions available only for 'products_admin'

== Installation ==

Expand All @@ -42,18 +30,24 @@ stable.
* Issue #3 - Fixed the total orders count shown in all orders page

= 1.1.0 =
* Issue #5 - Fixed cancelled orders not visible
* Fix - Fixed cancelled orders not visible #5
* Feature - Support for 3rd party woocommerce plugins ( PDF Invoices, Woocommerce Subscriptions, Woocommerce API Mananger )
* Dev - New hooks added to the view order details page ( Details will be shared in a separate documentation )

= 1.2.0 =
* Feature - One click update option added in the plugins page
* Fix - Cancelled order status color doesn't match WooCommerce #8
* Fix - Invoice date for all orders showing same date in All orders list #9

== Features ==

1. Strict view only access to orders.
1. View each orders individually.
1. Support for 3rd party woocommerce plugins ( PDF Invoices, Woocommerce Subscriptions, Woocommerce API Mananger )
1. Automatic update notifications

== Planned Features ==

* hooks and filters for adding custom content in view order page
* Export orders in CSV format
* Custom order view actions

Expand Down
20 changes: 12 additions & 8 deletions admin/class-wc-order-view-admin-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function get_orders( $per_page = 5, $page_number = 1 ) {
$shipping_address = WC()->countries->get_formatted_address( $shipping_address, ', ' );

$order_item[ 'order_id' ] = $order->get_id();
$order_item[ 'name' ] = $order->get_billing_first_name() . " " . $order->get_billing_last_name();
$order_item[ 'customer_name' ] = $order->get_billing_first_name() . " " . $order->get_billing_last_name();
$order_item[ 'date' ] = $result_item->post_date;
$order_item[ 'status' ] = $result_item->post_status;
$order_item[ 'billing_address' ] = $billing_address ? $billing_address : "";
Expand Down Expand Up @@ -212,7 +212,7 @@ function get_columns() {
$columns = array(
'cb' => __( '<input type="checkbox" />', 'wc-order-view' ),
'order_id' => __( 'Order', 'wc-order-view' ),
'name' => __( 'Name', 'wc-order-view' )
'customer_name' => __( 'Name', 'wc-order-view' )
);

if( get_option( 'wcov_pdf_invoices' ) == "enabled" ) {
Expand All @@ -226,7 +226,7 @@ function get_columns() {

if( get_option( 'wcov_subscriptions' ) == "enabled" ) {

$columns[ 'subscription_relationship' ] = '<div class="subscription_head tooltip">' . esc_attr__( 'Subscription Relationship', 'wc-order-view' ) . '<span class="tooltiptext">' . esc_attr__( 'Subscription Relationship', 'wc-order-view' ) . '</span></div>';
$columns[ 'subscription_relationship' ] = '<div class="subscription_head tooltip"><span class="tooltiptext">' . esc_attr__( 'Subscription Relationship', 'wc-order-view' ) . '</span></div>';
}

$columns[ 'total' ] = __( 'Total', 'wc-order-view' );
Expand Down Expand Up @@ -264,7 +264,7 @@ public function get_sortable_columns() {
*/
public function get_hidden_columns() {

$hidden_columns = array( 'name', 'billing_address', 'shipping_address' );
$hidden_columns = array( 'customer_name', 'billing_address', 'shipping_address' );

return $hidden_columns;

Expand All @@ -283,7 +283,7 @@ public function column_default( $item, $column_name ) {

switch ( $column_name ) {
case 'order_id' :
case 'name' :
case 'customer_name' :
case 'status' :
case 'date' :
case 'billing_address' :
Expand Down Expand Up @@ -323,7 +323,7 @@ function column_order_id( $item ) {

$order_id = "";
$order_id .= '<a href="admin.php?page=wc-order-view&action=view&order_id=' . $item[ 'order_id' ] . '" class="order-preview" data-order-id="' . $item[ 'order_id' ] . '" title="Preview">Preview</a>';
$order_id .= '<a href="admin.php?page=wc-order-view&action=view&order_id=' . $item[ 'order_id' ] . '" class="order-view"><strong>#' . $item[ 'order_id' ] .' '. $item[ 'name' ] . '</strong></a>';
$order_id .= '<a href="admin.php?page=wc-order-view&action=view&order_id=' . $item[ 'order_id' ] . '" class="order-view"><strong>#' . $item[ 'order_id' ] .' '. $item[ 'customer_name' ] . '</strong></a>';

return $order_id;

Expand Down Expand Up @@ -417,7 +417,7 @@ function column_pdf_invoice( $item ) {
$invoice_number_display = get_post_meta( $order_id, '_invoice_number_display', true );
$invoice_date = get_post_meta( $order_id, '_invoice_date', true );

$invoice = '<a href="' . admin_url( 'edit.php?post_type=shop_order&pdfid=' . $order_id ) .'">' . $invoice_number_display . '<br>' . date( 'j F, Y' ) . '</a>';
$invoice = '<a href="' . admin_url( 'edit.php?post_type=shop_order&pdfid=' . $order_id ) .'">' . $invoice_number_display . '<br>' . date( 'j F, Y', strtotime( $invoice_date ) ) . '</a>';

return $invoice;

Expand Down Expand Up @@ -497,7 +497,11 @@ function usort_reorder( $a, $b ) {
*/
public function prepare_items() {

$this->_column_headers = $this->get_column_info();
//$this->_column_headers = $this->get_column_info();
$columns = $this->get_columns();
$hidden = $this->get_hidden_columns();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);

/** Process bulk action */
//$this->process_bulk_action();
Expand Down
12 changes: 12 additions & 0 deletions admin/css/wc-order-view-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
display: -webkit-inline-box;
display: -webkit-inline-flex;
display: inline-flex;
color: #777;
background: #e5e5e5;
line-height: 2.5em;
border-radius: 4px;
border-bottom: 1px solid
Expand All @@ -98,6 +100,16 @@
color: #94660c;
}

.order-view-admin .order-status.status-failed {
background: #eba3a3;
color: #761919;
}

.order-view-admin .order-status.status-processing {
background: #c6e1c6;
color: #5b841b;
}

.order-view-admin .wp-list-table .column-order_id {
width: 20ch;
}
Expand Down
Loading

0 comments on commit 9ba6432

Please sign in to comment.