Changeset 2417450
- Timestamp:
- 11/12/2020 07:52:37 PM (5 years ago)
- Location:
- k2-woo-custom-payment-gateway
- Files:
-
- 7 added
- 2 edited
-
tags/1.2 (added)
-
tags/1.2/K2_Custom_Payment_Gateway.php (added)
-
tags/1.2/Readme.txt (added)
-
tags/1.2/assets (added)
-
tags/1.2/assets/hand.png (added)
-
trunk/K2_Custom_Payment_Gateway.php (modified) (6 diffs)
-
trunk/Readme.txt (modified) (4 diffs)
-
trunk/assets (added)
-
trunk/assets/hand.png (added)
Legend:
- Unmodified
- Added
- Removed
-
k2-woo-custom-payment-gateway/trunk/K2_Custom_Payment_Gateway.php
r2415222 r2417450 62 62 $this->method_title = __( 'K2-Woo Custom Payment Gateway', $this->domain ); 63 63 $this->method_description = __( 'Description: Add Custom Payment Gateway on Woocommerce Checkout with custom fields.', $this->domain ); 64 $this->show_field = "Hidden"; 64 65 65 66 // Load the settings. … … 71 72 $this->description = $this->get_option( 'description' ); 72 73 $this->order_status = $this->get_option( 'order_status', 'completed' ); 73 74 $this->cust = $this->get_option( 'custom-field-title' ); 74 75 // Actions 75 76 … … 87 88 88 89 89 add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );90 add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) ); 90 91 91 92 } … … 125 126 'default' => __('Checkout with K2-Woo Custom Payment Gateway with additional custom fields', $this->domain), 126 127 'desc_tip' => true, 128 ), 129 'custom-field-title' => array( 130 'title' => 'Custom field title', 131 'description' => __('Adding title will enable a custom text input with that title.'), 132 'type' => 'text', 133 'default' => 'Add your custom field title', 134 'desc_tip' => true, 127 135 ) 128 136 ); 129 137 } 130 138 131 139 132 140 public function payment_scripts() { … … 142 150 } 143 151 144 145 152 } 146 153 147 154 public function payment_fields(){ 155 156 echo wpautop( wptexturize( $this->description ) ); 157 158 if ( $this->cust != 'Add your custom field title' && !empty($this->cust)) { 159 echo wpautop( wptexturize( $this->cust ) ); 160 $this->show_field = "text"; 161 ?> 162 <div id="custom_input"> 163 <div style="padding: 0em; display: flex; flex-wrap: wrap;"> 164 <input style = "flex: 1 1 65%; box-sizing: border-box !important; margin-right: 0.5em; margin-top: 0.3em; background-color: #F5F5F5;" type="<?= $this->show_field ?>" class="" name="custom-field" id="mobile" placeholder="Enter the <?= $this->cust ?>" value='' > 165 </div> 166 </div> 167 <?php 168 } 169 else{ 170 ?> 171 <div id="custom_input"> 172 <div style="padding: 0em; display: flex; flex-wrap: wrap;"> 173 <input style = "flex: 1 1 65%; box-sizing: border-box !important; margin-right: 0.5em; margin-top: 0.3em; background-color: #F5F5F5;" type="Hidden" class="" name="custom-field" id="mobile" placeholder="Enter the <?= $this->cust ?>" value='' > 174 </div> 175 </div> 176 <?php 177 } 178 $this->show_field = "Hidden"; 179 } 180 148 181 /** 149 182 * Process the payment and return the result. … … 158 191 $status = 'wc-' === substr( $this->order_status, 0, 3 ) ? substr( $this->order_status, 3 ) : $this->order_status; 159 192 193 if (!empty($_POST['custom-field'])) { 194 update_post_meta($order_id, $this->cust , sanitize_text_field($_POST['custom-field'])); 195 } 160 196 // Set order status 161 197 $order->update_status( $status, __( 'Checkout with K2-Woo Custom Payment Gateway. ', $this->domain ) ); -
k2-woo-custom-payment-gateway/trunk/Readme.txt
r2415212 r2417450 1 1 === K2 Custom Payment Gateway for WooCommerce === 2 Contributors: syedharis632, shahrukhx04, hmumtaz1, saadhamid2 Contributors: hmumtaz1, syedharis632, shahrukhx04, saadhamid 3 3 Tags: Wordpress, Woocommerce, Essentials 4 4 Requires at least: 5.2 5 5 Tested up to: 5.5.1 6 6 Requires PHP: 5.6 7 Stable tag: 1. 17 Stable tag: 1.2 8 8 License: GPL2+ 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.txt … … 21 21 DYNAMIC TITLE 22 22 23 You can define your own custom payment method by adding a dynamic title of your own choice .23 You can define your own custom payment method by adding a dynamic title of your own choice i.e Cash on Delivery. 24 24 25 25 DYNAMIC DESCRIPTION … … 27 27 You can describe your own custom payment method by adding a dynamic description of your own choice. 28 28 29 DYNAMIC ICON30 31 You can add your own dynamic icon to your custom payment method.32 33 29 ORDER STATUS 34 30 35 31 You can define your own order statuses. You can also choose what the order status will be once payment is processed through your custom payment gateway. 32 33 DYNAMIC INPUT FIELD 34 35 You can add the title for an input you want from the user when they choose this specific payment option i.e input address only for payment through cash on delivery orders 36 36 37 37 … … 66 66 = 1.1 = 67 67 Bug fixes 68 = 1.2 = 69 Added feature to add dynamic input field for saving with the order 68 70 69 71 == Development ==
Note: See TracChangeset
for help on using the changeset viewer.