/** ************************************************************************ * Recommended. This is a custom column method and is responsible for what * is rendered in any column with a name/slug of 'title'. Every time the class * needs to render a column, it first looks for a method named * column_{$column_title} - if it exists, that method is run. If it doesn't * exist, column_default() is called instead. * * This example also illustrates how to implement rollover actions. Actions * should be an associative array formatted as 'slug'=>'link html' - and you * will need to generate the URLs yourself. You could even ensure the links * * * @see WP_List_Table::::single_row_columns() * @param array $item A singular item (one full row's worth of data) * @return string Text to be placed inside the column <td> (profile title only) **************************************************************************/ function column_auction_title($item) { // get current page with paging as url param $page = $_REQUEST['page']; if (isset($_REQUEST['paged'])) { $page .= '&paged=' . $_REQUEST['paged']; } if (isset($_REQUEST['s'])) { $page .= '&s=' . urlencode($_REQUEST['s']); } if (isset($_REQUEST['listing_status'])) { $page .= '&listing_status=' . $_REQUEST['listing_status']; } // handle preview target $preview_target = get_option('wplister_preview_in_new_tab') == 1 ? '_blank' : '_self'; $preview_class = get_option('wplister_preview_in_new_tab') == 1 ? '' : 'thickbox'; //Build row actions $actions = array('preview_auction' => sprintf('<a href="?page=%s&action=%s&auction=%s&width=820&height=550&TB_iframe=true" target="%s" class="%s">%s</a>', $page, 'preview_auction', $item['id'], $preview_target, $preview_class, __('Preview', 'wplister')), 'edit' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'edit', $item['id'], __('Edit', 'wplister')), 'lock' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'lock', $item['id'], __('Lock', 'wplister')), 'unlock' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'unlock', $item['id'], __('Unlock', 'wplister')), 'verify' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'verify', $item['id'], __('Verify', 'wplister')), 'publish2e' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'publish2e', $item['id'], __('Publish', 'wplister')), 'open' => sprintf('<a href="%s" target="_blank">%s</a>', $item['ViewItemURL'], __('View on eBay', 'wplister')), 'revise' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'revise', $item['id'], __('Revise', 'wplister')), 'end_item' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'end_item', $item['id'], __('End Listing', 'wplister')), 'relist' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'relist', $item['id'], __('Relist', 'wplister')), 'update' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'update', $item['id'], __('Update from eBay', 'wplister')), 'delete' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'delete_listing', $item['id'], __('Delete', 'wplister')), 'archive' => sprintf('<a href="?page=%s&action=%s&auction=%s">%s</a>', $page, 'archive', $item['id'], __('Archive', 'wplister'))); $profile_data = $this->getProfileData($item); $listing_title = $item['auction_title']; // limit item title to 80 characters if (ListingsModel::mb_strlen($listing_title) > 80) { $listing_title = ListingsModel::mb_substr($listing_title, 0, 77) . '...'; } // make title link to products edit page $post_id = @$item['parent_id'] ? $item['parent_id'] : $item['post_id']; $listing_title = '<a class="product_title_link" href="post.php?post=' . $post_id . '&action=edit">' . $listing_title . '</a>'; // show single (split) variation indicator if (@$item['parent_id'] > 0) { $tip_msg = 'This is a single split variation.'; $img_url = WPLISTER_URL . '/img/info.png'; $listing_title .= ' <img src="' . $img_url . '" style="height:11px; padding:0;" class="tips" data-tip="' . $tip_msg . '"/> '; } // show locked indicator if (@$item['locked']) { $tip_msg = 'This listing is currently locked.<br>Only inventory changes and prices will be updated, other changes will be ignored.<br><br>(Except for variable products where not all variations have a unique SKU, or when new variations are added. In these cases, the item will be revised in full.)'; $img_url = WPLISTER_URL . '/img/lock-1.png'; $listing_title .= ' <img src="' . $img_url . '" style="height:11px; padding:0;" class="tips" data-tip="' . $tip_msg . '"/> '; } // show warning if GetItem seems to have failed $needs_update = false; if ($item['ebay_id']) { if ($item['ViewItemURL'] == '' || $item['details'] == '') { // add warning message $tip_msg = 'There seems to be something wrong with this listing. Please click the <i>Update from eBay</i> link below to fetch the current details from eBay.'; $img_url = WPLISTER_URL . '/img/error.gif'; $listing_title .= ' <img src="' . $img_url . '" style="height:12px; padding:0;" class="tips" data-tip="' . $tip_msg . '"/> '; // remove View on eBay ink unset($actions['open']); $needs_update = true; } } // hide View on eBay link when there is no ebay_id and no ViewItemURL if (empty($item['ebay_id']) && empty($item['ViewItemURL'])) { unset($actions['open']); } // show warning if WooCommerce product has been deleted if (!ProductWrapper::getProduct($item['post_id']) && $item['status'] != 'archived') { $tip_msg = 'This product has been deleted!<br>Please do <i>not</i> delete products - unless you plan to archive the listing as well.'; $img_url = WPLISTER_URL . '/img/error.gif'; $listing_title .= ' <img src="' . $img_url . '" style="height:12px; padding:0;" class="tips" data-tip="' . $tip_msg . '"/> '; $listing_title = str_replace('product_title_link', 'missing_product_title_link', $listing_title); } // add variations link $listing_title .= $this->generateVariationsHtmlLink($item, $profile_data); // check if item is scheduled for auto relist $listing_title .= $this->generateAutoRelistInfo($item, $profile_data); /* // show errors and warnings on published and prepared items if ( in_array( $item['status'], array( 'published','changed','prepared','verified' ) ) ) { $history = maybe_unserialize( $item['last_errors'] ); $tips_errors = array(); $tips_warnings = array(); if ( is_array( $history ) ) { foreach ($history['errors'] as $result) { $tips_errors[] = '<b>'.$result->SeverityCode.':</b> '.$result->ShortMessage.' ('.$result->ErrorCode.')'; } foreach ($history['warnings'] as $result) { // hide redundant warnings like: // 21917091 - Warning: Requested StartPrice and Quantity revision is redundant // 21917092 - Warning: Requested Quantity revision is redundant. // 21916620 - Warning: Variations with quantity '0' will be removed if ( in_array( $result->ErrorCode, array( 21917091, 21917092, 21916620 ) ) ) continue; $tips_warnings[] = '<b>'.$result->SeverityCode.':</b> '.$result->ShortMessage.' ('.$result->ErrorCode.')'; } } if ( ! empty( $tips_errors ) ) { $listing_title .= '<br><small style="color:darkred">'.join('<br>',$tips_errors).'</small>'; } 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>'; $listing_title .= '<div id="warnings_container_'.$item['id'].'" style="display:none">'; $listing_title .= '<small>'.join('<br>',$tips_warnings).'</small>'; $listing_title .= '</div>'; } } */ // disable some actions depending on status if ($item['status'] != 'published') { unset($actions['lock']); } if ($item['status'] != 'published') { unset($actions['end_item']); } if ($item['status'] != 'prepared') { unset($actions['verify']); } if ($item['status'] != 'changed') { unset($actions['revise']); } if ($item['status'] != 'prepared' && $item['status'] != 'verified') { unset($actions['publish2e']); } if ($item['status'] != 'published' && $item['status'] != 'changed' && $item['status'] != 'ended') { unset($actions['open']); } // if ( $item['status'] == 'ended' ) unset( $actions['preview_auction'] ); // uncomment for debugging if ($item['status'] != 'ended') { unset($actions['archive']); } if ($item['status'] != 'archived') { unset($actions['delete']); } if ($item['status'] != 'sold' && $item['status'] != 'ended') { unset($actions['relist']); } if ($item['status'] != 'relisted' && $needs_update == false) { unset($actions['update']); } if ($item['locked']) { unset($actions['lock']); } if ($item['locked']) { unset($actions['edit']); } if (!$item['locked']) { unset($actions['unlock']); } // make edit listing link only available to developers if (!get_option('wplister_enable_item_edit_link')) { unset($actions['edit']); if ($item['status'] == 'ended') { unset($actions['preview_auction']); } // developer may preview ended items } if (!current_user_can('publish_ebay_listings')) { unset($actions['publish2e']); unset($actions['revise']); unset($actions['end_item']); unset($actions['relist']); unset($actions['delete']); } //Return the title contents //return sprintf('%1$s <span style="color:silver">%2$s</span>%3$s', return sprintf('%1$s %2$s', $listing_title, $this->row_actions($actions)); }