Ejemplo n.º 1
0
    }
    ini_set('zlib.output_compression', 0);
    ini_set('implicit_flush', 1);
    extract($request_prepared);
    $warn = "You have to agree explicitly that all previous data will be erased.<br>If you do agree with that, please check\n\t\"I agree, that all previous data will be erased...\" box at the bottom of this page to continue";
    if (!isset($agree) || !$agree) {
        $conn = false;
        $err = $warn;
    } else {
        $conn = cw_xcart_get_conn($path, $err, $xcart_conf);
    }
    if ($conn === false) {
        $smarty->assign('main', 'import_xcart');
        $smarty->assign('err_msg', $err);
        $smarty->assign('path', $path);
    } else {
        $t = "bcse_quotes";
        $f = 'email';
        //$smarty->assign('err_msg', "<textarea>".print_r(cw_common_tables_names($conn),true)."</textarea>");
        //cw_common_tables_diff ($conn);
        //  print_r(cw_vers_diff_attr($conn)); exit;
        cw_import_users($xcart_conf);
        import_products($xcart_conf);
        //exit;
        //header ('Location: /admin/index.php?target=categories');
        //	      echo "<script>\nwindow.location.href='/admin/index.php?target=categories'\n</script>";
        cw_add_top_message('Ok');
        cw_header_location('index.php?target=import&mode=xcart');
    }
}
$smarty->assign('main', 'import_xcart');
Ejemplo n.º 2
0
    $filename = basename($simpla->request->get('filename'));
    $f = fopen($dir . $filename, 'ab');
    fwrite($f, file_get_contents('php://input'));
    fclose($f);
    print "success\n";
}
if ($simpla->request->get('type') == 'catalog' && $simpla->request->get('mode') == 'import') {
    $filename = basename($simpla->request->get('filename'));
    $xml = simplexml_load_file($dir . $filename);
    if (isset($xml->Классификатор)) {
        // Категории
        import_categories($xml->Классификатор);
        import_features($xml->Классификатор);
    }
    if (isset($xml->Каталог)) {
        import_products($xml->Каталог);
    }
    if (isset($xml->ПакетПредложений)) {
        import_variants($xml->ПакетПредложений);
    }
    //unlink($dir.$filename);
    print "success";
}
function import_categories($xml, $parent_id = 0)
{
    global $simpla;
    global $dir;
    if (isset($xml->Группы->Группа)) {
        foreach ($xml->Группы->Группа as $xml_group) {
            $simpla->db->query('SELECT id FROM __categories WHERE external_id=?', $xml_group->Ид);
            $category_id = $simpla->db->result('id');