예제 #1
0
 public function getLogs()
 {
     if (!Configuration::get('EBAY_SECURITY_TOKEN') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) {
         return Tools::safeOutput(Tools::getValue('not_logged_str'));
     }
     $ebay = new Ebay();
     $ebay_profile = new EbayProfile((int) Tools::getValue('profile'));
     $page = (int) Tools::getValue('p', 0);
     $nb_results = 20;
     if ($page < 2) {
         $page = 1;
     }
     $offset = $nb_results * ($page - 1);
     $smarty = Context::getContext()->smarty;
     $logs = $this->getDatas($offset, $nb_results);
     /* Smarty datas */
     $template_vars = array('logs' => $logs, 'p' => $page, 'noLogFound' => Tools::getValue('no_logs_str'), 'showStr' => Tools::getValue('show_str'));
     $smarty->assign($template_vars);
     return $ebay->display(realpath(dirname(__FILE__) . '/../'), $this->file);
 }
        $new = array();
        foreach ($array as $k => $value) {
            $new[$k] = $value;
            if ($k === $key) {
                $new[$new_key] = $new_value;
            }
        }
        return $new;
    }
    return false;
}
$ebay = new Ebay();
$ebay_profile = new EbayProfile((int) Tools::getValue('profile'));
if (!Configuration::get('EBAY_SECURITY_TOKEN') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN')) {
    return Tools::safeOutput(Tools::getValue('not_logged_str'));
}
$category_list = $ebay->getChildCategories(Category::getCategories(Tools::getValue('id_lang')), version_compare(_PS_VERSION_, '1.5', '>') ? 1 : 0);
$offset = 20;
$page = (int) Tools::getValue('p', 0);
if ($page < 2) {
    $page = 1;
}
$limit = $offset * ($page - 1);
$category_list = array_slice($category_list, $limit, $offset);
$ebay_store_category_list = EbayStoreCategory::getCategoriesWithConfiguration($ebay_profile->id);
$smarty = Context::getContext()->smarty;
/* Smarty datas */
$template_vars = array('tabHelp' => '&id_tab=7', '_path' => $ebay->getPath(), 'categoryList' => $category_list, 'eBayStoreCategoryList' => $ebay_store_category_list, 'request_uri' => $_SERVER['REQUEST_URI'], 'noCatFound' => Tools::getValue('ch_no_cat_str'), 'p' => $page);
$smarty->assign($template_vars);
echo $ebay->display(realpath(dirname(__FILE__) . '/../'), '/views/templates/hook/table_store_categories.tpl');
    if ($row['EbayProductRef']) {
        $row['link'] = EbayProduct::getEbayUrl($row['EbayProductRef'], $ebay_request->getDev());
    }
    foreach ($category_list as $cat) {
        if ($cat['id_category'] == $row['id_category']) {
            $row['category_full_name'] = $cat['name'];
            $row['is_category_active'] = $cat['active'];
            break;
        }
    }
    if ($row['id_category_ref']) {
        foreach ($ebay_categories as $cat) {
            if ($cat['id'] == $row['id_category_ref']) {
                $row['ebay_category_full_name'] = $cat['name'];
                break;
            }
        }
    }
    if ($ebay_profile->getConfiguration('EBAY_SYNC_PRODUCTS_MODE') == 'A') {
        $row['sync'] = (bool) $row['id_category_ref'];
    }
    // only true if category synced with an eBay category
    $link = $context->link;
    $row['link'] = method_exists($link, 'getAdminLink') ? $link->getAdminLink('AdminProducts') . '&id_product=' . (int) $row['id_product'] . '&updateproduct' : $link->getProductLink((int) $row['id_product']);
}
$smarty = $context->smarty;
// Smarty datas
$template_vars = array('nbPerPage' => $limit, 'nbProducts' => $nbProducts, 'noProductFound' => Tools::getValue('ch_no_prod_str'), 'p' => $page, 'products' => $res);
$smarty->assign($template_vars);
echo $ebay->display(realpath(dirname(__FILE__) . '/../'), '/views/templates/hook/table_prestashop_products.tpl');
            if ($cat['id'] == $row['id_category_ref']) {
                $row['ebay_category_full_name'] = $cat['name'];
                break;
            }
        }
    }
    if ($ebay_profile->getConfiguration('EBAY_SYNC_PRODUCTS_MODE') == 'A') {
        $row['sync'] = (bool) $row['EbayCategoryExists'];
        // only true if category synced with an eBay category
    }
    // filtering
    if (!$row['exists']) {
        $final_res[] = $row;
    } elseif (!$row['EbayCategoryExists']) {
        $final_res[] = $row;
    } elseif ($row['isMultiSku'] && !$row['notSetWithMultiSkuCat'] && !$row['EbayCategoryIsMultiSku']) {
        $final_res[] = $row;
    } elseif ($row['notSetWithMultiSkuCat'] && $row['EbayCategoryIsMultiSku']) {
        $final_res[] = $row;
    } elseif (!$row['active'] || $row['blacklisted']) {
        $final_res[] = $row;
    } elseif (!$row['sync']) {
        $final_res[] = $row;
    }
}
$smarty = Context::getContext()->smarty;
// Smarty datas
$template_vars = array('ads' => $final_res);
$smarty->assign($template_vars);
echo $ebay->display(realpath(dirname(__FILE__) . '/../'), '/views/templates/hook/table_orphan_listings.tpl');