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 .= ' '; // $msg .= '<a href="admin.php?page=wpla&listing_status=prepared" id="" class="button button-small wpl_job_button">' . __('Show products','wpla') . '</a>'; // $msg .= ' '; // $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 .= ' '; 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 displayPreviewImportPage($step) { // analyse report content $report = new WPLA_AmazonReport($_REQUEST['report_id']); $account = new WPLA_AmazonAccount($report->account_id); $report_summary = WPLA_ImportHelper::analyzeReportForPreview($report); $status_summary = WPLA_ListingsModel::getStatusSummary(); // skip step 3 if no products are to be imported // if ( $step == 3 && count($report_summary->products_to_import) == 0 ) { if ($step == 3 && intval(@$status_summary->imported) == 0) { return $this->displayFinishedImportPage(); } $aData = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'step' => $step, 'report_summary' => $report_summary, 'status_summary' => $status_summary, 'account' => $account, 'report_id' => $report->id, 'data_rows' => $report->get_data_rows(), 'reports_update_woo_stock' => get_option('wpla_reports_update_woo_stock', 1), 'reports_update_woo_price' => get_option('wpla_reports_update_woo_price', 1), 'reports_update_woo_condition' => get_option('wpla_reports_update_woo_condition', 1), 'form_action' => 'admin.php?page=' . self::ParentMenuId . '-import'); $this->display('import/preview_import_page', $aData); }
function get_views() { $views = array(); $current_listing_status = !empty($_REQUEST['listing_status']) ? $_REQUEST['listing_status'] : 'all'; $current_stock_status = !empty($_REQUEST['stock_status']) ? $_REQUEST['stock_status'] : 'all'; $current_fba_status = !empty($_REQUEST['fba_status']) ? $_REQUEST['fba_status'] : 'all'; // $base_url = remove_query_arg( array( 'action', 'listing', 'listing_status' ) ); $base_url = esc_url_raw(remove_query_arg(array('action', 'listing'))); // handle search query if (isset($_REQUEST['s']) && $_REQUEST['s']) { $base_url = add_query_arg('s', $_REQUEST['s'], $base_url); } // handle profile_id query if (isset($_REQUEST['profile_id']) && $_REQUEST['profile_id']) { $base_url = add_query_arg('profile_id', $_REQUEST['profile_id'], $base_url); } // handle account_id query if (isset($_REQUEST['account_id']) && $_REQUEST['account_id']) { $base_url = add_query_arg('account_id', $_REQUEST['account_id'], $base_url); } // get listing status summary $summary = WPLA_ListingsModel::getStatusSummary(); // All link $class = $current_listing_status == 'all' ? ' class="current"' : ''; $all_url = remove_query_arg('listing_status', $base_url); $views['all'] = "<a href='{$all_url}' {$class} >" . __('All', 'wpla') . "</a>"; $views['all'] .= '<span class="count">(' . $summary->total_items . ')</span>'; // prepared link $prepared_url = add_query_arg('listing_status', 'prepared', $base_url); $class = $current_listing_status == 'prepared' ? ' class="current"' : ''; $views['prepared'] = "<a href='{$prepared_url}' {$class} >" . __('Prepared', 'wpla') . "</a>"; if (isset($summary->prepared)) { $views['prepared'] .= '<span class="count">(' . $summary->prepared . ')</span>'; } // online link $online_url = add_query_arg('listing_status', 'online', $base_url); $class = $current_listing_status == 'online' ? ' class="current"' : ''; $views['online'] = "<a href='{$online_url}' {$class} >" . __('Online', 'wpla') . "</a>"; if (isset($summary->online)) { $views['online'] .= '<span class="count">(' . $summary->online . ')</span>'; } // changed link $changed_url = add_query_arg('listing_status', 'changed', $base_url); $class = $current_listing_status == 'changed' ? ' class="current"' : ''; $views['changed'] = "<a href='{$changed_url}' {$class} >" . __('Changed', 'wpla') . "</a>"; if (isset($summary->changed)) { $views['changed'] .= '<span class="count">(' . $summary->changed . ')</span>'; } // matched link $matched_url = add_query_arg('listing_status', 'matched', $base_url); $class = $current_listing_status == 'matched' ? ' class="current"' : ''; $views['matched'] = "<a href='{$matched_url}' {$class} >" . __('Matched', 'wpla') . "</a>"; if (isset($summary->matched)) { $views['matched'] .= '<span class="count">(' . $summary->matched . ')</span>'; } // submitted link if (isset($summary->submitted)) { $submitted_url = add_query_arg('listing_status', 'submitted', $base_url); $class = $current_listing_status == 'submitted' ? ' class="current"' : ''; $views['submitted'] = "<a href='{$submitted_url}' {$class} >" . __('Submitted', 'wpla') . "</a>"; $views['submitted'] .= '<span class="count">(' . $summary->submitted . ')</span>'; } // ended link // $ended_url = add_query_arg( 'listing_status', 'ended', $base_url ); // $class = ($current_listing_status == 'ended' ? ' class="current"' :''); // $views['ended'] = "<a href='{$ended_url}' {$class} >".__('Ended','wpla')."</a>"; // if ( isset($summary->ended) ) $views['ended'] .= '<span class="count">('.$summary->ended.')</span>'; // sold link if (isset($summary->sold)) { $sold_url = add_query_arg('listing_status', 'sold', $base_url); $class = $current_listing_status == 'sold' ? ' class="current"' : ''; $views['sold'] = "<a href='{$sold_url}' {$class} >" . __('Sold', 'wpla') . "</a>"; $views['sold'] .= '<span class="count">(' . $summary->sold . ')</span>'; } // failed link if (isset($summary->failed)) { $failed_url = add_query_arg('listing_status', 'failed', $base_url); $class = $current_listing_status == 'failed' ? ' class="current"' : 'style="color:darkred"'; $views['failed'] = "<a href='{$failed_url}' {$class} >" . __('Failed', 'wpla') . "</a>"; $views['failed'] .= '<span class="count">(' . $summary->failed . ')</span>'; } // trash link if (isset($summary->trash)) { $trash_url = add_query_arg('listing_status', 'trash', $base_url); $class = $current_listing_status == 'trash' ? ' class="current"' : ''; $views['trash'] = "<a href='{$trash_url}' {$class} >" . __('Trash', 'wpla') . "</a>"; $views['trash'] .= '<span class="count">(' . $summary->trash . ')</span>'; } // trashed link if (isset($summary->trashed)) { $trashed_url = add_query_arg('listing_status', 'trashed', $base_url); $class = $current_listing_status == 'trashed' ? ' class="current"' : ''; $views['trashed'] = "<a href='{$trashed_url}' {$class} >" . __('Trashed', 'wpla') . "</a>"; $views['trashed'] .= '<span class="count">(' . $summary->trashed . ')</span>'; } // imported link (Import Queue) if (isset($summary->imported)) { $imported_url = add_query_arg('listing_status', 'imported', $base_url); $class = $current_listing_status == 'imported' ? ' class="current"' : ''; $views['imported'] = "<a href='{$imported_url}' {$class} >" . __('Import Queue', 'wpla') . "</a>"; $views['imported'] .= '<span class="count">(' . $summary->imported . ')</span>'; } // Quality if (!empty($summary->quality_alert)) { $quality_alert_url = add_query_arg('listing_status', 'quality_alert', $base_url); $class = $current_listing_status == 'quality_alert' ? ' class="current"' : 'style="color:darkred"'; $views['quality_alert'] = "<a href='{$quality_alert_url}' {$class} >" . __('Quality', 'wpla') . "</a>"; $views['quality_alert'] .= '<span class="count">(' . $summary->quality_alert . ')</span>'; } // In Stock $is_in_stock_url = add_query_arg('stock_status', 'is_in_stock', $base_url); $class = $current_stock_status == 'is_in_stock' ? ' class="current"' : ''; $views['is_in_stock'] = "<a href='{$is_in_stock_url}' {$class} >" . __('In Stock', 'wpla') . "</a>"; // No Stock $is_not_in_stock_url = add_query_arg('stock_status', 'is_not_in_stock', $base_url); $class = $current_stock_status == 'is_not_in_stock' ? ' class="current"' : ''; $views['is_not_in_stock'] = "<a href='{$is_not_in_stock_url}' {$class} >" . __('No Stock', 'wpla') . "</a>"; if (!get_option('wpla_fba_enabled')) { return $views; } // FBA $is_fba_url = add_query_arg('fba_status', 'is_fba', $base_url); $class = $current_fba_status == 'is_fba' ? ' class="current"' : ''; $tooltip = 'Show only FBA enabled items. Since parent variations do not exist on FBA, they will not show up in this view.'; $views['is_fba'] = "<a href='{$is_fba_url}' title='{$tooltip}' {$class} >" . __('FBA', 'wpla') . "</a>"; $views['is_fba'] .= '<span class="count">(' . $summary->is_fba . ')</span>'; // Non-FBA $is_not_fba_url = add_query_arg('fba_status', 'is_not_fba', $base_url); $class = $current_fba_status == 'is_not_fba' ? ' class="current"' : ''; $tooltip = 'Show only non-FBA items - but hide parent variations.'; $views['is_not_fba'] = "<a href='{$is_not_fba_url}' title='{$tooltip}' {$class} >" . __('Non-FBA', 'wpla') . "</a>"; $views['is_not_fba'] .= '<span class="count">(' . $summary->is_not_fba . ')</span>'; return $views; }
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 .= ' '; 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 .= ' '; // $msg .= '<a href="admin.php?page=wpla&listing_status=prepared" id="" class="button button-small wpl_job_button">' . __('Show products','wpla') . '</a>'; // $msg .= ' '; // $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 .= ' '; $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 .= ' '; $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 .= ' '; $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 .= ' '; $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); } }