Beispiel #1
0
 public function onDisplayListingsPage()
 {
     $this->check_wplister_setup();
     // handle actions
     $this->handleActions();
     // do we have new products with no profile yet?
     $selectedProducts = WPLE_ListingQueryHelper::selectedProducts();
     if ($selectedProducts) {
         $this->displayPrepareListingsPage($selectedProducts);
         // edit listing
     } elseif ($this->requestAction() == 'edit') {
         $this->displayEditPage();
         // show list
     } else {
         // show warning if duplicate products found
         $this->checkForDuplicates();
         // check for profile waiting to be applied
         $this->checkForDelayedProfiles();
         // get listing status summary
         $summary = WPLE_ListingQueryHelper::getStatusSummary();
         // check for changed items and display reminder
         if (isset($summary->changed) && current_user_can('publish_ebay_listings')) {
             $msg = '<p>';
             $msg .= sprintf(__('There are %s changed item(s) which need to be revised on eBay to apply their latest changes.', 'wplister'), $summary->changed);
             // $msg .= '<br><br>';
             $msg .= '&nbsp;&nbsp;';
             $msg .= '<a id="btn_revise_all_changed_items_reminder" class="btn_revise_all_changed_items_reminder button wpl_job_button">' . __('Revise all changed items', 'wplister') . '</a>';
             $msg .= '</p>';
             $this->showMessage($msg);
         }
         // check for items to be relisted and display message
         $listing_status = isset($_REQUEST['listing_status']) ? $_REQUEST['listing_status'] : false;
         if (isset($summary->relist) && current_user_can('publish_ebay_listings') && $listing_status == 'relist') {
             $msg = '<p>';
             $msg .= sprintf(__('There are %s items which are currently ended on eBay, but are in stock on your website and can be relisted.', 'wplister'), $summary->relist);
             // $msg .= '<br><br>';
             $msg .= '&nbsp;&nbsp;';
             $msg .= '<a id="btn_relist_all_restocked_items" class="btn_relist_all_restocked_items button wpl_job_button">' . __('Relist all restocked items', 'wplister') . '</a>';
             $msg .= '</p>';
             $this->showMessage($msg);
         }
         // check for relisted items and display reminder
         if (isset($summary->relisted)) {
             $msg = '<p>';
             $msg .= sprintf(__('There are %s manually relisted item(s) which need to be updated from eBay to fetch their latest changes.', 'wplister'), $summary->relisted);
             $msg .= '&nbsp;&nbsp;';
             $msg .= '<a id="btn_update_all_relisted_items_reminder" class="btn_update_all_relisted_items_reminder button wpl_job_button">' . __('Update all relisted items', 'wplister') . '</a>';
             $msg .= '</p>';
             $this->showMessage($msg, 2);
         }
         // get all items
         // $listings = WPLE_ListingQueryHelper::getAll();
         //Create an instance of our package class...
         // $this->listingsTable = new ListingsTable();
         //Fetch, prepare, sort, and filter our data...
         $this->listingsTable->prepare_items();
         $aData = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'listingsTable' => $this->listingsTable, 'preview_html' => isset($preview_html) ? $preview_html : '', 'form_action' => 'admin.php?page=' . self::ParentMenuId);
         $this->display('listings_page', $aData);
     }
 }