/**
  * Check needle synchronization category features from ebay
  * @param int $site_id
  * @param int $category_id
  * @return bool
  */
 public static function isNeedSynchronization($site_id, $category_id)
 {
     $data = Category::getCategory($site_id, $category_id);
     if (empty($data)) {
         return false;
     }
     return empty($data['features']) || $data['feature_update_time'] + self::SYNCHRONIZATION_PERIOD < time();
 }
Exemple #2
0
    }
    if (!empty($template_data['root_sec_category'])) {
        $view->assign('ebay_sec_child_categories', fn_get_ebay_categories($template_data['site_id'], $template_data['root_sec_category'], true));
    }
    if (!empty($template_data['category'])) {
        $view->assign('current_category', \Ebay\objects\Category::getCategory($template_data['site_id'], $template_data['category']));
    }
    $view->assign('template_data', $template_data)->assign('ebay_sites', fn_get_ebay_sites())->assign('ebay_root_categories', fn_get_ebay_categories($template_data['site_id'], 0));
} elseif ($mode == 'get_category_features') {
    $site_id = (int) $_REQUEST['site_id'];
    $category_id = (int) $_REQUEST['category_id'];
    $template_data = $features = array();
    if (\Ebay\objects\CategoryFeature::isNeedSynchronization($site_id, $category_id)) {
        \Ebay\objects\CategoryFeature::synchronization($site_id, $category_id);
    }
    $current_category = \Ebay\objects\Category::getCategory($site_id, $category_id);
    if (!empty($_REQUEST['template_id'])) {
        $template_data = fn_get_ebay_template($_REQUEST['template_id']);
    }
    Tygh::$app['view']->assign('template_data', $template_data);
    Tygh::$app['view']->assign('current_category', $current_category);
    Tygh::$app['view']->assign('data_id', $_REQUEST['data_id']);
    if (defined('AJAX_REQUEST')) {
        Tygh::$app['view']->display('addons/ebay/views/ebay/components/category_features.tpl');
        exit;
    } else {
        array(CONTROLLER_STATUS_REDIRECT, 'ebay.manage');
    }
} elseif ($mode == 'get_subcategories') {
    $template_data = $subcategories = array();
    if (!empty($_REQUEST['parent_id'])) {