public function checkTransactions($show_message = false) { $om = new EbayOrdersModel(); $tm = new TransactionsModel(); $orders = $om->getAll(); // echo "<pre>";print_r($orders);echo"</pre>";#die(); $created_transactions = 0; $pending_orders = 0; // loop orders foreach ($orders as $order) { $order_details = $om->decodeObject($order['details'], false, true); // echo "<pre>";print_r($order_details);echo"</pre>";#die(); // skip if this order has been processed already if ($tm->getTransactionByEbayOrderID($order['order_id'])) { continue; } // limit processing to 500 orders at a time if ($created_transactions >= 500) { $pending_orders++; continue; } // loop transactions $transactions = $order_details->TransactionArray; foreach ($transactions as $Transaction) { // echo "<pre>";print_r($Transaction->TransactionID);echo"</pre>";#die(); // $transaction_id = $Transaction->TransactionID; // create transaction $txn_id = $tm->createTransactionFromEbayOrder($order, $Transaction); // echo "<pre>created transaction ";print_r($Transaction->TransactionID);echo"</pre>";#die(); $created_transactions++; } } $msg = $created_transactions . ' transactions were created.<br><br>'; if ($pending_orders) { $msg .= 'There are ' . $pending_orders . ' more orders to process. Please run this check again until all orders have been processed.'; } else { $msg .= 'Please visit the <a href="admin.php?page=wplister-transactions">Transactions</a> page to check for duplicates.'; } if ($show_message) { $this->showMessage($msg); } // return number of orders which still need to be processed return $pending_orders; }