コード例 #1
0
ファイル: yml.php プロジェクト: ambient-lounge/site
        }
        Tygh::$app['view']->assign('price', $price_list);
    }
    $tabs = array();
    $tabs_codes = array_keys($schema_price_list);
    foreach ($tabs_codes as $tab_code) {
        $tabs[$tab_code] = array('title' => __('yml_export.tab_' . $tab_code), 'js' => true);
    }
    Registry::set('navigation.tabs', $tabs);
    Tygh::$app['view']->assign('price_lists', $schema_price_list);
    if (!empty($price_list['param_id'])) {
        $yml2_information = __('yml2_available_in_customer', array('[yml2_generate_url]' => fn_yml_get_generate_link($price_list), '[yml2_get_url]' => fn_yml_get_link($price_list), '[yml2_console_generate]' => fn_yml_get_console_cmd($price_list)));
        Tygh::$app['view']->assign('yml2_information', $yml2_information);
        Tygh::$app['view']->assign('access_key', $price_list['param_key']);
    } else {
        Tygh::$app['view']->assign('access_key', fn_yml_get_key($price_list));
    }
} elseif ($mode == "get_variants_list") {
    $offer = $_REQUEST['offer'];
    $offer_key = $_REQUEST['offer_key'];
    $page_number = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1;
    $page_size = isset($_REQUEST['page_size']) ? (int) $_REQUEST['page_size'] : 3;
    $search_query = isset($_REQUEST['q']) ? $_REQUEST['q'] : null;
    $lang_code = isset($_REQUEST['lang_code']) ? $_REQUEST['lang_code'] : CART_LANGUAGE;
    if ($offer == 'common') {
        $offer_class = "\\Tygh\\Ym\\Offers\\" . fn_camelize('base');
        if (class_exists($offer_class)) {
            $offer = new $offer_class();
        } else {
            throw new \Exception("The wrong offer");
        }
コード例 #2
0
ファイル: func.php プロジェクト: ambient-lounge/site
function fn_yml_get_console_cmd($price_list)
{
    $console_cmd = "php index.php --dispatch=yml.generate";
    if (!empty($price_list['company_id'])) {
        $console_cmd .= " --switch_company_id=" . $price_list['company_id'];
    } elseif (Registry::get('runtime.company_id')) {
        $console_cmd .= " --switch_company_id=" . Registry::get('runtime.company_id');
    }
    if (isset($price_list['param_data']) && $price_list['param_data']['enable_authorization'] == 'N') {
        $console_cmd .= " --price_id=" . $price_list['param_id'];
    } else {
        $console_cmd .= " --access_key=" . fn_yml_get_key($price_list);
    }
    return $console_cmd;
}