Changeset 3092301
- Timestamp:
- 05/24/2024 08:16:02 PM (20 months ago)
- Location:
- cloud-printing-for-woocommerce/trunk
- Files:
-
- 4 edited
-
includes/class-wc-iconnect.php (modified) (7 diffs)
-
includes/printerco-settings.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
woocommerce-iconnect.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cloud-printing-for-woocommerce/trunk/includes/class-wc-iconnect.php
r2952065 r3092301 13 13 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/printerco-dokan.php'; 14 14 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/printerco-plugins-support.php'; 15 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/Store-OpenClose.php'; 15 16 16 17 if ( ! class_exists( 'WC_Iconnect' ) ) : … … 30 31 31 32 const ICONNECT_DOMAIN = 'http://mypanel.printerco.net/'; 32 // const ICONNECT_DOMAIN = 'https://dev.printerco.net/';33 33 34 34 const ICONNECT_RESERVATION_ORDER_URL = self::ICONNECT_DOMAIN . 'api/submitreservationext'; … … 238 238 } 239 239 240 240 // IF PRINTER IS INACTIVE THEN ORDER WILL NOT CREATE 241 public function check_printer_connection() 242 { 243 $params = array(); 244 $params['req_api_key'] = $this->get_option( 'iconnect_api_key' ); 245 $params['req_api_password'] = $this->get_option( 'iconnect_api_password' ); 246 $params['req_printer_id'] = $this->get_option( 'iconnect_printer_id' ); 247 if($params['req_api_key'] != "" && $params['req_api_password'] != "" && $params['req_printer_id'] != "" ) 248 { 249 $response = StoreOpenClose::find_shop_status($params); 250 $xml = simplexml_load_string($response); 251 $printerStatus = (string)$xml->details->printer_status; 252 if($printerStatus != 'active') 253 { 254 return $printerStatus; 255 } 256 return $printerStatus; 257 } 258 } 259 241 260 public function woocommerce_send_order_to_iconnect($order_id) 242 261 { 262 $printerStatus = "active"; 243 263 $this->order = new WC_Order($order_id); 264 $printerStatus = $this->check_printer_connection(); 244 265 245 266 ob_start(); … … 262 283 print_r($this->items); 263 284 264 $this->set_items_info(); 265 $this->order_processing(); 285 if($printerStatus == "active") 286 { 287 $this->set_items_info(); 288 $this->order_processing(); 289 } 266 290 } 267 291 … … 507 531 508 532 $baseOrder->currency = get_post_meta( $this->order->id, '_order_currency', true ); 509 533 if($this->order->currency) 534 { 535 $baseOrder->currency = $this->order->currency; 536 } 537 538 510 539 511 540 $baseOrder->payment_method = $paymentmethod1 = get_post_meta( $this->order->id, '_payment_method_title', true ); 512 541 $paymentmethod2 = get_post_meta( $this->order->id, '_payment_method', true ); 542 543 // updated code - start (19th Apr 2024) 544 if($this->order->payment_method_title) 545 { 546 $baseOrder->payment_method = $paymentmethod1 = $this->order->payment_method_title; 547 } 548 549 if($this->order->payment_method) 550 { 551 $paymentmethod2 = $this->order->payment_method; 552 } 553 // updated code - end 513 554 echo 'Payment method: '.esc_html($paymentmethod1).':'.esc_html($paymentmethod2); 514 555 … … 756 797 $baseOrder->tax_amount = null; 757 798 } 799 800 // VAT IS NOT ADDING THEREFORE ADD BELOW CODE(3rdMay2024): 801 if($this->order->total_tax) 802 { 803 $baseOrder->tax_amount = number_format($this->order->total_tax,2,'.',''); 804 } 805 758 806 // VAT - END 759 807 … … 859 907 $item_info_arr['cat'] = ''; 860 908 } 861 $item_meta = new WC_Order_Item_Meta($item ['item_meta'], $product);909 $item_meta = new WC_Order_Item_Meta($item, $product); 862 910 $item_option_arr = $item_meta->get_formatted(); 863 911 $item_info_arr['item'] = $item['name']; -
cloud-printing-for-woocommerce/trunk/includes/printerco-settings.php
r2952065 r3092301 166 166 'options' => $all_gateway_list, 167 167 ), 168 169 'iconnect_shopclose_action' => array( 170 'title' => __( 'Allow checkout, if shop is closed?', 'woocommerce-iconnect-api-integration' ), 171 'type' => 'select', 172 'description' => __( 'Allow customers to checkout/place orders when the shop is closed. ', 'woocommerce-iconnect-api-integration' ), 173 'desc_tip' => true, 174 'default' => '', 175 'options' => array( 176 'no'=>'No', 177 'yes'=>'Yes', 178 179 ) 180 ), 181 'iconnect_shopclose_message' => array( 182 'title' => __( 'Show message if shop is closed', 'woocommerce-iconnect-api-integration' ), 183 'type' => 'text', 184 'description' => __( 'If shop is closed then this message will show.', 'woocommerce-iconnect-api-integration' ), 185 'desc_tip' => true, 186 'default' => '' 187 ), 188 'iconnect_printer_disconnect' => array( 189 'title' => __( 'Allow checkout, if printer is disconnected?', 'woocommerce-iconnect-api-integration' ), 190 'type' => 'select', 191 'description' => __( 'Allow customers to checkout/place orders when the printer is disconnected. ', 'woocommerce-iconnect-api-integration' ), 192 'desc_tip' => true, 193 'default' => '', 194 'options' => array( 195 'no'=>'No', 196 'yes'=>'Yes', 197 198 ) 199 ), 200 'iconnect_printerdisconnect_message' => array( 201 'title' => __( 'Show message if printer is disconnect', 'woocommerce-iconnect-api-integration' ), 202 'type' => 'text', 203 'description' => __( 'If printer is disconnect then this message will show.', 'woocommerce-iconnect-api-integration' ), 204 'desc_tip' => true, 205 'default' => '' 206 ), 207 208 209 210 168 211 'iconnect_debug_mode' => array( 169 212 'title' => __( 'Debug Mode?', 'woocommerce-iconnect-api-integration' ), -
cloud-printing-for-woocommerce/trunk/readme.txt
r2952136 r3092301 1 1 === Cloud Printing for WooCommerce === 2 2 Contributors: 3 Tags: POS printer,Sunmi V2,thermal printer, POS system, WooCommerce POS, WooCommerce order printer, WooCommerce printer, PrinterCo, PrinterCo.net 3 Tags: POS printer,Sunmi V2, Woocommerce automatic order printing, POS system, WooCommerce POS, WooCommerce order printer, WooCommerce printer, PrinterCo, PrinterCo.net, add print button to woocommerce checkout page,restaurant ticket printer 4 4 5 Author: PrinterCo.net 5 6 Requires at least: 4.1.1 6 7 Requires PHP: 7.0 7 Tested up to: 6. 38 Tested up to: 6.5.3 8 9 Stable tag: 4.1.1 9 10 License: GPLv2 or later License 10 11 URI: http://www.gnu.org/licenses/gpl-2.0.html 11 12 WC requires at least: 2.2.10 12 WC tested up to: 6.0.10 13 14 15 This plugin adds on-demand order printing features to the official WooCommerce plugin. Useful for restaurants and takeaways or online stores that need print on demand. It prints orders automatically from woocommerce. If you cancel an order from the printer app the order will be cancelled in woocommerce. An automatic refund can be set or cancelled orders. Compatible with popular restaurant ordering plugin. 16 13 WC tested up to: 8.9.1 14 15 16 The printing plugin allows orders to be printed manually, but this process is time-consuming and not suitable for restaurants and takeaways with short preparation times. However, the Automatic Order Printing Plugin for WooCommerce by PrinterCo solves this problem. To use it, you must have an account with PrinterCo. This plugin automatically prints orders from WooCommerce to the PrinterCo POS terminal or any POS printer you already have. The supported printers are listed here. It is compatible with popular restaurant ordering plugins and supports a variety of printers. With just a few clicks, this plugin enables automatic order printing for your WooCommerce store. 17 17 == Description == 18 18 19 20 This plugin extends on top of the features provided by the official WooCommerce plugin. 21 It enables your WooCommerce web store with cloud printing capabilities via a PrinterCo mini POS printer. 22 It is the ideal solution for businesses that need their online orders printed out on demand! 19 The printing plugin allows orders to be printed manually, but this process is time-consuming and not suitable for restaurants and takeaways with short preparation times. However, the Automatic Order Printing Plugin for WooCommerce by PrinterCo solves this problem. To use it, you must have an account with PrinterCo. This plugin automatically prints orders from WooCommerce to the PrinterCo POS terminal or any POS printer you already have. The supported printers are listed here. It is compatible with popular restaurant ordering plugins and supports a variety of printers. With just a few clicks, this plugin enables automatic order printing for your WooCommerce store. 23 20 24 21 … … 26 23 Cancel an order from the printer app and it will be automatically cancelled on your woo-commerce website and will issue a refund. 27 24 Set a delivery or collection time while accepting an order 25 Open/Close the shop from the printer app to allow or prevent the customer to checkout. 28 26 Select and assign a driver to collect the item and deliver it. 29 27 Set automated printing at a busy hour … … 284 282 * Some known bugs and warnings were fixed 285 283 284 = 2.8.0 285 * Some known bugs were fixed. 286 * Now you can disble the checkout when the shop is closed from the app. 287 * Now you can prevent the checkout when the printer is disconnected. 288 286 289 == Upgrade Notice == 287 290 -
cloud-printing-for-woocommerce/trunk/woocommerce-iconnect.php
r2952065 r3092301 40 40 require_once 'includes/PrintercoRefund.php'; 41 41 require_once 'includes/PrintercoOrderCallback.php'; 42 require_once 'includes/Store-OpenClose.php'; 42 43 // Register the integration. 43 44 add_filter( 'woocommerce_integrations', array( $this, 'add_integration' ) ); … … 53 54 $integrations[] = 'WC_Iconnect'; 54 55 $integrations[] = 'PrintercoEmailEditor'; 56 $integrations[] = 'StoreOpenClose'; 55 57 return $integrations; 56 58 }
Note: See TracChangeset
for help on using the changeset viewer.