Chris the OP ответил на этот вопрос, но только для того, чтобы добавить дополнительную ценность этому Q & Вот код, который у меня есть.
Как некоторый фон, причина, по которой я использую идентификаторы транзакций, заключается в том, что они используются Paypal. Я пишу задание cron, которое вытягивает заказы Paypal из API Paypal за предыдущие 24 часа, затем мы вытягиваем все заказы от Magento через SOAP в течение предыдущих 24 часов, получаем идентификаторы транзакций и сопоставляем их с списком Paypal. Чтобы убедиться, что нет заказов Paypal, которые не входят в Magento, иногда мы получаем отказ IPN, который предотвращает преобразование котировок Magento в заказы, и клиент получает счет в Paypal, но продукт не отправляется, поскольку заказ никогда не создается. Если есть несоответствие, оповещение по электронной почте отправляется в службы поддержки клиентов.
$startDate = gmdate('Y-m-d H:i:s', strtotime('-1 day', time()));
$complex_params =array(
array('key'=>'created_at','value'=>array('key' =>'from','value' => $startDate))
);
$result = $client_v2->salesOrderList($session_id, array('complex_filter' => $complex_params));
// We've got all the orders, now we need to run through them and get the transaction id from the order info
// We create an array just to hold the transaction Ids
$ikoTransactionIds = array();
foreach ($result as $invoice) {
$invoiceInfo = $client_v2->salesOrderInfo($session_id, $invoice->increment_id);
$history = $invoiceInfo->status_history;
$comments = $history[0]->comment;
// Only the Paypal based records have transaction Ids in the comments, orders placed via credit card do not. In these cases $comments are null
if ($comments) {
// Check if the text 'Transaction ID:' exists at all
if ((strpos($comments, "Transaction ID:")) !== FALSE) {
list($before, $transactionId) = explode('Transaction ID: ', $comments);
// Remove the trailing period
$transactionId = rtrim($transactionId ,".");
// Remove the quotes
$transactionId = str_replace('"', '', $transactionId);
// We add the id to our array of ids for this Magento install
$ikoTransactionIds[] = $transactionId;
}
}
}
+1 Спасибо за указатель. Абсолютно смешно, что нам нужно выкопать идентификатор транзакции для заказа из комментариев в истории заказа клиента. – McNab