public function handleActions()
 {
     // handle save listing
     if ($this->requestAction() == 'save_listing') {
         $this->saveListing();
     }
     // trigger create product
     if ($this->requestAction() == 'create_product') {
         $lm = new WPLA_ListingsModel();
         $listing = $lm->getItem($_REQUEST['listing']);
         if (!$listing) {
             return;
         }
         // create product
         $ProductsImporter = new WPLA_ProductsImporter();
         $success = $ProductsImporter->createProductFromAmazonListing($listing);
         $error = $ProductsImporter->lastError;
         $post_id = $ProductsImporter->lastPostID;
         $message = $ProductsImporter->message;
         if ($success) {
             // get parent post_id - for View Product button
             $_product = get_product($post_id);
             if ('variation' == $_product->product_type) {
                 $post_id = $_product->parent->id;
             }
             $msg = $message ? $message : sprintf(__('A new product (ID %s) was created for ASIN %s.', 'wpla'), $post_id, $listing['asin']);
             $msg .= sprintf('&nbsp;&nbsp;<a href="post.php?post=%s&action=edit" class="button button-small" target="_blank">%s</a>', $post_id, __('View product', 'wpla'));
             $this->showMessage($msg);
         } else {
             $error_msg = sprintf(__('Item %s could not be imported.', 'wpla'), $listing['asin']) . '<br>Error: ' . $error;
             $this->showMessage($error_msg, 1);
         }
     }
     // handle update from Amazon action
     if ($this->requestAction() == 'update') {
         // $this->initAC();
         // $this->EC->updateItemsFromEbay( $_REQUEST['listing'] );
         // $this->EC->closeEbay();
         // $this->showMessage( __('Selected items were updated from Amazon.','wpla') );
         $this->showMessage(__('Not implemented yet.', 'wpla'));
     }
     // handle delete action
     if ($this->requestAction() == 'delete') {
         $lm = new WPLA_ListingsModel();
         if (is_array($_REQUEST['listing'])) {
             foreach ($_REQUEST['listing'] as $id) {
                 $lm->deleteItem($id);
             }
         } elseif (is_numeric($_REQUEST['listing'])) {
             $lm->deleteItem($_REQUEST['listing']);
         }
         $this->showMessage(__('Selected listings were removed from WP-Lister.', 'wpla'));
     }
     // handle trash_listing action
     if ($this->requestAction() == 'trash_listing') {
         $items = is_array($_REQUEST['listing']) ? $_REQUEST['listing'] : array($_REQUEST['listing']);
         $lm = new WPLA_ListingsModel();
         foreach ($items as $id) {
             $lm->updateWhere(array('id' => $id), array('status' => 'trash'));
         }
         $this->showMessage(__('Selected items have been scheduled to be removed from your Amazon account.', 'wpla'));
     }
     // handle resubmit action
     if ($this->requestAction() == 'resubmit') {
         $items = is_array($_REQUEST['listing']) ? $_REQUEST['listing'] : array($_REQUEST['listing']);
         $lm = new WPLA_ListingsModel();
         foreach ($items as $id) {
             $lm->resubmitItem($id);
         }
         $this->showMessage(__('Selected items were prepared for resubmission.', 'wpla'));
     }
     if ($this->requestAction() == 'resubmit_all_failed') {
         $lm = new WPLA_ListingsModel();
         $items = $lm->getWhere('status', 'failed');
         foreach ($items as $item) {
             $lm->resubmitItem($item->id);
         }
         $this->showMessage(sprintf(__('%s failed items were prepared for resubmission.', 'wpla'), count($items)));
     }
     if ($this->requestAction() == 'wpla_clear_import_queue') {
         $lm = new WPLA_ListingsModel();
         $items = $lm->getWhere('status', 'imported');
         foreach ($items as $item) {
             $lm->deleteItem($item->id);
         }
         $this->showMessage(sprintf(__('%s items have been removed from the import queue.', 'wpla'), count($items)));
     }
     // handle toolbar action - prepare listing from product
     if ($this->requestAction() == 'wpla_prepare_single_listing') {
         // get profile
         $profile = isset($_REQUEST['profile_id']) ? WPLA_AmazonProfile::getProfile($_REQUEST['profile_id']) : false;
         if ($profile) {
             // prepare product
             $listingsModel = new WPLA_ListingsModel();
             $success = $listingsModel->prepareProductForListing($_REQUEST['product_id'], $_REQUEST['profile_id']);
             // $listingsModel->applyProfileToNewListings( $profile );
             if ($success) {
                 $this->showMessage(__('New listing was prepared from product.', 'wpla'));
             } else {
                 $this->showMessage(join('<br>', $listingsModel->warnings), 1);
             }
         }
     }
     // handle bulk action - get_compet_price
     if ($this->requestAction() == 'get_compet_price') {
         $this->get_compet_price();
         $this->get_lowest_offers();
         // do both
     }
     // handle bulk action - get_lowest_offers
     if ($this->requestAction() == 'get_lowest_offers') {
         $this->get_lowest_offers();
     }
     // handle wpla_dismiss_imported_products_notice action
     if ($this->requestAction() == 'wpla_dismiss_imported_products_notice') {
         self::updateOption('dismiss_imported_products_notice', '1');
     }
 }