function displayMessageRow($item) { $listing_title = ''; // show errors and warning on online and failed items if (in_array($item['status'], array('online', 'failed'))) { $history = maybe_unserialize($item['history']); $tips_errors = array(); $tips_warnings = array(); if (is_array($history)) { foreach ($history['errors'] as $feed_error) { $tips_errors[] = WPLA_FeedValidator::formatAmazonFeedError($feed_error); } foreach ($history['warnings'] as $feed_error) { $tips_warnings[] = WPLA_FeedValidator::formatAmazonFeedError($feed_error); } } if (!empty($tips_errors)) { $listing_title .= '<!br><small style="color:darkred">' . join('<br>', $tips_errors) . '</small><br>'; } if (!empty($tips_warnings)) { $listing_title .= '<small><!br><a href="#" onclick="jQuery(\'#warnings_container_' . $item['id'] . '\').slideToggle();return false;">» ' . '' . sizeof($tips_warnings) . ' warning(s)' . '</a></small><br>'; $listing_title .= '<div id="warnings_container_' . $item['id'] . '" style="display:none">'; $listing_title .= '<small>' . join('<br>', $tips_warnings) . '</small>'; $listing_title .= '</div>'; } } // show listing quality issues on online and changed items if (in_array($item['status'], array('online', 'changed', 'prepared'))) { $quality_info = maybe_unserialize($item['quality_info']); if (is_array($quality_info)) { $error_msg = '<b>' . $quality_info['alert-type'] . '</b>'; $error_msg .= '<br>' . $quality_info['explanation'] . ''; $error_msg .= '<br>' . $quality_info['field-name'] . ': ' . $quality_info['current-value'] . ' '; $error_msg .= '<br>Status: ' . $quality_info['alert-name'] . ' (' . $quality_info['status'] . ')'; $error_msg = WPLA_FeedValidator::convert_links($error_msg); $listing_title .= '<small style="color:darkred">' . $error_msg . '</small><br>'; } } if (empty($listing_title)) { return; } echo '</tr>'; echo '<tr>'; // echo '<td colspan="'.sizeof( $this->_column_headers[0] ).'">'; echo '<td> </td>'; echo '<td class="wpla_auto_width_column" colspan="7">'; echo $listing_title; echo '</td>'; echo '<td> </td>'; }
function wpla_order_admin_notices() { global $post, $post_ID; if (!$post) { return; } if (!$post_ID) { return; } if (!$post->post_type == 'shop_order') { return; } $errors_msg = ''; // check for problems with FBA / MCF submission // show errors and warning on failed items only $submission_status = get_post_meta($post->ID, '_wpla_fba_submission_status', true); if (!in_array($submission_status, array('failed'))) { return; } // parse result $submission_result = maybe_unserialize(get_post_meta($post->ID, '_wpla_fba_submission_result', true)); if (empty($submission_result)) { return; } // echo "<pre>";print_r($submission_result);echo"</pre>";#die(); $history = $submission_result; // process errors and warnings $tips_errors = array(); $tips_warnings = array(); if (is_array($history)) { foreach ($history['errors'] as $feed_error) { $tips_errors[] = WPLA_FeedValidator::formatAmazonFeedError($feed_error); } foreach ($history['warnings'] as $feed_error) { $tips_warnings[] = WPLA_FeedValidator::formatAmazonFeedError($feed_error); } } if (!empty($tips_errors)) { $errors_msg .= 'Amazon returned the following error(s) when this order was submitted to be fulfilled via FBA.' . '<br>'; $errors_msg .= '<small style="color:darkred">' . join('<br>', $tips_errors) . '</small>'; } if ($errors_msg) { self::showMessage($errors_msg, 1, 1); } }