Changeset 3329484
- Timestamp:
- 07/17/2025 08:07:35 AM (9 months ago)
- Location:
- connect-plus-for-woocommerce
- Files:
-
- 38 added
- 7 edited
-
tags/1.0.26 (added)
-
tags/1.0.26/README.txt (added)
-
tags/1.0.26/admin (added)
-
tags/1.0.26/admin/cpfw-connect-admin.php (added)
-
tags/1.0.26/admin/css (added)
-
tags/1.0.26/admin/css/cpfw-connect-admin.css (added)
-
tags/1.0.26/admin/index.php (added)
-
tags/1.0.26/admin/js (added)
-
tags/1.0.26/admin/js/cpfw-connect-admin.js (added)
-
tags/1.0.26/admin/partials (added)
-
tags/1.0.26/admin/partials/cpfw-connect-admin-send-btn.php (added)
-
tags/1.0.26/admin/views (added)
-
tags/1.0.26/admin/views/cpfw-connect-admin-settings.php (added)
-
tags/1.0.26/connect-plus-for-woocommerce.php (added)
-
tags/1.0.26/endpoints (added)
-
tags/1.0.26/endpoints/cpfw-connect-ajax-wrapper.php (added)
-
tags/1.0.26/endpoints/cpfw-connect-endpoints.php (added)
-
tags/1.0.26/endpoints/index.php (added)
-
tags/1.0.26/includes (added)
-
tags/1.0.26/includes/cpfw-connect-loader.php (added)
-
tags/1.0.26/includes/cpfw-connect-toggler.php (added)
-
tags/1.0.26/includes/cpfw-connect.php (added)
-
tags/1.0.26/includes/index.php (added)
-
tags/1.0.26/includes/services (added)
-
tags/1.0.26/includes/services/cpfw-connect-api.php (added)
-
tags/1.0.26/index.php (added)
-
tags/1.0.26/languages (added)
-
tags/1.0.26/languages/connect-plus-for-woocommerce.pot (added)
-
tags/1.0.26/public (added)
-
tags/1.0.26/public/cpfw-connect-public.php (added)
-
tags/1.0.26/public/css (added)
-
tags/1.0.26/public/css/cpfw-public.css (added)
-
tags/1.0.26/public/index.php (added)
-
tags/1.0.26/public/js (added)
-
tags/1.0.26/public/js/cpfw-public.js (added)
-
tags/1.0.26/public/partials (added)
-
tags/1.0.26/public/partials/cpfw-public-display.php (added)
-
tags/1.0.26/uninstall.php (added)
-
trunk/README.txt (modified) (1 diff)
-
trunk/admin/cpfw-connect-admin.php (modified) (1 diff)
-
trunk/admin/js/cpfw-connect-admin.js (modified) (1 diff)
-
trunk/admin/views/cpfw-connect-admin-settings.php (modified) (2 diffs)
-
trunk/connect-plus-for-woocommerce.php (modified) (2 diffs)
-
trunk/includes/services/cpfw-connect-api.php (modified) (3 diffs)
-
trunk/languages/connect-plus-for-woocommerce.pot (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
connect-plus-for-woocommerce/trunk/README.txt
r3327337 r3329484 9 9 Tested up to: 6.8 10 10 11 Stable tag: 1.0.2 511 Stable tag: 1.0.26 12 12 13 13 Requires PHP: 7.0 -
connect-plus-for-woocommerce/trunk/admin/cpfw-connect-admin.php
r3327337 r3329484 269 269 'sanitize_callback' => 'absint', 270 270 'default' => 1, 271 ]); 272 273 register_setting('olivery_options_group', 'olivery_connect_field_mapping', [ 274 'type' => 'array', 275 'sanitize_callback' => function ($input) { 276 return is_array($input) 277 ? array_map('sanitize_text_field', $input) 278 : []; 279 }, 280 'default' => [], 271 281 ]); 272 282 -
connect-plus-for-woocommerce/trunk/admin/js/cpfw-connect-admin.js
r3288066 r3329484 133 133 .replace(/customer_name/g, 'Customer Name') 134 134 .replace(/customer_mobile/g, 'Phone') 135 .replace(/sub_area/g, 'Address 1')136 .replace(/sub area/g, 'Address 1')135 .replace(/sub_area/g, 'Address') 136 .replace(/sub area/g, 'Address') 137 137 .replace(/area/g, 'City') 138 138 .replace(/address/g, 'Customer Address'); -
connect-plus-for-woocommerce/trunk/admin/views/cpfw-connect-admin-settings.php
r3321453 r3329484 53 53 "Completed Returned" => __("Completed Returned", 'connect-plus-for-woocommerce'), 54 54 ]; 55 56 $connect_fields = [ 57 'customer_name' => __('Customer First Name', 'connect-plus-for-woocommerce'), 58 'customer_mobile' => __('Customer Mobile', 'connect-plus-for-woocommerce'), 59 'customer_area' => __('Customer Area', 'connect-plus-for-woocommerce'), 60 'customer_sub_area' => __('Customer Sub Area', 'connect-plus-for-woocommerce'), 61 ]; 62 63 $available_name_fields = [ 64 // Billing 65 'billing_name' => __('Billing Name', 'connect-plus-for-woocommerce'), 66 // Shipping 67 'shipping_name' => __('Shipping Name', 'connect-plus-for-woocommerce'), 68 ]; 69 70 $available_phone_fields = [ 71 // Billing 72 'billing_phone' => __('Billing Phone', 'connect-plus-for-woocommerce'), 73 // Shipping 74 'shipping_phone' => __('Shipping Phone', 'connect-plus-for-woocommerce'), 75 ]; 76 77 $available_fields = [ 78 // Billing 79 'billing_address_1' => __('Billing Address 1', 'connect-plus-for-woocommerce'), 80 'billing_address_2' => __('Billing Address 2', 'connect-plus-for-woocommerce'), 81 'billing_city' => __('Billing City', 'connect-plus-for-woocommerce'), 82 'billing_state' => __('Billing State/County', 'connect-plus-for-woocommerce'), 83 84 // Shipping 85 'shipping_address_1' => __('Shipping Address 1', 'connect-plus-for-woocommerce'), 86 'shipping_address_2' => __('Shipping Address 2', 'connect-plus-for-woocommerce'), 87 'shipping_city' => __('Shipping City', 'connect-plus-for-woocommerce'), 88 'shipping_state' => __('Shipping State/County', 'connect-plus-for-woocommerce'), 89 ]; 90 91 92 $field_mapping = get_option('olivery_connect_field_mapping', []); 93 55 94 56 95 $available_gateways = WC()->payment_gateways->get_available_payment_gateways(); … … 173 212 174 213 <div class="connect-plus-settings-section"> 214 <h2><?php esc_html_e('Order Fields Mapping to Connect Plus', 'connect-plus-for-woocommerce'); ?></h2> 215 <p><?php esc_html_e('Map WooCommerce billing/shipping fields to required Connect Plus fields. Custom fields are supported.', 'connect-plus-for-woocommerce'); ?></p> 216 217 <table class="wp-list-table widefat fixed striped"> 218 <thead> 219 <tr> 220 <th><?php esc_html_e('Connect Fields', 'connect-plus-for-woocommerce'); ?></th> 221 <th><?php esc_html_e('WooCommerce Fields', 'connect-plus-for-woocommerce'); ?></th> 222 </tr> 223 </thead> 224 <tbody> 225 <?php foreach ($connect_fields as $connect_key => $label) : ?> 226 <?php 227 if (in_array($connect_key, ['customer_name'])) { 228 $field_group = $available_name_fields; 229 } elseif (in_array($connect_key, ['customer_mobile'])) { 230 $field_group = $available_phone_fields; 231 } 232 ?> 233 <tr> 234 <td><?php echo esc_html($label); ?></td> 235 <td> 236 <select name="olivery_connect_field_mapping[<?php echo esc_attr($connect_key); ?>]" class="regular-text"> 237 <option value=""><?php esc_html_e('-- Use Default Mapping Field --', 'connect-plus-for-woocommerce'); ?></option> 238 239 <?php 240 if (stripos($connect_key, 'name') !== false) : ?> 241 <?php foreach ($available_name_fields as $wc_key => $wc_label) : ?> 242 <option value="<?php echo esc_attr($wc_key); ?>" <?php selected($field_mapping[$connect_key] ?? '', $wc_key); ?>> 243 <?php echo esc_html($wc_label); ?> 244 </option> 245 <?php endforeach; ?> 246 247 <?php elseif (stripos($connect_key, 'mobile') !== false) : ?> 248 <?php foreach ($available_phone_fields as $wc_key => $wc_label) : ?> 249 <option value="<?php echo esc_attr($wc_key); ?>" <?php selected($field_mapping[$connect_key] ?? '', $wc_key); ?>> 250 <?php echo esc_html($wc_label); ?> 251 </option> 252 <?php endforeach; ?> 253 254 <?php else : ?> 255 <option value="" disabled>--- Billing Fields ---</option> 256 <?php foreach ($available_fields as $wc_key => $wc_label) : 257 if (strpos($wc_key, 'billing_') === 0) : ?> 258 <option value="<?php echo esc_attr($wc_key); ?>" <?php selected($field_mapping[$connect_key] ?? '', $wc_key); ?>> 259 <?php echo esc_html($wc_label); ?> 260 </option> 261 <?php endif; endforeach; ?> 262 263 <option value="" disabled>--- Shipping Fields ---</option> 264 <?php foreach ($available_fields as $wc_key => $wc_label) : 265 if (strpos($wc_key, 'shipping_') === 0) : ?> 266 <option value="<?php echo esc_attr($wc_key); ?>" <?php selected($field_mapping[$connect_key] ?? '', $wc_key); ?>> 267 <?php echo esc_html($wc_label); ?> 268 </option> 269 <?php endif; endforeach; ?> 270 <?php endif; ?> 271 </select> 272 </td> 273 </tr> 274 <?php endforeach; ?> 275 </tbody> 276 </table> 277 </div> 278 279 280 <div class="connect-plus-settings-section"> 175 281 <h2><?php esc_html_e('Delviery Status Mapping', 'connect-plus-for-woocommerce'); ?></h2> 176 282 <p><?php esc_html_e('Map Connect Plus delivery statuses to WooCommerce order statuses.', 'connect-plus-for-woocommerce'); ?></p> -
connect-plus-for-woocommerce/trunk/connect-plus-for-woocommerce.php
r3327337 r3329484 17 17 * Plugin URI: https://website.olivery.app/ 18 18 * Description: Plugin to help you connect WooCommerce with Connect Plus application 19 * Version: 1.0.2 519 * Version: 1.0.26 20 20 * Author: Olivery dev 21 21 * Text Domain: connect-plus-for-woocommerce … … 40 40 define('CPFW_PLUGIN_DIR', __DIR__); 41 41 42 define('PLUGIN_VERSION','1.0.2 5');42 define('PLUGIN_VERSION','1.0.26'); 43 43 /** 44 44 * The code that runs during plugin activation. -
connect-plus-for-woocommerce/trunk/includes/services/cpfw-connect-api.php
r3321453 r3329484 34 34 35 35 $cpfw_the_order = !is_object($cpfw_the_order) ? wc_get_order($cpfw_the_order) : $cpfw_the_order; 36 $cpfw_customer_area = $cpfw_customer_name = $cpfw_customer_phone = $cpfw_customer_postcode = "";36 $cpfw_customer_area = $cpfw_customer_name = $cpfw_customer_phone = $cpfw_customer_postcode = $cpfw_customer_sub_area = ""; 37 37 $cpfw_customer_address = []; 38 39 40 switch (true) { 41 case (bool) ($cpfw_temp = $this->cpfw_get_meta_key_from_option($cpfw_the_order, 'cpfw_customer_area', true)): 42 $cpfw_customer_area = $cpfw_temp; 43 break; 44 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_shipping_city())): 45 $cpfw_customer_area = $cpfw_temp; 46 break; 47 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_billing_city())) : 48 $cpfw_customer_area = $cpfw_temp; 49 break; 50 default: 51 $cpfw_customer_area ; 52 break; 53 } 54 55 switch (true) { 56 case (bool) ($cpfw_temp = preg_replace('/[^0-9]/', '', $this->cpfw_get_meta_key_from_option($cpfw_the_order, 'cpfw_customer_phone', true))): 57 $cpfw_customer_phone = $cpfw_temp; 58 break; 59 case (bool) ($cpfw_temp = preg_replace('/[^0-9]/', '', $cpfw_the_order->get_shipping_phone())): 60 $cpfw_customer_phone = $cpfw_temp; 61 break; 62 case (bool) ($cpfw_temp = preg_replace('/[^0-9]/', '', $cpfw_the_order->get_billing_phone())): 63 $cpfw_customer_phone = $cpfw_temp; 64 break; 65 default: 66 $cpfw_customer_phone; 67 break; 68 } 69 38 $field_mapping = get_option('olivery_connect_field_mapping', []); 39 40 // area 41 if (!empty($field_mapping['customer_area'])) { 42 $mapped_field = $field_mapping['customer_area']; 43 44 // Build method name: get_billing_city() 45 $getter = 'get_' . $mapped_field; 46 47 if (method_exists($cpfw_the_order, $getter)) { 48 $cpfw_customer_area = sanitize_text_field($cpfw_the_order->$getter()); 49 } 50 } 51 else{ 52 switch (true) { 53 case (bool) ($cpfw_temp = $this->cpfw_get_meta_key_from_option($cpfw_the_order, 'cpfw_customer_area', true)): 54 $cpfw_customer_area = $cpfw_temp; 55 break; 56 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_shipping_city())): 57 $cpfw_customer_area = $cpfw_temp; 58 break; 59 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_billing_city())) : 60 $cpfw_customer_area = $cpfw_temp; 61 break; 62 default: 63 $cpfw_customer_area ; 64 break; 65 } 66 } 67 68 // sub_area 69 if (!empty($field_mapping['customer_sub_area'])) { 70 $mapped_field = $field_mapping['customer_sub_area']; 71 $getter = 'get_' . $mapped_field; 72 if (method_exists($cpfw_the_order, $getter)) { 73 $cpfw_customer_sub_area = sanitize_text_field($cpfw_the_order->$getter()); 74 } 75 } 76 else{ 77 switch (true) { 78 case (bool) ($cpfw_temp = $this->cpfw_get_meta_key_from_option($cpfw_the_order, 'cpfw_customer_sub_area', true)): 79 $cpfw_customer_sub_area = $cpfw_temp; 80 break; 81 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_shipping_address_1() ?: $cpfw_the_order->get_shipping_address_2())): 82 $cpfw_customer_sub_area = $cpfw_temp; 83 break; 84 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_billing_address_1() ?: $cpfw_the_order->get_billing_address_2())): 85 $cpfw_customer_sub_area = $cpfw_temp; 86 break; 87 default: 88 $cpfw_customer_sub_area = '' ; 89 break; 90 } 91 } 92 93 // mobile 94 if (!empty($field_mapping['customer_mobile'])) { 95 $mapped_field = $field_mapping['customer_mobile']; 96 $getter = 'get_' . $mapped_field; 97 98 if (method_exists($cpfw_the_order, $getter)) { 99 $cpfw_customer_phone = preg_replace('/[^0-9]/', '', $cpfw_the_order->$getter()); 100 } 101 }else{ 102 switch (true) { 103 case (bool) ($cpfw_temp = preg_replace('/[^0-9]/', '', $this->cpfw_get_meta_key_from_option($cpfw_the_order, 'cpfw_customer_phone', true))): 104 $cpfw_customer_phone = $cpfw_temp; 105 break; 106 case (bool) ($cpfw_temp = preg_replace('/[^0-9]/', '', $cpfw_the_order->get_shipping_phone())): 107 $cpfw_customer_phone = $cpfw_temp; 108 break; 109 case (bool) ($cpfw_temp = preg_replace('/[^0-9]/', '', $cpfw_the_order->get_billing_phone())): 110 $cpfw_customer_phone = $cpfw_temp; 111 break; 112 default: 113 $cpfw_customer_phone; 114 break; 115 } 116 } 117 118 // address 70 119 if ($cpfw_temp = sanitize_text_field($this->cpfw_get_meta_key_from_option($cpfw_the_order, 'cpfw_customer_address', true))) { 71 120 $cpfw_customer_address = $cpfw_temp; … … 85 134 } 86 135 87 switch (true) { 88 case (bool) ($cpfw_temp = sanitize_text_field($this->cpfw_get_meta_key_from_option($cpfw_the_order, 'cpfw_customer_full_name', true))): 89 $cpfw_customer_name = $cpfw_temp; 90 break; 91 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_formatted_shipping_full_name())): 92 $cpfw_customer_name = $cpfw_temp; 93 break; 94 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_formatted_billing_full_name())): 95 $cpfw_customer_name = $cpfw_temp; 96 break; 97 default: 98 $cpfw_customer_name; 99 break; 100 } 101 136 // name 137 if (!empty($field_mapping['customer_name'])) { 138 switch ($field_mapping['customer_name']) { 139 case 'billing_name': 140 $cpfw_customer_name = sanitize_text_field($cpfw_the_order->get_formatted_billing_full_name()); 141 break; 142 case 'shipping_name': 143 $cpfw_customer_name = sanitize_text_field($cpfw_the_order->get_formatted_shipping_full_name()); 144 break; 145 } 146 } 147 else{ 148 switch (true) { 149 case (bool) ($cpfw_temp = sanitize_text_field($this->cpfw_get_meta_key_from_option($cpfw_the_order, 'cpfw_customer_full_name', true))): 150 $cpfw_customer_name = $cpfw_temp; 151 break; 152 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_formatted_shipping_full_name())): 153 $cpfw_customer_name = $cpfw_temp; 154 break; 155 case (bool) ($cpfw_temp = sanitize_text_field($cpfw_the_order->get_formatted_billing_full_name())): 156 $cpfw_customer_name = $cpfw_temp; 157 break; 158 default: 159 $cpfw_customer_name; 160 break; 161 } 162 } 163 164 // postcode 102 165 switch (true) { 103 166 case (bool) ($cpfw_temp = $this->cpfw_get_meta_key_from_option($cpfw_the_order, 'cpfw_customer_postcode', true)): … … 183 246 "customer_name": "' . sanitize_text_field($cpfw_customer_name) . '", 184 247 "area": "' .($cpfw_customer_area?:'').'", 185 "sub_area": "' . sanitize_text_field($cpfw_the_order->get_billing_address_1() ?: $cpfw_the_order->get_shipping_address_1()).'",248 "sub_area": "' .($cpfw_customer_sub_area?:'').'", 186 249 "country": "' .sanitize_text_field($cpfw_the_order->get_billing_country() ?: $cpfw_the_order->get_shipping_country()) . '", 187 250 "country_code": "", -
connect-plus-for-woocommerce/trunk/languages/connect-plus-for-woocommerce.pot
r3327337 r3329484 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Connect Plus for WooCommerce 1.0.2 5\n"5 "Project-Id-Version: Connect Plus for WooCommerce 1.0.26\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/connect-plus-for-woocommerce\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
Note: See TracChangeset
for help on using the changeset viewer.