Ejemplo n.º 1
0
 public function showNotifications()
 {
     // get listing status summary
     $summary = WPLA_ListingsModel::getStatusSummary();
     // check for prepared items and display info
     if (isset($summary->prepared)) {
         // $next_schedule = $this->print_schedule_info( 'wpla_update_schedule' );
         // $msg  = '<p>';
         // $msg .= sprintf( __('%d %s product(s) will be submitted to Amazon %s.','wpla'), $summary->prepared, 'prepared', $next_schedule );
         // $msg .= '&nbsp;&nbsp;';
         // $msg .= '<a href="admin.php?page=wpla&listing_status=prepared" id="" class="button button-small wpl_job_button">' . __('Show products','wpla') . '</a>';
         // $msg .= '&nbsp;&nbsp;';
         // $msg .= '<a href="admin.php?page=wpla-feeds&action=submit_pending_feeds_to_amazon" id="" class="button button-small wpl_job_button">' . __('Submit pending feeds','wpla') . '</a>';
         // $msg .= '</p>';
         // $this->showMessage( $msg );
         // check prepared products for problems
         $problems = WPLA_FeedValidator::checkPreparedProducts();
         if ($problems) {
             $this->showMessage($problems, 1);
         }
     }
     // check for changed, matched and prepared items - and show message
     $is_feed_page = isset($_GET['page']) && $_GET['page'] == 'wpla-feeds';
     if (isset($summary->changed) || isset($summary->prepared) || isset($summary->matched)) {
         $next_schedule = $this->print_schedule_info('wpla_update_schedule');
         // build nice combined message
         $summary_msg = '';
         $summary_array = array();
         foreach (array('changed', 'prepared', 'matched') as $status) {
             if (!isset($summary->{$status})) {
                 continue;
             }
             $link_url = 'admin.php?page=wpla&listing_status=' . $status;
             $link_title = $summary->{$status} . ' ' . $status;
             $summary_array[] = '<a href="' . $link_url . '">' . $link_title . '</a>';
         }
         $summary_msg = join(' and ', $summary_array);
         $msg = '<p>';
         $msg .= sprintf(__('%s product(s) will be submitted to Amazon %s.', 'wpla'), $summary_msg, $next_schedule);
         $msg .= '&nbsp;&nbsp;';
         if ($is_feed_page) {
             $msg .= '<a href="admin.php?page=wpla-feeds&action=submit_pending_feeds_to_amazon" id="" class="button button-small wpl_job_button">' . __('Submit pending feeds', 'wpla') . '</a>';
         } else {
             $msg .= '<a href="admin.php?page=wpla-feeds" id="" class="button button-small wpl_job_button">' . __('Visit feeds', 'wpla') . '</a>';
         }
         $msg .= '</p>';
         $this->showMessage($msg);
     }
 }
 public function showNotifications()
 {
     self::checkForDeletedProducts();
     // get listing status summary
     $listingsModel = new WPLA_ListingsModel();
     $summary = WPLA_ListingsModel::getStatusSummary();
     $no_asin = $listingsModel->getAllOnlineWithoutASIN();
     // check for changed, matched and prepared items - and show message
     $is_feed_page = isset($_GET['page']) && $_GET['page'] == 'wpla-feeds';
     if (isset($summary->changed) || isset($summary->prepared) || isset($summary->matched)) {
         $next_schedule = $this->print_schedule_info('wpla_update_schedule');
         // build nice combined message
         $summary_msg = '';
         $summary_array = array();
         foreach (array('changed', 'prepared', 'matched') as $status) {
             if (!isset($summary->{$status})) {
                 continue;
             }
             $link_url = 'admin.php?page=wpla&listing_status=' . $status;
             $link_title = $summary->{$status} . ' ' . $status;
             $summary_array[] = '<a href="' . $link_url . '">' . $link_title . '</a>';
         }
         $summary_msg = join(' and ', $summary_array);
         $msg = '<p>';
         $msg .= sprintf(__('%s product(s) will be submitted to Amazon %s.', 'wpla'), $summary_msg, $next_schedule);
         $msg .= '&nbsp;&nbsp;';
         if ($is_feed_page) {
             $msg .= '<a href="admin.php?page=wpla-feeds&action=submit_pending_feeds_to_amazon" id="" class="button button-small wpl_job_button">' . __('Submit pending feeds', 'wpla') . '</a>';
         } else {
             $msg .= '<a href="admin.php?page=wpla-feeds" id="" class="button button-small wpl_job_button">' . __('Visit feeds', 'wpla') . '</a>';
         }
         $msg .= '</p>';
         $this->showMessage($msg);
     }
     // check for prepared items and display info
     if (isset($summary->prepared)) {
         // $next_schedule = $this->print_schedule_info( 'wpla_update_schedule' );
         // $msg  = '<p>';
         // $msg .= sprintf( __('%d %s product(s) will be submitted to Amazon %s.','wpla'), $summary->prepared, 'prepared', $next_schedule );
         // $msg .= '&nbsp;&nbsp;';
         // $msg .= '<a href="admin.php?page=wpla&listing_status=prepared" id="" class="button button-small wpl_job_button">' . __('Show products','wpla') . '</a>';
         // $msg .= '&nbsp;&nbsp;';
         // $msg .= '<a href="admin.php?page=wpla-feeds" id="" class="button button-small wpl_job_button">' . __('Visit feeds','wpla') . '</a>';
         // $msg .= '</p>';
         // $this->showMessage( $msg );
         // check prepared products for problems
         $problems = WPLA_FeedValidator::checkPreparedProducts();
         if ($problems) {
             $this->showMessage($problems, 1);
         }
     }
     // check changed products for problems
     if (isset($summary->changed)) {
         $problems = WPLA_FeedValidator::checkChangedProducts();
         if ($problems) {
             $this->showMessage($problems, 1);
         }
     }
     // check for new online items without ASIN
     if (sizeof($no_asin)) {
         $msg = '<p>';
         $msg .= sprintf(__('There are %s newly added product(s) which need to be updated from Amazon.', 'wpla'), sizeof($no_asin));
         $msg .= '&nbsp;&nbsp;';
         $msg .= '<a id="btn_batch_update_no_asin" class="btn_batch_update_no_asin button button-primary button-small wpl_job_button">' . __('Update products', 'wpla') . '</a>';
         $msg .= '&nbsp;&nbsp;';
         $msg .= '<a href="admin.php?page=wpla&listing_status=no_asin" id="" class="button button-small wpl_job_button">' . __('Show products', 'wpla') . '</a>';
         $msg .= '<br><!br>';
         $msg .= '<small>This step is required to fetch the ASIN and other details that were assigned by Amazon when the product was created.</small>';
         $msg .= '</p>';
         $this->showMessage($msg);
     }
     // check for imported items and display reminder
     $dismiss_imported_products_notice = self::getOption('dismiss_imported_products_notice');
     $is_imported_page = isset($_GET['listing_status']) && $_GET['listing_status'] == 'imported';
     if ($is_imported_page) {
         $dismiss_imported_products_notice = false;
     }
     if (isset($summary->imported) && !$dismiss_imported_products_notice) {
         $msg = '<p>';
         $msg .= sprintf(__('There are %s imported item(s) which can be created in WooCommerce.', 'wpla'), $summary->imported);
         $msg .= '&nbsp;&nbsp;';
         $msg .= '<a id="btn_batch_create_products_reminder" class="button button-primary button-small wpl_job_button">' . __('Create products', 'wpla') . '</a>';
         if (!$is_imported_page) {
             $msg .= '&nbsp;&nbsp;';
             $msg .= '<a href="admin.php?page=wpla&action=wpla_dismiss_imported_products_notice" class="button button-small wpl_job_button">' . __('Dismiss', 'wpla') . '</a>';
         }
         $msg .= '<br>';
         $msg .= '<small>';
         $msg .= __('If a product with a matching SKU exists in WooCommerce it will be linked to the product on Amazon.', 'wpla');
         $msg .= '</small>';
         $msg .= '</p>';
         $this->showMessage($msg);
     }
 }