Exemple #1
0
 public function ce_run_custom_event_hook()
 {
     $schedules = CE_Ebay::get_schedule_option();
     foreach ($schedules as $key => $option) {
         if ($option['ON']) {
             CE_Ebay_API::ebay_search_import($option);
         }
     }
 }
Exemple #2
0
function ce_ebay_dropdow_categories($args = array())
{
    $sited = isset($_COOKIE['ebay_site']) ? $_COOKIE['ebay_site'] : 0;
    $default = array('echo' => true, 'site' => $sited, 'class' => '');
    $args = wp_parse_args($args, $default);
    extract($args);
    $categories = CE_Ebay_API::get_categories($site);
    $html = '';
    if (is_array($categories)) {
        $html .= '<div class="ce-ebay-select select-style et-button-select ' . $class . '" id="wrap-cat" >';
        $html .= '<select id="category"  name="category" class="ebay_category" title="' . __("ALL CATEGORIES", ET_DOMAIN) . '">';
        $html .= '<option class=""  value="-1">' . __("All Categories", ET_DOMAIN) . '</option>';
        foreach ($categories as $cat) {
            $select = '';
            if ($site == $cat[0]->CategoryID) {
                $select = 'selected = "selected"';
            }
            if ($cat[0]->CategoryID == -1) {
                continue;
            }
            $html .= '<option value="' . $cat[0]->CategoryID . '" ' . $select . '>';
            $html .= $cat[0]->CategoryName;
            $html .= '</option>';
        }
        $html .= '</select>';
        if (!$echo) {
            $html .= '<span class="select">' . __('All Categories', 'ET_DOMAIN') . '</span>';
        }
        $html .= '</div>';
    }
    if ($echo) {
        echo $html;
    } else {
        return $html;
    }
}
 public function ebay_search_ad()
 {
     $request = $_POST;
     $resp = CE_Ebay_API::ebay_search($request);
     wp_send_json($resp);
 }
 public static function ebay_search_import($option)
 {
     $options = CE_Ebay::get_option();
     extract($option);
     $paged = isset($paged) ? $paged : 1;
     if (!is_numeric($number) || $number < 1) {
         $number = 3;
     }
     $url = self::URL_API_SEARCH;
     $url .= '&GLOBAL-ID=' . $site;
     $url .= '&SECURITY-APPNAME=' . $options['app_id'];
     //$url .= '&RESPONSE-DATA-FORMAT=XML&outputSelector[0]=SellerInfo&outputSelector[1]=PictureURLLarge';
     $url .= '&RESPONSE-DATA-FORMAT=XML&outputSelector[0]=PictureURLLarge';
     $url .= "&paginationInput.entriesPerPage=" . $number;
     $url .= "&paginationInput.pageNumber=" . $paged;
     if ($options['use_affiliate']) {
         $url .= '&affiliate.networkId=' . $options['network_id'];
         $url .= '&affiliate.trackingId=' . $options['tracking_id'];
         $url .= '&affiliate.customId=' . $options['custom_id'];
     }
     if (!empty($user_id)) {
         $url .= "&itemFilter(0).name=Seller";
         $url .= "&itemFilter(0).value={$user_id}";
     }
     if (!empty($keywords)) {
         $url .= '&keywords=' . $keywords;
     }
     if ($category != '-1') {
         $url .= '&categoryId=' . $category;
     }
     $items = array();
     $resp = simplexml_load_file($url);
     if ($resp->ack == 'Success') {
         foreach ($resp->searchResult->item as $item) {
             $item->currencyId = $item->sellingStatus->convertedCurrentPrice['currencyId'];
             $instance = CE_Ebay_API::get_instance();
             $instance->_import($item);
         }
     }
 }