WooCommerce Print Invoice & Delivery Note - Version 4.4

Version Description

(29.12.2017) =

  • This version has 1 bug fix.

  • Fix - Earlier with WooCommerce Local Pickup Plus v2.x.x, pickup locations were not displayed on the invoices, delivery notes & receipts. Now, the plugin is compatible with it and it will display the pickup locations.

  • Code Enhancement - Now, the plugin has the uninstall file for deleting the plugin options.

Download this release

Release Info

Developer tychesoftwares
Plugin Icon 128x128 WooCommerce Print Invoice & Delivery Note
Version 4.4
Comparing to
See all releases

Code changes from version 4.3.6 to 4.4

assets/images/icon-256x256.png ADDED
Binary file
assets/images/wcdn-email-myaccount.png ADDED
Binary file
assets/images/wcdn-invoice-numbering.png ADDED
Binary file
assets/images/wcdn-settings.png ADDED
Binary file
includes/class-wcdn-print.php CHANGED
@@ -119,8 +119,54 @@ if ( ! class_exists( 'WooCommerce_Delivery_Notes_Print' ) ) {
119
  add_action( 'parse_request', array( $this, 'parse_request' ) );
120
  add_action( 'template_redirect', array( $this, 'template_redirect_theme' ) );
121
  add_action( 'wp_ajax_print_order', array( $this, 'template_redirect_admin' ) );
 
122
  }
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  /**
125
  * Load the init hooks
126
  */
119
  add_action( 'parse_request', array( $this, 'parse_request' ) );
120
  add_action( 'template_redirect', array( $this, 'template_redirect_theme' ) );
121
  add_action( 'wp_ajax_print_order', array( $this, 'template_redirect_admin' ) );
122
+ add_action( 'wcdn_after_items', array( $this, 'wdn_add_extra_data_after_items' ), 10 , 1 );
123
  }
124
 
125
+ public function wdn_add_extra_data_after_items ( $order ) {
126
+
127
+ /**
128
+ * Local pickup plus plugin is active
129
+ */
130
+ if ( class_exists( "WC_Local_Pickup_Plus") ) {
131
+
132
+ $cdn_local_pickup_plugin_plugins_version = wc_local_pickup_plus()->get_version();
133
+
134
+ if( version_compare( $cdn_local_pickup_plugin_plugins_version, '2.0.0', ">=" ) ) {
135
+ $cdn_local_pickup_object = new WC_Local_Pickup_Plus_Orders();
136
+ $local_pickup = wc_local_pickup_plus();
137
+ $cdn_local_pickup_locations = $cdn_local_pickup_object->get_order_pickup_data( $order );
138
+ $cdn_local_pickup__shipping_object = $local_pickup->get_shipping_method_instance();
139
+ WooCommerce_Delivery_Notes_Print::cdn_print_local_pickup_address( $cdn_local_pickup_locations, $cdn_local_pickup__shipping_object );
140
+ }
141
+ }
142
+ }
143
+
144
+ public function cdn_print_local_pickup_address( $cdn_local_pickup_locations, $shipping_method ) {
145
+
146
+ $package_number = 1;
147
+ $packages_count = count( $cdn_local_pickup_locations );
148
+ foreach ( $cdn_local_pickup_locations as $pickup_meta ) :
149
+ ?>
150
+ <div>
151
+ <?php if ( $packages_count > 1 ) : ?>
152
+ <h5><?php echo sprintf( is_rtl() ? '#%2$s %1$s': '%1$s #%2$s', esc_html( $shipping_method->get_method_title() ), $package_number ); ?></h5>
153
+ <?php endif; ?>
154
+ <ul>
155
+ <?php foreach ( $pickup_meta as $label => $value ) : ?>
156
+ <li>
157
+ <?php if ( is_rtl() ) : ?>
158
+ <?php echo wp_kses_post( $value ); ?> <strong>:<?php echo esc_html( $label ); ?></strong>
159
+ <?php else : ?>
160
+ <strong><?php echo esc_html( $label ); ?>:</strong> <?php echo wp_kses_post( $value ); ?>
161
+ <?php endif; ?>
162
+ </li>
163
+ <?php endforeach; ?>
164
+ </ul>
165
+ <?php $package_number++; ?>
166
+ </div>
167
+ <?
168
+ endforeach;
169
+ }
170
  /**
171
  * Load the init hooks
172
  */
includes/wcdn-welcome.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Print Invoice & Delivery Note Welcome Page Class
4
+ *
5
+ * Displays on plugin activation
6
+ */
7
+
8
+ // Exit if accessed directly.
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * WCDN_Welcome Class
15
+ *
16
+ * A general class for About page.
17
+ *
18
+ * @since 4.4
19
+ */
20
+ class WCDN_Welcome {
21
+
22
+ /**
23
+ * @var string The capability users should have to view the page
24
+ */
25
+ public $minimum_capability = 'manage_options';
26
+
27
+ /**
28
+ * Get things started
29
+ *
30
+ * @since 4.4
31
+ */
32
+ public function __construct() {
33
+
34
+ add_action( 'admin_menu', array( $this, 'wcdn_admin_menus' ) );
35
+ add_action( 'admin_head', array( $this, 'wcdn_admin_head' ) );
36
+
37
+ if ( !isset( $_GET[ 'page' ] ) ||
38
+ ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] != 'wcdn-about' ) ) {
39
+ add_action( 'admin_init', array( $this, 'wcdn_welcome' ) );
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Register the Dashboard Page which is later hidden but this pages
45
+ * is used to render the Welcome page.
46
+ *
47
+ * @access public
48
+ * @since 4.4
49
+ * @return void
50
+ */
51
+ public function wcdn_admin_menus() {
52
+ // About Page
53
+ add_dashboard_page(
54
+ sprintf( esc_html__( 'Welcome to WooCommerce Print Invoice & Delivery Note %s', 'woocommerce-delivery-notes' ), WooCommerce_Delivery_Notes::$plugin_version ),
55
+ esc_html__( 'Welcome to WooCommerce Print Invoice & Delivery Note', 'woocommerce-delivery-notes' ),
56
+ $this->minimum_capability,
57
+ 'wcdn-about',
58
+ array( $this, 'wcdn_about_screen' )
59
+ );
60
+ }
61
+
62
+ /**
63
+ * Hide Individual Dashboard Pages
64
+ *
65
+ * @access public
66
+ * @since 4.4
67
+ * @return void
68
+ */
69
+ public function wcdn_admin_head() {
70
+ remove_submenu_page( 'index.php', 'wcdn-about' );
71
+ }
72
+
73
+ /**
74
+ * Render About Screen
75
+ *
76
+ * @access public
77
+ * @since 4.4
78
+ * @return void
79
+ */
80
+ public function wcdn_about_screen() {
81
+ $display_version = WooCommerce_Delivery_Notes::$plugin_version;
82
+ // Badge for welcome page
83
+ $badge_url = WooCommerce_Delivery_Notes::$plugin_url . 'assets/images/icon-256x256.png';
84
+ $wcdn_plugin_url = WooCommerce_Delivery_Notes::$plugin_url;
85
+ ?>
86
+ <style>
87
+ .feature-section .feature-section-item {
88
+ float:left;
89
+ width:48%;
90
+ }
91
+ </style>
92
+ <div class="wrap about-wrap">
93
+
94
+ <?php $this->wcdn_get_welcome_header() ?>
95
+
96
+ <div style="float:left;width: 80%;">
97
+ <p class="about-text" style="margin-right:20px;"><?php
98
+ printf(
99
+ __( "Thank you for activating or updating to the latest version of WooCommerce Print Invoice & Delivery Note! If you're a first time user, welcome! You're well on your way to explore the print functionality for your WooCommerce orders." )
100
+ );
101
+ ?></p>
102
+ </div>
103
+ <div class="wcdn-badge"><img src="<?php echo $badge_url; ?>" style="width:150px;"/></div>
104
+
105
+ <p>&nbsp;</p>
106
+
107
+ <div class="feature-section clearfix introduction">
108
+
109
+ <h3><?php esc_html_e( "Get Started with WooCommerce Print Invoice & Delivery Note", 'woocommerce-delivery-notes' ); ?></h3>
110
+
111
+ <div class="video feature-section-item" style="float:left;padding-right:10px;">
112
+ <img src="<?php echo $wcdn_plugin_url . '/assets/images/wcdn-settings.png' ?>"
113
+ alt="<?php esc_attr_e( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-delivery-notes' ); ?>" style="width:600px;">
114
+ </div>
115
+
116
+ <div class="content feature-section last-feature">
117
+ <h3><?php esc_html_e( 'Add settings', 'woocommerce-delivery-notes' ); ?></h3>
118
+
119
+ <p><?php esc_html_e( 'To enable the print functionality for your invoices, delivery notes & receipts, you just need to set it up under WooCommerce -> Settings -> Print page. Here you can also setup the Company Logo that will appear on the printed items, Company Address & other information.', 'woocommerce-delivery-notes' ); ?></p>
120
+ <a href="admin.php?page=wc-settings&tab=wcdn-settings" target="_blank" class="button-secondary">
121
+ <?php esc_html_e( 'Click Here to go to Print page', 'woocommerce-delivery-notes' ); ?>
122
+ <span class="dashicons dashicons-external"></span>
123
+ </a>
124
+ </div>
125
+ </div>
126
+
127
+ <div class="content">
128
+
129
+ <div class="feature-section clearfix">
130
+ <div class="content feature-section-item">
131
+
132
+ <h3><?php esc_html_e( 'Enable Print button for Customers.', 'woocommerce-delivery-notes' ); ?></h3>
133
+
134
+ <p><?php esc_html_e( 'Allow customers to print the WooCommerce order invoice from the customer notification email, from the My Account page or from the View Order page under My Account.', 'woocommerce-delivery-notes' ); ?></p>
135
+ <a href="admin.php?page=wc-settings&tab=wcdn-settings" target="_blank" class="button-secondary">
136
+ <?php esc_html_e( 'Click Here to Enable Print button for Customers', 'woocommerce-delivery-notes' ); ?>
137
+ <span class="dashicons dashicons-external"></span>
138
+ </a>
139
+ </div>
140
+
141
+ <div class="content feature-section-item last-feature">
142
+ <img src="<?php echo $wcdn_plugin_url . 'assets/images/wcdn-email-myaccount.png'; ?>" alt="<?php esc_attr_e( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-delivery-notes' ); ?>" style="width:500px;">
143
+ </div>
144
+ </div>
145
+
146
+ <div class="feature-section clearfix introduction">
147
+ <div class="video feature-section-item" style="float:left;padding-right:10px;">
148
+ <img src="<?php echo $wcdn_plugin_url . 'assets/images/wcdn-invoice-numbering.png'; ?>" alt="<?php esc_attr_e( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-delivery-notes' ); ?>" style="width:500px;">
149
+ </div>
150
+
151
+ <div class="content feature-section-item last-feature">
152
+ <h3><?php esc_html_e( 'Enable Invoice Numbering', 'woocommerce-delivery-notes' ); ?></h3>
153
+
154
+ <p><?php esc_html_e( 'f you want to change the default invoice numbers & set some numbering scheme of your own, then you can set it here with a starting invoice number, a prefix & suffix. For example, you could set it as: TS/001/17-18.', 'woocommerce-delivery-notes' ); ?></p>
155
+ <a href="admin.php?page=wc-settings&tab=wcdn-settings" target="_blank" class="button-secondary">
156
+ <?php esc_html_e( 'Click Here to Enable Invoice Numbering', 'woocommerce-delivery-notes' ); ?>
157
+ <span class="dashicons dashicons-external"></span>
158
+ </a>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <div class="feature-section clearfix">
164
+
165
+ <div class="content feature-section-item">
166
+
167
+ <h3><?php esc_html_e( 'Getting to Know Tyche Softwares', 'woocommerce-delivery-notes' ); ?></h3>
168
+
169
+ <ul class="ul-disc">
170
+ <li><a href="https://tychesoftwares.com/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank"><?php esc_html_e( 'Visit the Tyche Softwares Website', 'woocommerce-delivery-notes' ); ?></a></li>
171
+ <li><a href="https://tychesoftwares.com/premium-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank"><?php esc_html_e( 'View all Premium Plugins', 'woocommerce-delivery-notes' ); ?></a>
172
+ <ul class="ul-disc">
173
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Abandoned Cart Pro Plugin for WooCommerce</a></li>
174
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-booking-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Booking & Appointment Plugin for WooCommerce</a></li>
175
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Order Delivery Date for WooCommerce</a></li>
176
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Product Delivery Date for WooCommerce</a></li>
177
+ <li><a href="https://www.tychesoftwares.com/store/premium-plugins/deposits-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Deposits for WooCommerce</a></li>
178
+ </ul>
179
+ </li>
180
+ <li><a href="https://tychesoftwares.com/about/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank"><?php esc_html_e( 'Meet the team', 'woocommerce-delivery-notes' ); ?></a></li>
181
+ </ul>
182
+ </div>
183
+
184
+ <div class="content feature-section-item">
185
+
186
+ <h3><?php esc_html_e( 'Current Offers', 'woocommerce-delivery-notes' ); ?></h3>
187
+
188
+ <p>Buy all our <a href="https://tychesoftwares.com/premium-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">premium plugins</a> at 30% off till 31st December 2017</p>
189
+ </div>
190
+ </div>
191
+ <!-- /.feature-section -->
192
+ </div>
193
+ <?php
194
+
195
+ update_option( 'wcdn_welcome_page_shown', 'yes' );
196
+ update_option( 'wcdn_welcome_page_shown_time', current_time( 'timestamp' ) );
197
+ }
198
+
199
+
200
+ /**
201
+ * The header section for the welcome screen.
202
+ *
203
+ * @since 4.4
204
+ */
205
+ public function wcdn_get_welcome_header() {
206
+ // Badge for welcome page
207
+ $badge_url = WooCommerce_Delivery_Notes::$plugin_url . 'assets/images/icon-256x256.png';
208
+ ?>
209
+ <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
210
+ <?php $this->wcdn_social_media_elements(); ?>
211
+
212
+ <?php }
213
+
214
+
215
+ /**
216
+ * Social Media Like Buttons
217
+ *
218
+ * Various social media elements to Tyche Softwares
219
+ * @since: 4.4
220
+ */
221
+ public function wcdn_social_media_elements() { ?>
222
+
223
+ <div class="social-items-wrap">
224
+
225
+ <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Ftychesoftwares&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=220596284639969"
226
+ scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;"
227
+ allowTransparency="true"></iframe>
228
+
229
+ <a href="https://twitter.com/tychesoftwares" class="twitter-follow-button" data-show-count="false"><?php
230
+ printf(
231
+ esc_html_e( 'Follow %s', 'tychesoftwares' ),
232
+ '@tychesoftwares'
233
+ );
234
+ ?></a>
235
+ <script>!function (d, s, id) {
236
+ var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
237
+ if (!d.getElementById(id)) {
238
+ js = d.createElement(s);
239
+ js.id = id;
240
+ js.src = p + '://platform.twitter.com/widgets.js';
241
+ fjs.parentNode.insertBefore(js, fjs);
242
+ }
243
+ }(document, 'script', 'twitter-wjs');
244
+ </script>
245
+
246
+ </div>
247
+ <!--/.social-items-wrap -->
248
+
249
+ <?php
250
+ }
251
+
252
+
253
+ /**
254
+ * Sends user to the Welcome page on first activation of WooCommerce Print Invoice & Delivery Note as well as each
255
+ * time WooCommerce Print Invoice & Delivery Note is upgraded to a new version
256
+ *
257
+ * @access public
258
+ * @since 4.4
259
+ *
260
+ * @return void
261
+ */
262
+ public function wcdn_welcome() {
263
+
264
+ // Bail if activating from network, or bulk
265
+ if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
266
+ return;
267
+ }
268
+
269
+ if( !get_option( 'wcdn_welcome_page_shown' ) ) {
270
+ wp_safe_redirect( admin_url( 'index.php?page=wcdn-about' ) );
271
+ exit;
272
+ }
273
+ }
274
+
275
+ }
276
+
277
+ new WCDN_Welcome();
readme.txt CHANGED
@@ -4,9 +4,9 @@ Contributors: ashokrane, bhavik.kiri, tychesoftwares, chabis
4
  Donate link: https://www.paypal.me/TycheSoftwares
5
  Tags: delivery note, packing slip, pdf invoice, delivery, shipping, print order, woocommerce, woothemes, shop
6
  Requires at least: 4.0
7
- Tested up to: 4.8.1
8
  Author URI: https://www.tychesoftwares.com/
9
- Stable tag: 4.3.6
10
  License: GPLv3 or later
11
  License URI: http://www.opensource.org/licenses/gpl-license.php
12
 
@@ -328,6 +328,14 @@ Please [contribute your translation](https://github.com/TycheSoftwares/woocommer
328
 
329
  = Minimum Requirements: WooCommerce 2.2 =
330
 
 
 
 
 
 
 
 
 
331
  = 4.3.6 (19.12.2017) =
332
 
333
  * Added translation for the word 'Price' for dutch language
4
  Donate link: https://www.paypal.me/TycheSoftwares
5
  Tags: delivery note, packing slip, pdf invoice, delivery, shipping, print order, woocommerce, woothemes, shop
6
  Requires at least: 4.0
7
+ Tested up to: 4.9.1
8
  Author URI: https://www.tychesoftwares.com/
9
+ Stable tag: 4.4
10
  License: GPLv3 or later
11
  License URI: http://www.opensource.org/licenses/gpl-license.php
12
 
328
 
329
  = Minimum Requirements: WooCommerce 2.2 =
330
 
331
+ = 4.4 (29.12.2017) =
332
+
333
+ * This version has 1 bug fix.
334
+
335
+ * Fix - Earlier with WooCommerce Local Pickup Plus v2.x.x, pickup locations were not displayed on the invoices, delivery notes & receipts. Now, the plugin is compatible with it and it will display the pickup locations.
336
+
337
+ * Code Enhancement - Now, the plugin has the uninstall file for deleting the plugin options.
338
+
339
  = 4.3.6 (19.12.2017) =
340
 
341
  * Added translation for the word 'Price' for dutch language
templates/print-order/print-content.php CHANGED
@@ -9,212 +9,220 @@
9
  if ( !defined( 'ABSPATH' ) ) exit;
10
  ?>
11
 
12
- <div class="order-branding">
13
- <div class="company-logo">
14
- <?php if( wcdn_get_company_logo_id() ) : ?><?php wcdn_company_logo(); ?><?php endif; ?>
15
- </div>
16
-
17
- <div class="company-info">
18
- <?php if( !wcdn_get_company_logo_id() ) : ?><h1 class="company-name"><?php wcdn_company_name(); ?></h1><?php endif; ?>
19
- <div class="company-address"><?php wcdn_company_info(); ?></div>
20
- </div>
21
-
22
- <?php do_action( 'wcdn_after_branding', $order ); ?>
23
- </div><!-- .order-branding -->
24
-
25
-
26
- <div class="order-addresses<?php if( !wcdn_has_shipping_address( $order ) ) : ?> no-shipping-address<?php endif; ?>">
27
- <div class="billing-address">
28
- <h3><?php _e( 'Billing Address', 'woocommerce-delivery-notes' ); ?></h3>
29
- <address>
30
-
31
- <?php if( !$order->get_formatted_billing_address() ) _e( 'N/A', 'woocommerce-delivery-notes' ); else echo apply_filters( 'wcdn_address_billing', $order->get_formatted_billing_address(), $order ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- </address>
34
- </div>
35
-
36
- <div class="shipping-address">
37
- <h3><?php _e( 'Shipping Address', 'woocommerce-delivery-notes' ); ?></h3>
38
- <address>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- <?php if( !$order->get_formatted_shipping_address() ) _e( 'N/A', 'woocommerce-delivery-notes' ); else echo apply_filters( 'wcdn_address_shipping', $order->get_formatted_shipping_address(), $order ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
- </address>
43
- </div>
44
-
45
- <?php do_action( 'wcdn_after_addresses', $order ); ?>
46
- </div><!-- .order-addresses -->
47
-
48
-
49
- <div class="order-info">
50
- <h2><?php wcdn_document_title(); ?></h2>
51
-
52
- <ul class="info-list">
53
- <?php $fields = apply_filters( 'wcdn_order_info_fields', wcdn_get_order_info( $order ), $order ); ?>
54
- <?php foreach( $fields as $field ) : ?>
55
- <li>
56
- <strong><?php echo apply_filters( 'wcdn_order_info_name', $field['label'], $field ); ?></strong>
57
- <span><?php echo apply_filters( 'wcdn_order_info_content', $field['value'], $field ); ?></span>
58
- </li>
59
- <?php endforeach; ?>
60
- </ul>
61
-
62
- <?php do_action( 'wcdn_after_info', $order ); ?>
63
- </div><!-- .order-info -->
64
-
65
-
66
- <div class="order-items">
67
- <table>
68
- <thead>
69
- <tr>
70
- <th class="head-name"><span><?php _e('Product', 'woocommerce-delivery-notes'); ?></span></th>
71
- <th class="head-item-price"><span><?php _e('Price', 'woocommerce-delivery-notes'); ?></span></th>
72
- <th class="head-quantity"><span><?php _e('Quantity', 'woocommerce-delivery-notes'); ?></span></th>
73
- <th class="head-price"><span><?php _e('Total', 'woocommerce-delivery-notes'); ?></span></th>
74
- </tr>
75
- </thead>
76
 
77
- <tbody>
78
- <?php if( sizeof( $order->get_items() ) > 0 ) : ?>
79
- <?php foreach( $order->get_items() as $item ) : ?>
80
-
81
- <?php
82
- $product = apply_filters( 'wcdn_order_item_product', $order->get_product_from_item( $item ), $item );
83
-
84
- if ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', ">=" ) ) {
85
- $item_meta = new WC_Order_Item_Product( $item['item_meta'], $product );
86
- }else{
87
- $item_meta = new WC_Order_Item_Meta( $item['item_meta'], $product );
88
- }
89
-
90
- ?>
91
-
92
- <tr>
93
- <td class="product-name">
94
- <?php do_action( 'wcdn_order_item_before', $product, $order ); ?>
95
 
96
- <span class="name"><?php
97
- $product_id = $item['product_id'];
98
- $prod_name = get_post( $product_id );
99
- $product_name = $prod_name->post_title;
100
-
101
 
102
- echo apply_filters( 'wcdn_order_item_name', $product_name, $item ); ?></span>
103
 
104
- <?php
105
- // if ( version_compare( get_option( 'woocommerce_version' ), '3.1.0', ">=" ) ) {
106
- // $item_meta->get_product();
107
-
108
- // }else {
109
-
110
- // $item_meta->display();
111
- // }
112
-
113
- if ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', ">=" ) ) {
114
- if( isset( $item[ 'variation_id' ] ) && $item[ 'variation_id' ] != 0 ) {
115
- $variation = wc_get_product( $item[ 'product_id' ] );
116
- foreach ( $item[ 'item_meta' ] as $key => $value ) {
117
- if( !( 0 === strpos($key, '_' ) ) ) {
118
- $term = get_term_by( 'slug', $value, $key );
119
- $attribute_name = wc_attribute_label( $key, $variation );
120
- if( isset( $term->name ) ) {
121
- echo '<br>'.$attribute_name.':'.$term->name;
122
- } else {
123
- echo '<br>'.$attribute_name.':'.$value;
124
- }
125
- }
126
- }
127
  } else {
128
- foreach ( $item[ 'item_meta' ] as $key => $value ) {
129
- if( !( 0 === strpos( $key, '_' ) ) ) {
130
- echo '<br>' . $key . ':' . $value;
131
- }
132
- }
133
  }
134
- } else {
135
- $item_meta_new = new WC_Order_Item_Meta( $item['item_meta'], $product );
136
- $item_meta_new->display( );
137
-
138
- }
139
- ?>
140
- <br>
141
- <dl class="extras">
142
- <?php if( $product && $product->exists() && $product->is_downloadable() && $order->is_download_permitted() ) : ?>
143
-
144
- <dt><?php _e( 'Download:', 'woocommerce-delivery-notes' ); ?></dt>
145
- <dd><?php printf( __( '%s Files', 'woocommerce-delivery-notes' ), count( $item->get_item_downloads() ) ); ?></dd>
146
-
147
- <?php endif; ?>
148
-
149
- <?php
150
- $fields = apply_filters( 'wcdn_order_item_fields', array(), $product, $order );
151
- foreach ( $fields as $field ) :
152
- ?>
153
-
154
- <dt><?php echo $field['label']; ?></dt>
155
- <dd><?php echo $field['value']; ?></dd>
156
-
157
- <?php endforeach; ?>
158
- </dl>
159
- </td>
160
- <td class="product-item-price">
161
- <span><?php echo wcdn_get_formatted_item_price( $order, $item ); ?></span>
162
- </td>
163
- <td class="product-quantity">
164
- <span><?php echo apply_filters( 'wcdn_order_item_quantity', $item['qty'], $item ); ?></span>
165
- </td>
166
- <td class="product-price">
167
- <span><?php echo $order->get_formatted_line_subtotal( $item ); ?></span>
168
- </td>
169
- </tr>
170
- <?php endforeach; ?>
171
- <?php endif; ?>
172
- </tbody>
173
-
174
- <tfoot>
175
- <?php if( $totals = $order->get_order_item_totals() ) : ?>
176
- <?php foreach( $totals as $total ) : ?>
177
- <tr>
178
- <td class="total-name"><span><?php echo $total['label']; ?></span></td>
179
- <td class="total-item-price"></td>
180
- <td class="total-quantity"></td>
181
- <td class="total-price"><span><?php echo $total['value']; ?></span></td>
182
- </tr>
183
- <?php endforeach; ?>
184
- <?php endif; ?>
185
- </tfoot>
186
- </table>
187
 
188
- <?php do_action( 'wcdn_after_items', $order ); ?>
189
- </div><!-- .order-items -->
190
-
191
-
192
- <div class="order-notes">
193
- <?php if( wcdn_has_customer_notes( $order ) ) : ?>
194
- <h4><?php _e( 'Customer Note', 'woocommerce-delivery-notes' ); ?></h4>
195
- <?php wcdn_customer_notes( $order ); ?>
196
- <?php endif; ?>
197
-
198
- <?php do_action( 'wcdn_after_notes', $order ); ?>
199
- </div><!-- .order-notes -->
200
-
201
-
202
- <div class="order-thanks">
203
- <?php wcdn_personal_notes(); ?>
204
-
205
- <?php do_action( 'wcdn_after_thanks', $order ); ?>
206
- </div><!-- .order-thanks -->
207
-
208
-
209
- <div class="order-colophon">
210
- <div class="colophon-policies">
211
- <?php wcdn_policies_conditions(); ?>
212
- </div>
213
-
214
- <div class="colophon-imprint">
215
- <?php wcdn_imprint(); ?>
216
- </div>
217
-
218
- <?php do_action( 'wcdn_after_colophon', $order ); ?>
219
- </div><!-- .order-colophon -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
9
  if ( !defined( 'ABSPATH' ) ) exit;
10
  ?>
11
 
12
+ <div class="order-branding">
13
+ <div class="company-logo">
14
+ <?php if( wcdn_get_company_logo_id() ) : ?><?php wcdn_company_logo(); ?><?php endif; ?>
15
+ </div>
16
+
17
+ <div class="company-info">
18
+ <?php if( !wcdn_get_company_logo_id() ) : ?><h1 class="company-name"><?php wcdn_company_name(); ?></h1><?php endif; ?>
19
+ <div class="company-address"><?php wcdn_company_info(); ?></div>
20
+ </div>
21
+
22
+ <?php do_action( 'wcdn_after_branding', $order ); ?>
23
+ </div><!-- .order-branding -->
24
+
25
+
26
+ <div class="order-addresses<?php if( !wcdn_has_shipping_address( $order ) ) : ?> no-shipping-address<?php endif; ?>">
27
+ <div class="billing-address">
28
+ <h3><?php _e( 'Billing Address', 'woocommerce-delivery-notes' ); ?></h3>
29
+ <address>
30
+
31
+ <?php if( !$order->get_formatted_billing_address() ) _e( 'N/A', 'woocommerce-delivery-notes' ); else echo apply_filters( 'wcdn_address_billing', $order->get_formatted_billing_address(), $order ); ?>
32
+
33
+ </address>
34
+ </div>
35
+
36
+ <div class="shipping-address">
37
+ <h3><?php _e( 'Shipping Address', 'woocommerce-delivery-notes' ); ?></h3>
38
+ <address>
39
+
40
+ <?php if( !$order->get_formatted_shipping_address() ) _e( 'N/A', 'woocommerce-delivery-notes' ); else echo apply_filters( 'wcdn_address_shipping', $order->get_formatted_shipping_address(), $order ); ?>
41
+
42
+ </address>
43
+ </div>
44
 
45
+ <?php do_action( 'wcdn_after_addresses', $order ); ?>
46
+ </div><!-- .order-addresses -->
47
+
48
+
49
+ <div class="order-info">
50
+ <h2><?php wcdn_document_title(); ?></h2>
51
+
52
+ <ul class="info-list">
53
+ <?php $fields = apply_filters( 'wcdn_order_info_fields', wcdn_get_order_info( $order ), $order );
54
+ ?>
55
+ <?php foreach( $fields as $field ) : ?>
56
+ <li>
57
+ <strong><?php echo apply_filters( 'wcdn_order_info_name', $field['label'], $field ); ?></strong>
58
+ <span><?php echo apply_filters( 'wcdn_order_info_content', $field['value'], $field ); ?></span>
59
+ </li>
60
+ <?php endforeach; ?>
61
+ </ul>
62
+
63
+ <?php do_action( 'wcdn_after_info', $order ); ?>
64
+ </div><!-- .order-info -->
65
 
66
+
67
+ <div class="order-items">
68
+ <table>
69
+ <thead>
70
+ <tr>
71
+ <th class="head-name"><span><?php _e('Product', 'woocommerce-delivery-notes'); ?></span></th>
72
+ <th class="head-item-price"><span><?php _e('Price', 'woocommerce-delivery-notes'); ?></span></th>
73
+ <th class="head-quantity"><span><?php _e('Quantity', 'woocommerce-delivery-notes'); ?></span></th>
74
+ <th class="head-price"><span><?php _e('Total', 'woocommerce-delivery-notes'); ?></span></th>
75
+ </tr>
76
+ </thead>
77
+
78
+ <tbody>
79
+ <?php
80
+
81
+ if( sizeof( $order->get_items() ) > 0 ) : ?>
82
+ <?php foreach( $order->get_items() as $item ) : ?>
83
 
84
+ <?php
85
+ $product = apply_filters( 'wcdn_order_item_product', $order->get_product_from_item( $item ), $item );
86
+
87
+ if ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', ">=" ) ) {
88
+ $item_meta = new WC_Order_Item_Product( $item['item_meta'], $product );
89
+ }else{
90
+ $item_meta = new WC_Order_Item_Meta( $item['item_meta'], $product );
91
+ }
92
+
93
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
+ <tr>
96
+ <td class="product-name">
97
+ <?php do_action( 'wcdn_order_item_before', $product, $order ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
+ <span class="name"><?php
100
+ $product_id = $item['product_id'];
101
+ $prod_name = get_post( $product_id );
102
+ $product_name = $prod_name->post_title;
103
+
104
 
105
+ echo apply_filters( 'wcdn_order_item_name', $product_name, $item ); ?></span>
106
 
107
+ <?php
108
+ // if ( version_compare( get_option( 'woocommerce_version' ), '3.1.0', ">=" ) ) {
109
+ // $item_meta->get_product();
110
+
111
+ // }else {
112
+
113
+ // $item_meta->display();
114
+ // }
115
+
116
+ if ( version_compare( get_option( 'woocommerce_version' ), '3.0.0', ">=" ) ) {
117
+ if( isset( $item[ 'variation_id' ] ) && $item[ 'variation_id' ] != 0 ) {
118
+ $variation = wc_get_product( $item[ 'product_id' ] );
119
+ foreach ( $item[ 'item_meta' ] as $key => $value ) {
120
+ if( !( 0 === strpos($key, '_' ) ) ) {
121
+ $term = get_term_by( 'slug', $value, $key );
122
+ $attribute_name = wc_attribute_label( $key, $variation );
123
+ if( isset( $term->name ) ) {
124
+ echo '<br>'.$attribute_name.':'.$term->name;
 
 
 
 
 
125
  } else {
126
+ echo '<br>'.$attribute_name.':'.$value;
 
 
 
 
127
  }
128
+ }
129
+ }
130
+ } else {
131
+ foreach ( $item[ 'item_meta' ] as $key => $value ) {
132
+ if( !( 0 === strpos( $key, '_' ) ) ) {
133
+ echo '<br>' . $key . ':' . $value;
134
+ }
135
+ }
136
+ }
137
+ } else {
138
+ $item_meta_new = new WC_Order_Item_Meta( $item['item_meta'], $product );
139
+ $item_meta_new->display( );
140
+
141
+ }
142
+ ?>
143
+ <br>
144
+ <dl class="extras">
145
+ <?php if( $product && $product->exists() && $product->is_downloadable() && $order->is_download_permitted() ) : ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
+ <dt><?php _e( 'Download:', 'woocommerce-delivery-notes' ); ?></dt>
148
+ <dd><?php printf( __( '%s Files', 'woocommerce-delivery-notes' ), count( $item->get_item_downloads() ) ); ?></dd>
149
+
150
+ <?php endif; ?>
151
+
152
+ <?php
153
+
154
+ $fields = apply_filters( 'wcdn_order_item_fields', array(), $product, $order );
155
+
156
+ foreach ( $fields as $field ) :
157
+ ?>
158
+
159
+ <dt><?php echo $field['label']; ?></dt>
160
+ <dd><?php echo $field['value']; ?></dd>
161
+
162
+ <?php endforeach; ?>
163
+ </dl>
164
+ </td>
165
+ <td class="product-item-price">
166
+ <span><?php echo wcdn_get_formatted_item_price( $order, $item ); ?></span>
167
+ </td>
168
+ <td class="product-quantity">
169
+ <span><?php echo apply_filters( 'wcdn_order_item_quantity', $item['qty'], $item ); ?></span>
170
+ </td>
171
+ <td class="product-price">
172
+ <span><?php echo $order->get_formatted_line_subtotal( $item ); ?></span>
173
+ </td>
174
+ </tr>
175
+ <?php endforeach; ?>
176
+ <?php endif; ?>
177
+ </tbody>
178
+
179
+ <tfoot>
180
+ <?php if( $totals = $order->get_order_item_totals() ) : ?>
181
+ <?php
182
+
183
+
184
+ foreach( $totals as $total ) : ?>
185
+ <tr>
186
+ <td class="total-name"><span><?php echo $total['label']; ?></span></td>
187
+ <td class="total-item-price"></td>
188
+ <td class="total-quantity"></td>
189
+ <td class="total-price"><span><?php echo $total['value']; ?></span></td>
190
+ </tr>
191
+ <?php endforeach; ?>
192
+ <?php endif; ?>
193
+ </tfoot>
194
+ </table>
195
+
196
+ <?php do_action( 'wcdn_after_items', $order ); ?>
197
+ </div><!-- .order-items -->
198
+
199
+
200
+ <div class="order-notes">
201
+ <?php if( wcdn_has_customer_notes( $order ) ) : ?>
202
+ <h4><?php _e( 'Customer Note', 'woocommerce-delivery-notes' ); ?></h4>
203
+ <?php wcdn_customer_notes( $order ); ?>
204
+ <?php endif; ?>
205
+
206
+ <?php do_action( 'wcdn_after_notes', $order ); ?>
207
+ </div><!-- .order-notes -->
208
+
209
+
210
+ <div class="order-thanks">
211
+ <?php wcdn_personal_notes(); ?>
212
+
213
+ <?php do_action( 'wcdn_after_thanks', $order ); ?>
214
+ </div><!-- .order-thanks -->
215
+
216
+
217
+ <div class="order-colophon">
218
+ <div class="colophon-policies">
219
+ <?php wcdn_policies_conditions(); ?>
220
+ </div>
221
+
222
+ <div class="colophon-imprint">
223
+ <?php wcdn_imprint(); ?>
224
+ </div>
225
+
226
+ <?php do_action( 'wcdn_after_colophon', $order ); ?>
227
+ </div><!-- .order-colophon -->
228
 
uninstall.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WooCommerce Print Invoice & Delivery Note Uninstall
4
+ *
5
+ * Uninstalling WooCommerce Print Invoice & Delivery Note options.
6
+ *
7
+ */
8
+
9
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
10
+ exit;
11
+ }
12
+
13
+ /**
14
+ * Delete the data for the WordPress Multisite.
15
+ */
16
+ if ( is_multisite() ) {
17
+ $wcdn_blog_list = get_sites( );
18
+
19
+ foreach( $wcdn_blog_list as $wcdn_blog_list_key => $wcdn_blog_list_value ) {
20
+ $wcdn_blog_id = $wcdn_blog_list_value->blog_id;
21
+ delete_blog_option( $wcdn_blog_id, 'wcdn_welcome_page_shown' );
22
+ delete_blog_option( $wcdn_blog_id, 'wcdn_welcome_page_shown_time' );
23
+ }
24
+
25
+ } else {
26
+ /**
27
+ * Delete the data for the single website ( Non-Multisite )
28
+ */
29
+ delete_option( 'wcdn_welcome_page_shown' );
30
+ delete_option( 'wcdn_welcome_page_shown_time' );
31
+ }
32
+
33
+ wp_cache_flush();
woocommerce-delivery-notes.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: WooCommerce Print Invoice & Delivery Note
6
  * Plugin URI: https://www.tychesoftwares.com/
7
  * Description: Print Invoices & Delivery Notes for WooCommerce Orders.
8
- * Version: 4.3.6
9
  * Author: Tyche Softwares
10
  * Author URI: https://www.tychesoftwares.com/
11
  * License: GPLv3 or later
@@ -49,7 +49,7 @@ if ( !defined( 'ABSPATH' ) ) {
49
  if ( !class_exists( 'WooCommerce_Delivery_Notes' ) ) {
50
 
51
  final class WooCommerce_Delivery_Notes {
52
-
53
  /**
54
  * The single instance of the class
55
  */
@@ -58,7 +58,7 @@ if ( !class_exists( 'WooCommerce_Delivery_Notes' ) ) {
58
  /**
59
  * Default properties
60
  */
61
- public static $plugin_version = '4.3.2';
62
  public static $plugin_url;
63
  public static $plugin_path;
64
  public static $plugin_basefile;
@@ -131,6 +131,7 @@ if ( !class_exists( 'WooCommerce_Delivery_Notes' ) ) {
131
  * Define constant if not already set
132
  */
133
  private function define( $name, $value ) {
 
134
  if( !defined( $name ) ) {
135
  define( $name, $value );
136
  }
@@ -144,6 +145,9 @@ if ( !class_exists( 'WooCommerce_Delivery_Notes' ) ) {
144
  include_once( 'includes/class-wcdn-settings.php' );
145
  include_once( 'includes/class-wcdn-writepanel.php' );
146
  include_once( 'includes/class-wcdn-theme.php' );
 
 
 
147
  }
148
 
149
  /**
5
  * Plugin Name: WooCommerce Print Invoice & Delivery Note
6
  * Plugin URI: https://www.tychesoftwares.com/
7
  * Description: Print Invoices & Delivery Notes for WooCommerce Orders.
8
+ * Version: 4.4
9
  * Author: Tyche Softwares
10
  * Author URI: https://www.tychesoftwares.com/
11
  * License: GPLv3 or later
49
  if ( !class_exists( 'WooCommerce_Delivery_Notes' ) ) {
50
 
51
  final class WooCommerce_Delivery_Notes {
52
+
53
  /**
54
  * The single instance of the class
55
  */
58
  /**
59
  * Default properties
60
  */
61
+ public static $plugin_version = '4.4';
62
  public static $plugin_url;
63
  public static $plugin_path;
64
  public static $plugin_basefile;
131
  * Define constant if not already set
132
  */
133
  private function define( $name, $value ) {
134
+
135
  if( !defined( $name ) ) {
136
  define( $name, $value );
137
  }
145
  include_once( 'includes/class-wcdn-settings.php' );
146
  include_once( 'includes/class-wcdn-writepanel.php' );
147
  include_once( 'includes/class-wcdn-theme.php' );
148
+ if ( is_admin() ) {
149
+ include_once( 'includes/wcdn-welcome.php' );
150
+ }
151
  }
152
 
153
  /**