コード例 #1
0
 public function displaySkuGenPage()
 {
     // handle actions and show notes
     // $this->handleActions();
     // handle button
     if ($this->requestAction() == 'wpla_generate_all_missing_skus') {
         $product_ids = WPLA_SkuGenerator::getAllProductIDsWithoutSKU();
         $this->generateNewSKUs($product_ids);
     }
     // handle bulk action
     if ($this->requestAction() == 'wpla_bulk_generate_skus') {
         $this->generateNewSKUs($_REQUEST['product']);
     }
     // save options
     if ($this->requestAction() == 'wpla_save_skugen_options') {
         $this->saveSkuGenOptions();
     }
     // create table and fetch items to show
     $this->skugenTable = new WPLA_SkuGenTable();
     $this->skugenTable->prepare_items();
     $active_tab = 'skugen';
     $aData = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'skugenTable' => $this->skugenTable, 'default_account' => get_option('wpla_default_account_id'), 'skugen_mode_simple' => get_option('wpla_skugen_mode_simple'), 'skugen_mode_variation' => get_option('wpla_skugen_mode_variation'), 'skugen_mode_case' => get_option('wpla_skugen_mode_case'), 'tools_url' => 'admin.php?page=' . self::ParentMenuId . '-tools', 'form_action' => 'admin.php?page=' . self::ParentMenuId . '-tools' . '&tab=' . $active_tab);
     $this->display('tools_skugen', $aData);
 }
コード例 #2
0
 /** ************************************************************************
  * REQUIRED! This is where you prepare your data for display. This method will
  * usually be used to query the database, sort and filter the data, and generally
  * get it ready to be displayed. At a minimum, we should set $this->items and
  * $this->set_pagination_args(), although the following properties and methods
  * are frequently interacted with here...
  * 
  * @uses $this->_column_headers
  * @uses $this->items
  * @uses $this->get_columns()
  * @uses $this->get_sortable_columns()
  * @uses $this->get_pagenum()
  * @uses $this->set_pagination_args()
  **************************************************************************/
 function prepare_items($items = false)
 {
     // process bulk actions
     // $this->process_bulk_action();
     // get pagination state
     $current_page = $this->get_pagenum();
     $per_page = $this->get_items_per_page('listings_per_page', 20);
     // define columns
     $this->_column_headers = $this->get_column_info();
     // fetch items
     $helper = new WPLA_SkuGenerator();
     $this->items = $helper->getPageItems($current_page, $per_page);
     $this->total_items = $helper->total_items;
     // register our pagination options & calculations.
     $this->set_pagination_args(array('total_items' => $this->total_items, 'per_page' => $per_page, 'total_pages' => ceil($this->total_items / $per_page)));
 }