예제 #1
0
 public function ajax_wple_show_profile_selection()
 {
     // fetch profiles
     $pm = new ProfilesModel();
     $profiles = $pm->getAll();
     // load template
     $tpldata = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'profiles' => $profiles, 'form_action' => 'admin.php?page=' . self::ParentMenuId);
     WPLE()->pages['listings']->display('profile/select_profile', $tpldata);
     exit;
 }
예제 #2
0
    function extra_tablenav($which)
    {
        if ('top' != $which) {
            return;
        }
        $pm = new ProfilesModel();
        $wpl_profiles = $pm->getAll();
        $profile_id = isset($_REQUEST['profile_id']) ? $_REQUEST['profile_id'] : false;
        $account_id = isset($_REQUEST['account_id']) ? $_REQUEST['account_id'] : false;
        // echo "<pre>";print_r($wpl_profiles);echo"</pre>";die();
        ?>
        <div class="alignleft actions" style="">

            <select name="profile_id">
                <option value=""><?php 
        _e('All profiles', 'wplister');
        ?>
</option>
                <?php 
        foreach ($wpl_profiles as $profile) {
            ?>
                    <option value="<?php 
            echo $profile['profile_id'];
            ?>
"
                        <?php 
            if ($profile_id == $profile['profile_id']) {
                echo 'selected';
            }
            ?>
                        ><?php 
            echo $profile['profile_name'];
            ?>
</option>
                <?php 
        }
        ?>
            </select>            

            <?php 
        if (WPLE()->multi_account) {
            ?>

            <select name="account_id">
                <option value=""><?php 
            _e('All accounts', 'wplister');
            ?>
</option>
                <?php 
            foreach (WPLE()->accounts as $account) {
                ?>
                    <option value="<?php 
                echo $account->id;
                ?>
"
                        <?php 
                if ($account_id == $account->id) {
                    echo 'selected';
                }
                ?>
                        ><?php 
                echo $account->title;
                ?>
</option>
                <?php 
            }
            ?>
            </select>            

            <?php 
        }
        ?>

            <input type="submit" name="" id="post-query-submit" class="button" value="Filter">


            <!--
            <a class="btn_verify_all_prepared_items button wpl_job_button"
               title="<?php 
        echo __('Verify all prepared items with eBay and get listing fees.', 'wplister');
        ?>
"
                ><?php 
        echo __('Verify all prepared items', 'wplister');
        ?>
</a>
            -->

            <?php 
        #if ( current_user_can( 'publish_ebay_listings' ) ) :
        ?>
            <!--
            <a class="btn_publish_all_verified_items button wpl_job_button"
               title="<?php 
        echo __('Publish all verified items on eBay.', 'wplister');
        ?>
"
                ><?php 
        echo __('Publish all verified items', 'wplister');
        ?>
</a>
            -->
            <?php 
        #endif;
        ?>


        </div>
        <?php 
    }
예제 #3
0
 public function displayPrepareListingsPage($selectedProducts)
 {
     // show warning if duplicate products found
     $this->checkForDuplicates();
     //Create an instance of our package class...
     // $this->listingsTable = new ListingsTable();
     //Fetch, prepare, sort, and filter our data...
     $this->listingsTable->selectedItems = $selectedProducts;
     $this->listingsTable->prepare_items();
     // get profiles
     $profilesModel = new ProfilesModel();
     $profiles = $profilesModel->getAll();
     $aData = array('plugin_url' => self::$PLUGIN_URL, 'message' => $this->message, 'last_selected_profile' => self::getOption('last_selected_profile'), 'profiles' => $profiles, 'listingsTable' => $this->listingsTable, 'form_action' => 'admin.php?page=' . self::ParentMenuId);
     $this->display('listings_prepare_page', $aData);
 }
예제 #4
0
 public function checkSetup($page = false)
 {
     global $pagenow;
     // check if safe mode is enabled
     $this->isPhpSafeMode();
     // check if incomatible plugins are active
     $this->checkPlugins();
     // check if a recent version of WooCommerce is installed
     $this->checkWooCommerce();
     // check if cURL is loaded
     if (!$this->isCurlLoaded()) {
         return false;
     }
     // check for windows server
     // if ( $this->isWindowsServer() ) return false;
     $this->isWindowsServer($page);
     // create folders if neccessary
     if ($this->checkFolders()) {
         return false;
     }
     // check for updates
     $this->checkForUpdates();
     // check if cron is working properly
     $this->checkCron();
     // check if any sites need to be refreshed
     $this->checkSites();
     // check database after migration
     // $this->checkDatabase();
     // $this->checkDbForInvalidAccounts();
     // check for multisite installation
     // if ( $this->checkMultisite() ) return false;
     $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : false;
     // setup wizard
     // if ( self::getOption('ebay_token') == '' ) {
     if ('1' == self::getOption('setup_next_step') && $current_tab != 'accounts') {
         $msg1 = __('You have not linked WP-Lister to your eBay account yet.', 'wplister');
         $msg2 = __('To complete the setup procedure go to %s and follow the instructions.', 'wplister');
         $accounts_page = get_option('wplister_enable_accounts_page') ? 'wplister-settings-accounts' : 'wplister-settings&tab=accounts';
         $link = sprintf('<a href="admin.php?page=%s">%s</a>', $accounts_page, __('Account Settings', 'wplister'));
         $msg2 = sprintf($msg2, $link);
         $msg = "<b>{$msg1}</b></p><p>{$msg2}";
         wple_show_message($msg, 'info');
     } elseif ('2' == self::getOption('setup_next_step')) {
         $title = __('Setup - Step 2', 'wplister');
         $msg1 = __('Before creating your first profile, we need to download certain information which are specific to the eBay site you selected.', 'wplister');
         $msg2 = __('This includes shipping options, payment methods, your custom store categories as well as the whole eBay category tree, which might take a while.', 'wplister');
         // old button
         // $button = '<a href="#" id="btn_update_ebay_data" onclick="return false;" class="button-primary">'.__('Update eBay details','wplister').'</a>';
         // new button - use site_id of default (first) account
         $account = WPLE()->accounts[get_option('wplister_default_account_id')];
         $button = '<a href="#" data-site_id="' . $account->site_id . '" data-account_id="' . $account->id . '" class="btn_update_ebay_data_for_site button-primary">' . __('Refresh eBay details', 'wplister') . '</a>';
         $msg = "<p><b>{$title}</b></p><p>{$msg1}</p><p>{$msg2}</p>";
         $msg .= $button;
         wple_show_message($msg, 'info');
         // // remember when WP-Lister was connected to an eBay account for the first time
         // update_option( 'ignore_orders_before_ts', time() );
     } elseif ('3' == self::getOption('setup_next_step')) {
         $tm = new TemplatesModel();
         $templates = $tm->getAll();
         if (sizeof($templates) > 0) {
             self::updateOption('setup_next_step', '4');
         } else {
             $title = __('Setup - Step 3', 'wplister');
             $msg1 = __('Create a default listing template.', 'wplister');
             $msg2 = __('To create your first listing template click on %s.', 'wplister') . '<br>';
             if (@$_GET['action'] == 'add_new_template') {
                 $msg2 = __('Replace the default text according to your requirements and save your template to continue.', 'wplister');
             }
             $link = '<a href="admin.php?page=wplister-templates&action=add_new_template">' . __('New Template', 'wplister') . '</a>';
             $msg2 = sprintf($msg2, $link);
             $msg = "<p><b>{$title}</b></p><p><b>{$msg1}</b></p><p>{$msg2}</p>";
             wple_show_message($msg, 'info');
         }
     } elseif ('4' == self::getOption('setup_next_step')) {
         $pm = new ProfilesModel();
         $profiles = $pm->getAll();
         if (sizeof($profiles) > 0) {
             self::updateOption('setup_next_step', '0');
         } else {
             $title = __('Setup - Step 4', 'wplister');
             $msg1 = __('The final step: create your first listing profile.', 'wplister');
             $msg2 = __('Click on %s and start defining your listing options.<br>After saving your profile, visit your Products page and select the products to list on eBay.', 'wplister');
             $link = '<a href="admin.php?page=wplister-profiles&action=add_new_profile">' . __('New Profile', 'wplister') . '</a>';
             $msg2 = sprintf($msg2, $link);
             $msg = "<b>{$msg1}</b></p><p>{$msg2}";
             wple_show_message($msg, 'info');
         }
     } elseif ('5' == self::getOption('setup_next_step')) {
         $title = __('Setup is complete.', 'wplister');
         $msg1 = __('You are ready now to list your first items.', 'wplister');
         $msg2 = __('Visit your Products page, select a few items and select "List on eBay" from the bulk actions menu.', 'wplister');
         $msg = "<b>{$msg1}</b></p><p>{$msg2}";
         wple_show_message($msg, 'info');
         update_option('wplister_setup_next_step', '0');
     }
     // db upgrade
     WPLE_UpgradeHelper::upgradeDB();
     // check token expiration date
     self::checkToken();
     // check if all db tables exist
     self::checkDatabaseTables($page);
     // // fetch user details if not done yet
     // if ( ( self::getOption('ebay_token') != '' ) && ( ! self::getOption('ebay_user') ) ) {
     // 	$this->initEC();
     // 	$UserID = $this->EC->GetUser();
     // 	$this->EC->closeEbay();
     // }
     // // fetch user details if not done yet
     // if ( ( self::getOption('ebay_token') != '' ) && ( ! self::getOption('ebay_seller_profiles_enabled') ) ) {
     // 	$this->initEC();
     // 	$this->EC->GetUserPreferences();
     // 	$this->EC->closeEbay();
     // }
     // // fetch token expiration date if not done yet
     // if ( ( self::getOption('ebay_token') != '' ) && ( ! self::getOption('ebay_token_expirationtime') ) ) {
     // 	$this->initEC();
     // 	$expdate = $this->EC->GetTokenStatus();
     // 	$this->EC->closeEbay();
     // }
 }
예제 #5
0
 function addPrepareActions($wp_admin_bar, $post_id)
 {
     // Prepare listing link
     $url = '#';
     $args = array('id' => 'wplister_tb_prepare_listing', 'title' => __('List on eBay', 'wplister'), 'href' => $url, 'parent' => 'wplister_top', 'meta' => array('class' => 'wplister-toolbar-page'));
     $wp_admin_bar->add_node($args);
     $pm = new ProfilesModel();
     $profiles = $pm->getAll();
     foreach ($profiles as $profile) {
         // echo "<pre>";print_r($profile);echo"</pre>";#die();
         $profile_id = $profile['profile_id'];
         $url = admin_url('admin.php?page=wplister&action=wpl_prepare_single_listing&product_id=' . $post_id . '&profile_id=' . $profile_id);
         $args = array('id' => 'wplister_list_on_ebay_' . $profile['profile_id'], 'title' => $profile['profile_name'], 'href' => $url, 'parent' => 'wplister_tb_prepare_listing', 'meta' => array('class' => 'wplister-toolbar-page'));
         $wp_admin_bar->add_node($args);
     }
     return $args;
 }