Changeset 3017107
- Timestamp:
- 01/03/2024 04:13:56 PM (2 years ago)
- Location:
- makecommerce/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (2 diffs)
-
makecommerce.php (modified) (2 diffs)
-
payment/gateway/woocommerce/woocommerce.php (modified) (1 diff)
-
payment/payment.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
makecommerce/trunk/README.txt
r3013223 r3017107 4 4 Requires at least: 5.6.1 5 5 Tested up to: 6.3.2 6 Stable tag: 3.4. 16 Stable tag: 3.4.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 80 80 81 81 == Changelog == 82 83 = 3.4.2 2024-01-03 = 84 * Fix - Orders with wrong or missing transaction ids 82 85 83 86 = 3.4.1 2023-12-22 = -
makecommerce/trunk/makecommerce.php
r3013223 r3017107 10 10 * Plugin URI: https://makecommerce.net/ 11 11 * Description: Adds MakeCommerce payment gateway and Itella/Omniva/DPD parcel machine shipping methods to WooCommerce checkout 12 * Version: 3.4. 112 * Version: 3.4.2 13 13 * Author: Maksekeskus AS 14 14 * Author URI: https://makecommerce.net/ … … 32 32 * Start at version 3.0.0 and use SemVer - https://semver.org 33 33 */ 34 define( 'MAKECOMMERCE_VERSION', '3.4. 1' );34 define( 'MAKECOMMERCE_VERSION', '3.4.2' ); 35 35 define( 'MAKECOMMERCE_PLUGIN_ID', 'makecommerce' ); 36 36 -
makecommerce/trunk/payment/gateway/woocommerce/woocommerce.php
r3013223 r3017107 14 14 15 15 public $id = MAKECOMMERCE_PLUGIN_ID; 16 public $version = '3.4. 1';16 public $version = '3.4.2'; 17 17 18 18 public $payment_return_url; -
makecommerce/trunk/payment/payment.php
r3012381 r3017107 13 13 namespace MakeCommerce; 14 14 15 use Automattic\WooCommerce\Utilities\OrderUtil; 15 16 /** 16 17 * The payment functionality of the plugin. … … 205 206 206 207 // if we didn't find reference to an Order, we send user to shop landing-page. TODO: could be improved 207 if ( !$transactionId) {208 if ( empty( $transactionId ) ) { 208 209 return $returnUrl; 209 210 } … … 212 213 $orderId = self::get_postid_using_metakey( '_makecommerce_transaction_id', $transactionId ); 213 214 214 //still nothing. Lets try matching _order_number (SCO doesnt seem to have transaction id, transaction is created via SCO instead)215 if ( $orderId == null ) {216 $orderId = self::get_postid_using_metakey( '_order_number', $reference );217 }218 219 //try using reference as orderId220 if ( !$orderId ) {221 $orderId = $reference;222 }223 224 215 $order = wc_get_order( $orderId ); 225 216 226 217 // if we didn't find the Order, we send user to shop landing-page. TODO: could be improved 227 if ( !$order ->get_id() ) {218 if ( !$order || !$order->get_id() ) { 228 219 return $returnUrl; 229 220 } … … 324 315 */ 325 316 public static function get_postid_using_metakey( $meta_key, $transactionId ) { 326 327 $orders = wc_get_orders( 328 [ 329 'meta_query' => [ 330 [ 331 'meta_key' => $meta_key, 332 'meta_value' => $transactionId 333 ] 334 ] 335 ] 336 ); 337 338 foreach ( $orders as $order ) { 339 $id = $order->get_id(); 340 if ( isset( $id ) ) { 341 return $id; 317 global $wpdb; 318 319 if ( OrderUtil::custom_orders_table_usage_is_enabled() ) { 320 // HPOS 321 $results = $wpdb->get_results( 322 $wpdb->prepare(" 323 SELECT wp_wc_orders.id 324 FROM wp_wc_orders 325 INNER JOIN wp_wc_orders_meta AS meta ON meta.order_id = wp_wc_orders.id AND meta.meta_key = %s 326 WHERE meta.meta_value = %s 327 ", 328 $meta_key, 329 $transactionId 330 ) 331 ); 332 333 if ( isset( $results[0]->id ) ) { 334 return $results[0]->id; 335 } 336 } else { 337 // Legacy DB 338 $wpdb->query("SELECT `post_id` FROM $wpdb->postmeta WHERE `meta_key` = '". $meta_key ."' AND `meta_value` = '" . $transactionId . "'"); 339 340 if ( isset( $wpdb->last_result[0]->post_id ) ) { 341 return $wpdb->last_result[0]->post_id; 342 342 } 343 343 }
Note: See TracChangeset
for help on using the changeset viewer.