?> </td> --> <td> <?php echo $report->CompletedDate; ?> <br> <span style="color:silver"> <?php echo human_time_diff(strtotime($report->CompletedDate), time()); ?> ago </span> </td> <td><?php echo WPLA_AmazonAccount::getAccountTitle($report->account_id); ?> </td> <td> <a href="admin.php?page=wpla-reports&action=view_amazon_report_details&amazon_report=<?php echo $report->id; ?> " target="_blank"> <?php echo intval($report->line_count) - 1; ?> rows </a> </td> <td> <a href="admin.php?page=wpla-import&mode=inventory&report_id=<?php
public function renderDupeTable($listings, $column = 'post_id') { if (empty($listings)) { return ''; } // get current page with paging as url param $page = $_REQUEST['page']; if (isset($_REQUEST['paged'])) { $page .= '&paged=' . $_REQUEST['paged']; } $listingsModel = new WPLA_ListingsModel(); $msg = ''; foreach ($listings as $dupe) { $account_title = WPLA_AmazonAccount::getAccountTitle($dupe->account_id); $msg .= '<b>' . __('Listings for', 'wpla') . ' ' . strtoupper($column) . ' ' . $dupe->{$column} . ' (' . $account_title . '):</b>'; $msg .= '<br>'; $duplicateListings = $listingsModel->findAllListingsByColumn($dupe->{$column}, $column, $dupe->account_id); $msg .= '<table style="width:100%">'; foreach ($duplicateListings as $listing) { $color = $listing->status == 'archived' ? 'silver' : ''; // check if WooCommerce SKU matches Amazon SKU $woo_sku = get_post_meta($listing->post_id, '_sku', true); $sku_label = $listing->sku == $woo_sku ? $woo_sku : '<span style="color:darkred">' . $woo_sku . ' / ' . $listing->sku . '</span>'; $msg .= '<tr><td style="width:40%;">'; $msg .= '<span style="color:' . $color . '">'; $msg .= $listing->listing_title; $msg .= '</span>'; $msg .= '</td><td style="width:10%;">'; $msg .= '<i style="color:silver">' . $listing->product_type . '</i>'; $msg .= '</td><td style="width:10%;">'; $msg .= '<a href="admin.php?page=wpla&s=' . $listing->sku . '" title="SKU" target="_blank">'; $msg .= $sku_label . '</a>'; $msg .= '</td><td style="width:10%;">'; $msg .= '<a href="admin.php?page=wpla&s=' . $listing->asin . '" title="ASIN" target="_blank">'; $msg .= $listing->asin . '</a>'; $msg .= '</td><td style="width:10%;">'; $msg .= '<a href="admin.php?page=wpla&s=' . $listing->post_id . '" title="Product ID" target="_blank">'; $msg .= 'ID ' . $listing->post_id . '</a>'; $msg .= '</td><td style="width:10%;">'; $msg .= '<i>' . $listing->status . '</i>'; // if ( in_array( $listing->status, array( 'prepared', 'verified', 'ended', 'sold' ) ) ) { // $archive_link = sprintf('<a class="archive button button-small" href="?page=%s&action=%s&listing=%s">%s</a>',$page,'archive',$listing->id,__('Click to move to archive','wpla')); // $msg .= ' '.$archive_link; // $msg .= '<br>'; // } $msg .= '</td><td align="right" style="width:10%;">'; $delete_btn = sprintf('<a class="delete button button-small button-secondary" href="?page=%s&action=%s&listing=%s">%s</a>', $page, 'delete', $listing->id, __('Remove from database', 'wpla')); $msg .= $delete_btn; $msg .= '</td></tr>'; } $msg .= '</table>'; $msg .= '<br>'; } return $msg; }