osCommerce France : Accueil Forum Portail osCommerce France Réponses aux questions Foire aux contributions

Bienvenue invité ( Connexion | Inscription )

 
Reply to this topicStart new topic
> [RESOLU] TRANSFERT CATEGORIE ET ARTICLES, Transfert de v2.2 RC1 W3C Valid FR vers 2.3.3.4
N.Serge
posté 27 Feb 2017, 17:07
Message #1


Ceinture orange OSC
Icône de groupe

Groupe : Membres
Messages : 277
Inscrit : 18-October 08
Membre no 23350



Bonjour à toutes et tous,

marre de retranscrire un à un les articles dans ma nouvelle version, je me demandais si il était possible via la bdd d'exporter les catégories de ma version 2.2 vers ma version 2.3.4 ?

J'ai déjà taper un oeil dans les bdd mais je ne vois pas comment

D'avance je vous remercie pour l'aide apportée

Serge

Ce message a été modifié par N.Serge - 19 Apr 2017, 20:09.


--------------------
Version osCommerce Online Merchant v2.2 RC1 W3C Valid FR.
fckeditor-oscommerce_v2.2.1 ( bien ) - anti_spambot_contact_us_1.2 ( bien ) - Remise par catégorie (très bien) -Virement bancaire - Paypal IPN : V2.3 ( désactivé) - Déposit ( paiement avec acompte - très bien ) - Inactiveuser_1_3 ( pas terrible ) - Catégorie box ( génial ) -
Minimum_Order ( désactivé) - Minimum Amount To Make The Order ( très bien pour IE, mais bug pour autre navigateur )
discount_quant_v1 ( bien mais bug paypal et calcul sur le total du panier donc désactivé ) - lev_discountv2.4 ( bien mais bug paypal donc désactivé )
ParcelShop ( modification de la contrib kilopost - désactivé ) - TaxiPost ( bien - désactivé)


Version osCommerce Online Merchant v2.3.4 FR. (16/12/2016 test online )
Virement Bancaire 2.3.4.1 du 19/12/2016 (OK)
CKEditor 4.6.1 Full (OK)
Select Product Image Directory (OK)
Simple Order Discount (NON*) *remise sur tout le panier et non uniquement sur la quantité programmée


Go to the top of the page
 
Bonbec
posté 28 Feb 2017, 07:09
Message #2


Ceinture marron OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1543
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Bonjour,

Piernas, intervenant régulier du forum US, a créé un script très utile. Il faut juste l'adapter à tes bases (ajout des champs qui ne figurent pas dans la config d'origine d'OsCommerce). C'est assez facile.
Voilà la page en question : ici
Voilà le script à adapter :
Code
<?php
    error_reporting(E_ALL);
    ini_set("display_errors", 1);

// PLEASE FILL IN DATA FROM YOUR OWN DATABASES
    
    define('SOURCE_SERVER', 'localhost');
    define('SOURCE_USER', 'user1');
    define('SOURCE_PASS', 'pass1');
    define('SOURCE_DB', 'source_db');
    define('DESTINATION_SERVER', 'localhost');
    define('DESTINATION_USER', 'user2');
    define('DESTINATION_PASS', 'pass2');
    define('DESTINATION_DB', 'dest_db');

$time_start = microtime(true);
ini_set('max_execution_time', 1000);

echo <<<EOD
<!DOCTYPE html>
<html>
<head>
<title>Oscommerce data importer</title>
</head>

<body>
<h1>TABLE import for Oscommerce 2.2 - > 2.3.4</h1>
<p>You will have to manually clean sec_directory_whitelist table for removing sample data. </p>
<ul>
EOD;

// ****** Tuncate tables ******
// Tables with sample data:
do_empty_table ("categories");
do_empty_table ("categories_description");
do_empty_table ("manufacturers");
do_empty_table ("manufacturers_info");
do_empty_table ("products");
do_empty_table ("products_attributes");
do_empty_table ("products_attributes_download");
do_empty_table ("products_description");
do_empty_table ("products_images");
do_empty_table ("products_options");
do_empty_table ("products_options_values");
do_empty_table ("products_options_values_to_products_options");
do_empty_table ("products_to_categories");
do_empty_table ("reviews");
do_empty_table ("reviews_description");
do_empty_table ("specials");

// Countries, zones, taxes and languages.
// Comment these lines if you have not modified them on original setup
do_empty_table ("languages");  // custom
do_empty_table ("countries");
do_empty_table ("geo_zones");
do_empty_table ("tax_class");
do_empty_table ("tax_rates");
do_empty_table ("zones");
do_empty_table ("zones_to_geo_zones");

// These should be empty; we'll drop data for caution:
do_empty_table ("address_book");
do_empty_table ("cache");
do_empty_table ("customers");
do_empty_table ("customers_info");
do_empty_table ("products_notifications");
do_empty_table ("orders");
do_empty_table ("orders_products");
do_empty_table ("orders_products_attributes");
do_empty_table ("orders_status"); // custom
do_empty_table ("orders_status_history");
do_empty_table ("orders_total");

// Comment if we don't have custom data on original database, otherwise leave as is:
do_empty_table ("address_format");
do_empty_table ("orders_status");

echo "</ul>";

// EJEMPLO:
//  ** standard fields from oscommerce: **
//    $mytable_fields = array("dato1","dato2","dato3","dato4","dato5","dato6");
//
//  Put here extra fields to add. Put here your custom fields i.e. if you have an alias field on customers table:
//    $mytable_fields[]="customers_alias";
//    echo add_custom_field ("customers", "customers_alias", "varchar(30)");
//  [...]
//    echo migrate ("customers", $mytable_fields);

// TABLE CATEGORIAS
    $mytable_fields = array("categories_id","categories_image","parent_id","sort_order","date_added","last_modified");
    echo migrate ("categories", $mytable_fields);
    
// TABLE CATEGORIAS - DESCRIPCIONES
    $mytable_fields = array("categories_id","language_id","categories_name");
    echo migrate ("categories_description", $mytable_fields);

// TABLE FABRICANTES
    $mytable_fields = array("manufacturers_id","manufacturers_name","manufacturers_image","date_added","last_modified");
    echo migrate ("manufacturers", $mytable_fields);

// TABLE FABRICANTES - INFORMACION
    $mytable_fields = array("manufacturers_id","languages_id","manufacturers_url","url_clicked","date_last_click");
    echo migrate ("manufacturers_info", $mytable_fields);

// TABLE PRODUCTOS
    $mytable_fields = array("products_id","products_quantity","products_model","products_image","products_price","products_date_added","products_last_modified","products_date_available","products_weight","products_status","products_tax_class_id","manufacturers_id","products_ordered");
    echo migrate ("products", $mytable_fields);

// TABLE PRODUCTOS - ATRIBUTOS
    $mytable_fields = array("products_attributes_id","products_id","options_id","options_values_id","options_values_price","price_prefix");
    echo migrate ("products_attributes", $mytable_fields);

// TABLE PRODUCTOS DE DESCARGA - ATRIBUTOS
    $mytable_fields = array("orders_products_download_id","orders_id","orders_products_id","orders_products_filename","download_maxdays","download_count");
    echo migrate ("orders_products_download", $mytable_fields);

// TABLE DESCRIPCION DE PRODUCTOS
    $mytable_fields = array("products_id","language_id","products_name","products_description","products_url","products_viewed");
    echo migrate ("products_description", $mytable_fields);

// TABLE NOTIFICACIONES DE PRODUCTOS
    $mytable_fields = array("products_id","customers_id","date_added");
    echo migrate ("products_notifications", $mytable_fields);

// TABLE OPCIONES DE PRODUCTOS
    $mytable_fields = array("products_options_id","language_id","products_options_name");
    echo migrate ("products_options", $mytable_fields);

// TABLE VALORES DE LAS OPCIONES DE PRODUCTOS
    $mytable_fields = array("products_options_values_id","language_id","products_options_values_name");
    echo migrate ("products_options_values", $mytable_fields);

// TABLE VALORES DE LAS OPCIONES A OPCIONES DE PRODUCTOS
    $mytable_fields = array("products_options_values_to_products_options_id","products_options_id","products_options_values_id");
    echo migrate ("products_options_values_to_products_options", $mytable_fields);    

//  TABLE PRODUCTOS A CATEGORIAS
    $mytable_fields = array("products_id","categories_id");
    echo migrate ("products_to_categories", $mytable_fields);

//  TABLE COMENTARIOS
    $mytable_fields = array("reviews_id","products_id","customers_id","customers_name","reviews_rating","date_added","last_modified","reviews_status","reviews_read");
    echo migrate ("reviews", $mytable_fields);

//  TABLE DESCRIPCIONES DE COMENTARIOS
    $mytable_fields = array("reviews_id","languages_id","reviews_text");
    echo migrate ("reviews_description", $mytable_fields);

//  TABLE OFERTAS ESPECIALES
    $mytable_fields = array("specials_id","products_id","specials_new_products_price","specials_date_added","specials_last_modified","expires_date","date_status_change","status");
    echo migrate ("specials", $mytable_fields);

// IDIOMAS,  PAISES, ZONAS E IMPUESTOS
//  TABLE IDIOMAS
    $mytable_fields = array("languages_id","name","code","image","directory","sort_order");
    echo migrate ("languages", $mytable_fields);    

//  TABLE PAISES
    $mytable_fields = array("countries_id","countries_name","countries_iso_code_2","countries_iso_code_3","address_format_id");
    echo migrate ("countries", $mytable_fields);    

//  TABLE GEOZONAS
    $mytable_fields = array("geo_zone_id","geo_zone_name","geo_zone_description","last_modified","date_added");
    echo migrate ("geo_zones", $mytable_fields);        

//  TABLE ZONAS
    $mytable_fields = array("zone_id","zone_country_id","zone_code","zone_name");
    echo migrate ("zones", $mytable_fields);        
    
//  TABLE ZONAS A GEOZONAS
    $mytable_fields = array("association_id","zone_country_id","zone_id","geo_zone_id","last_modified","date_added");
    echo migrate ("zones_to_geo_zones", $mytable_fields);
    
//  TABLE TIPOS DE IMPUESTOS
    $mytable_fields = array("tax_class_id","tax_class_title","tax_class_description","last_modified","date_added");
    echo migrate ("tax_class", $mytable_fields);
    
//  TABLE IMPUESTOS
    $mytable_fields = array("tax_rates_id","tax_zone_id","tax_class_id","tax_priority","tax_rate","tax_description","last_modified","date_added");
    echo migrate ("tax_rates", $mytable_fields);


// CLIENTES Y PEDIDOS
//  DIRECCIONES
    $mytable_fields = array("address_book_id","customers_id","entry_gender","entry_company","entry_firstname","entry_lastname","entry_street_address","entry_suburb","entry_postcode","entry_city","entry_state","entry_country_id","entry_zone_id");
    echo migrate ("address_book", $mytable_fields);

//  FORMATOS DE DIRECCIONES
    $mytable_fields = array("address_format_id","address_format","address_summary");
    echo migrate ("address_format", $mytable_fields);

// TABLE CLIENTES
    $mytable_fields = array("customers_id","customers_gender","customers_firstname","customers_lastname","customers_dob","customers_email_address","customers_default_address_id","customers_telephone","customers_fax","customers_password","customers_newsletter");
    // extra fields to add. Put here your custom fields:
    echo migrate ("customers", $mytable_fields);

// TABLE INFO DE CLIENTES
    $mytable_fields = array("customers_info_id","customers_info_date_of_last_logon","customers_info_number_of_logons","customers_info_date_account_created","customers_info_date_account_last_modified","global_product_notifications");
// Uncomment next two lines if you're importing from 2.3.2 onwards
//    $customers_info_fields[]="password_reset_key"; // 2.3.2 onwards
//    $customers_info_fields[]="password_reset_date"; // 2.3.2 onwards
    echo migrate ("customers_info", $mytable_fields);

//  NOTIFICACIONES
    $mytable_fields = array("products_id","customers_id","date_added");
    echo migrate ("products_notifications", $mytable_fields);

//  PEDIDOS
    $mytable_fields = array("orders_id","customers_id","customers_name","customers_company","customers_street_address","customers_suburb","customers_city","customers_postcode","customers_state","customers_country","customers_telephone","customers_email_address","customers_address_format_id","delivery_name","delivery_company","delivery_street_address","delivery_suburb","delivery_city","delivery_postcode","delivery_state","delivery_country","delivery_address_format_id","billing_name","billing_company","billing_street_address","billing_suburb","billing_city","billing_postcode","billing_state","billing_country","billing_address_format_id","payment_method","cc_type","cc_owner","cc_number","cc_expires","last_modified","date_purchased","orders_status","orders_date_finished","currency","currency_value");
    echo migrate ("orders", $mytable_fields);
    
//  PRODUCTOS DE UN PEDIDO
    $mytable_fields = array("orders_products_id","orders_id","products_id","products_model","products_name","products_price","final_price","products_tax","products_quantity");
    echo migrate ("orders_products", $mytable_fields);
    
//  ATRIBUTOS DE PRODUCTOS DE UN PEDIDO
    $mytable_fields = array("orders_products_attributes_id","orders_id","orders_products_id","products_options","products_options_values","options_values_price","price_prefix");
    echo migrate ("orders_products_attributes", $mytable_fields);
    
//  HISTORIAL DE ESTADOS DE UN PEDIDO
    $mytable_fields = array("orders_status_history_id","orders_id","orders_status_id","date_added","customer_notified","comments");
    echo migrate ("orders_status_history", $mytable_fields);

//  TOTALES DE UN PEDIDO
    $mytable_fields = array("orders_total_id","orders_id","title","text","value","class","sort_order");
    echo migrate ("orders_total", $mytable_fields);

//  RELACION DE ESTADOS DE UN PEDIDO
    $mytable_fields = array("orders_status_id","language_id","orders_status_name","public_flag","downloads_flag");
    echo migrate ("orders_status", $mytable_fields);

// FOR More pics users:
// mopics_import();

    $time_end = microtime(true);
    $time = $time_end - $time_start;

echo "<br>Execution time: $time seconds.";


function migrate ($TABLE, $campos) {

    $sql_insert  = "INSERT INTO " . $TABLE;
    $sql_insert .= " (".implode(", ", $campos).") ";
    
// Abre dos conexiones a las bases de datos de origen y destino
    $conn = new mysqli(DESTINATION_SERVER, DESTINATION_USER, DESTINATION_PASS, DESTINATION_DB); // destino
//    $conn->set_charset("utf8");
    $conn2 = new mysqli(SOURCE_SERVER, SOURCE_USER, SOURCE_PASS, SOURCE_DB); // origen
//    mysqli_set_charset ($conn2,"utf8");
//    echo "charset: " . mysqli_character_set_name($conn2) . ": ";

    $customers_query = "SELECT * from " . $TABLE;
    $origen = $conn2->query($customers_query);

    $contador =0;

    if ($origen->num_rows > 0) {

        while($row = $origen->fetch_assoc()) {
        $sql="";
        $sql_values ="";
        $sql_values .= " VALUES (";

        foreach ($campos as $valor) {
//            $valor = mb_convert_encoding($valor, "ISO-8859-1", "UTF-8");
            $sql_values .= "'" . addslashes ($row[strval($valor)]). "',";
        }

        $sql_values = rtrim($sql_values, ',');
        $sql_values .= ")";
        $sql = $sql_insert . $sql_values;

        if ($conn->query($sql) === TRUE) {
            $contador++;
        } else {
            echo "<font color='red'><b>Error: " . $conn->error . "<br>";
        }
    }
    echo '<b>TABLE: <font color="blue">' . $TABLE . ': </font>' .  $contador . ' rows copied<br>' . "\n";
    }
    $conn->close();
    $conn2->close();
}
function do_empty_table ($TABLE) {
    $conn = new mysqli(DESTINATION_SERVER, DESTINATION_USER, DESTINATION_PASS, DESTINATION_DB); // destino
    $sql = "TRUNCATE TABLE " . $TABLE;
    $result = $conn -> query($sql);
    $conn->close();
    echo "<li>TRUNCATE TABLE " . $TABLE . "</li>" . "\n";
}

function add_custom_field ($TABLE, $campo, $valores) {
    $conn = new mysqli(DESTINATION_SERVER, DESTINATION_USER, DESTINATION_PASS, DESTINATION_DB); // destino
    $sql1 = "ALTER TABLE ". $TABLE . " ADD " . $campo . " " . $valores;
    if ($conn->query($sql1) === TRUE) {
        echo '<b>' . $campo . " agregado a la TABLA " . $TABLE ."</b><br>";
    } else {
        echo '<font color="red"><b>Error:</b></font> ' . $conn->error . ' on table ' . $TABLE ."<br>";
    }
    $conn->close();
}

function mopics_import () {
// Lee las imágenes de cada producto
    $conn = new mysqli(DESTINATION_SERVER, DESTINATION_USER, DESTINATION_PASS, DESTINATION_DB); // destino
    $conn2 = new mysqli(SOURCE_SERVER, SOURCE_USER, SOURCE_PASS, SOURCE_DB); // origen

    $products_query ="select products_id, products_image, products_subimage1, products_subimage2, products_subimage3, products_subimage4, products_subimage5, products_subimage6 from products order by products_id";
    
    $origen = $conn2->query($products_query);
    
    $contador =0;
    if ($origen->num_rows > 0) {
        while ($prod = $origen->fetch_assoc()) {

        // lee imagen principal -> 1
            $insert = "INSERT INTO products_images
                       SET products_id = '".$prod['products_id']."',
                       image = '".$prod['products_image']."',
                       sort_order = 1";
            if ($conn->query($insert) === TRUE) {
                $contador++;
            } else {
                echo "<font color='red'><b>Error: " . $conn->error . "<br>";
            }

            // lee imagenes 1 a 6 -> 2 a 7
            for ($i = 1; $i <= 6; $i++) {
            if ($prod['products_subimage'.$i]) {
                $insert = "INSERT INTO products_images
                           SET products_id = '".$prod['products_id']."',
                           image = '".$prod['products_subimage'.$i]."',
                           sort_order = '".($i+1)."'";
                          
                if ($conn->query($insert) === TRUE) {
                    $contador++;
                    echo "<br><b>$contador:</b> products_id ".$prod['products_id'] . " - " . $prod['products_subimage'.$i];
                } else {
                    echo "<font color='red'><b>Error: " . $conn->error . "<br>";
                }
                
            }
        }
    }
  }
    $conn->close();
    $conn2->close();
}
?>



--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc Phoenix
Go to the top of the page
 
N.Serge
posté 28 Feb 2017, 08:20
Message #3


Ceinture orange OSC
Icône de groupe

Groupe : Membres
Messages : 277
Inscrit : 18-October 08
Membre no 23350



Grand merci , je vais essayer de m'y pencher sérieusement ! bien que ça m'à l'air chaud quand même.


--------------------
Version osCommerce Online Merchant v2.2 RC1 W3C Valid FR.
fckeditor-oscommerce_v2.2.1 ( bien ) - anti_spambot_contact_us_1.2 ( bien ) - Remise par catégorie (très bien) -Virement bancaire - Paypal IPN : V2.3 ( désactivé) - Déposit ( paiement avec acompte - très bien ) - Inactiveuser_1_3 ( pas terrible ) - Catégorie box ( génial ) -
Minimum_Order ( désactivé) - Minimum Amount To Make The Order ( très bien pour IE, mais bug pour autre navigateur )
discount_quant_v1 ( bien mais bug paypal et calcul sur le total du panier donc désactivé ) - lev_discountv2.4 ( bien mais bug paypal donc désactivé )
ParcelShop ( modification de la contrib kilopost - désactivé ) - TaxiPost ( bien - désactivé)


Version osCommerce Online Merchant v2.3.4 FR. (16/12/2016 test online )
Virement Bancaire 2.3.4.1 du 19/12/2016 (OK)
CKEditor 4.6.1 Full (OK)
Select Product Image Directory (OK)
Simple Order Discount (NON*) *remise sur tout le panier et non uniquement sur la quantité programmée


Go to the top of the page
 
Bonbec
posté 28 Feb 2017, 08:49
Message #4


Ceinture marron OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1543
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Re,

Je te conseille d'avoir 2 feuilles de papier.
Sur la première que je vais appeler (A), tu imprimes la structure détaillée de ta BDD de ton vieux site.
Sur la seconde que je vais appeler (B), tu imprimes la structure détaillée de ta BDD de ton nouveau site.

Tu prends (A) et tu regardes ligne par ligne ce qui est en commun avec (B) et tu coches les lignes dans (A) et (B).
Tu prends (A) et tu regardes ligne par ligne ce qui manque dans (B), en fait ce qui n'est pas coché) et tu l'ajoutes dans (B).

Je fais la suite du messages dans quelques dizaines de minutes, boulot oblige. Cela va te laisser le temps de faire cette étape préparatoire.


--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc Phoenix
Go to the top of the page
 
Bonbec
posté 28 Feb 2017, 14:16
Message #5


Ceinture marron OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1543
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



J'insiste sur un point : faire une sauvegarde des BDD avant de procéder à la suite.

Ensuite, si il y a des tables entières de (A) qui ne figurent pas dans (B), alors les créer manuellement la structure.

Maintenant en se servant de l'exemple donné dans le script (tpour mémoire) :
Code
// EJEMPLO:
//  ** standard fields from oscommerce: **
//    $mytable_fields = array("dato1","dato2","dato3","dato4","dato5","dato6");
//
//  Put here extra fields to add. Put here your custom fields i.e. if you have an alias field on customers table:
//    $mytable_fields[]="customers_alias";
//    echo add_custom_field ("customers", "customers_alias", "varchar(30)");
//  [...]
//    echo migrate ("customers", $mytable_fields);


Premier cas : Nouvelle table dont on a créé la structure dans (B).
Le nom de la table est à mettre en premier argument dans echo migrate ("..."); Ici : categories_more car elle existe dans (A) mais pas dans (B).
Le nom des champs de cette table sont à mettre dans $mytable_fields = array("..."); Ici : box_id, infobox_name, enabled, category1_id et category2_id
Exemple :
Code
// TABLE CATEGORIES_MORE => ajout après avoir créé la table manuellement dans la BDD
$mytable_fields = array("box_id","infobox_name","enabled","category1_id","category2_id");
echo migrate ("categories_more", $mytable_fields);


Le deuxième cas tout à l'heure, mon laser a terminé son travail et il faut que je retire les pièces fabriquées pour lancer un autre travail.


--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc Phoenix
Go to the top of the page
 
Bonbec
posté 28 Feb 2017, 14:51
Message #6


Ceinture marron OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1543
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Deuxième cas : la table existe mais il manque un champ :

La table : products_attributes
C'est la ligne echo migrate ("...");

Les champs existants : products_attributes_id, products_id, options_id, options_values_id, options_values_price et price_prefix
C'est la ligne $mytable_fields = array("");

Le champ manquant : products_options_sort_order
C'est la ligne $mytable_fields[]="...";

La ligne de création du champs manquant est echo add_custom_field ("products_attributes", "products_options_sort_order", "int(10)"); où :
- "products_attributes" correspond à la table
- "products_options_sort_order" correspond au nom du champ manquant
- "int(10)" correspond à la caractéristique du champ manquant

Ce qui donne :
Code
// TABLE PRODUCTOS - ATRIBUTOS
    $mytable_fields = array("products_attributes_id","products_id","options_id","options_values_id","options_values_price","price_prefix");
    $mytable_fields[]="products_options_sort_order";
    echo add_custom_field ("products_attributes", "products_options_sort_order", "int(10)");
    echo migrate ("products_attributes", $mytable_fields);


Troisième cas : il manque plusieurs champs :
Je garde la même table products_attributes pour l'exemple, ce sera plus facile pour la compréhension je pense.

La table : products_attributes
C'est la ligne echo migrate ("...");

Les champs existants : products_attributes_id, products_id, options_id, options_values_id, options_values_price et price_prefix
C'est la ligne $mytable_fields = array("");

Le 1er champ manquant : products_options_sort_order
C'est la ligne $mytable_fields[]="...";
Le 2ème champ manquant : products_options_two
C'est la 2ème ligne $mytable_fields[]="...";

La 1ère ligne de création du champs manquant est echo add_custom_field ("products_attributes", "products_options_sort_order", "int(10)"); où :
- "products_attributes" correspond à la table
- "products_options_sort_order" correspond au nom du champ manquant
- "int(10)" correspond à la caractéristique du champ manquant
La 2ème ligne de création du champs manquant est echo add_custom_field ("products_attributes", "products_options_two", "varchar(64)"); où :
- "products_attributes" correspond à la table
- "products_options_sort_two" correspond au nom du 2ème champ manquant
- "varchar(64)" correspond à la caractéristique du 2ème champ manquant

Ce qui donne :
Code
// TABLE PRODUCTOS - ATRIBUTOS
    $mytable_fields = array("products_attributes_id","products_id","options_id","options_values_id","options_values_price","price_prefix");
    $mytable_fields[]="products_options_order";
    $mytable_fields[]="products_options_two";
    echo add_custom_field ("products_attributes", "products_options_sort_order", "int(10)");
    echo add_custom_field ("products_attributes", "products_options_sort_two", "varchar(64)");
    echo migrate ("products_attributes", $mytable_fields);


Voilà, je pense qu'avec cela tu devrais t'en sortir.
N'hésite pas à poser des questions si certaines choses ne semblent pas claires.


--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc Phoenix
Go to the top of the page
 
Bonbec
posté 1 Mar 2017, 08:15
Message #7


Ceinture marron OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1543
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



RE,

J'ai oublié de préciser que si seules les catégories et les produits doivent être transférés, il faut supprimer tout ce qui concerne les autres tables dans le script.


--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc Phoenix
Go to the top of the page
 

Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



RSS Version bas débit Nous sommes le : 28th March 2024 - 16:03
Ce site est déclaré auprès de la commision Nationale
de l'Informatique et des Libertés (déclaration n°: 1043896)