# 2.1- Importer par fichier des images produits

#### **<span style="color: rgb(0, 0, 0);">2.1.1- Introduction</span>**

<span style="color: rgb(0, 0, 0);">Il est possible de réaliser facilement un import de lot d'images pour intégrer des images sur un nombre important de produits, via un fichier csv ou excel.  
</span>

<p class="callout info">**<span style="color: rgb(24, 139, 175);">Note : </span>**<span style="color: rgb(0, 0, 0);">Le module natif "Import de données" doit être activé, et l'utilisateur doit avoir le droit de faire des imports.  
</span></p>

#### **<span style="color: rgb(0, 0, 0);">2.1.2- L'import</span>**

- <span style="color: rgb(0, 0, 0);">Depuis le menu du haut de votre Dolibarr cliquer sur le module </span><span style="color: rgb(24, 139, 175);">**Outils**</span>
- <span style="color: rgb(0, 0, 0);">Puis cliquer sur nouvel import sur le menu de gauche dans Assistant import  
    </span>

[![menu gauche import.png](https://doc.altairis.fr/uploads/images/gallery/2023-11/scaled-1680-/menu-gauche-import.png)](https://doc.altairis.fr/uploads/images/gallery/2023-11/menu-gauche-import.png)

- <span style="color: rgb(0, 0, 0);">Dans la liste de <span style="color: rgb(24, 139, 175);">**l'étape 1**</span> choisissez le **module<span style="color: rgb(24, 139, 175);"> Lots d'images</span>** ayant comme **lot de données importables <span style="color: rgb(24, 139, 175);">Lignes d'images de produits, </span>**en cliquant sur la flèche ![flèche.png](https://doc.altairis.fr/uploads/images/gallery/2023-11/scaled-1680-/fleche.png) ;</span>
- À **<span style="color: rgb(24, 139, 175);">l'étape 2<span style="color: rgb(0, 0, 0);">,</span></span>** choisissez le format d'import que vous souhaitez utiliser : CSV ou Excel en cliquant sur la flèche <span style="color: rgb(0, 0, 0);">![flèche.png](https://doc.altairis.fr/uploads/images/gallery/2023-11/scaled-1680-/fleche.png) ;</span>  
    
    - <span style="color: rgb(0, 0, 0);">Vous pouvez télécharger un modèle avant de sélectionner le format ;  
        </span>
- <span style="color: rgb(0, 0, 0);">À <span style="color: rgb(24, 139, 175);">**l’étape 3**<span style="color: rgb(0, 0, 0);">, a</span></span>jouter votre fichier en cliquant sur **<span style="color: rgb(24, 139, 175);">parcourir </span>**puis cliquer sur le bouton<span style="color: rgb(24, 139, 175);"> **ajouter fichier**<span style="color: rgb(0, 0, 0);"> ;</span>  
    </span></span>
    - <span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);">Vous pouvez télécharger un modèle avant d'ajouter votre fichier ;  
        </span></span></span>
    - <span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);">Une fois votre fichier ajouté, cliquer sur la flèche [![flèche.png](https://doc.altairis.fr/uploads/images/gallery/2023-11/scaled-1680-/fleche.png)](https://doc.altairis.fr/uploads/images/gallery/2023-11/fleche.png)</span></span></span><span style="color: rgb(0, 0, 0);"> ;</span>
- <span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);">À<span style="color: rgb(24, 139, 175);"> **l'étape 4**</span>, choisissez **les <span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);">champs cibles</span></span>** à importer, ils sont normalement prédéfinis. Si ce n'est pas le cas, sélectionnez dans la liste déroulante les éléments correspondant à la colonne (**ex:** colonne A Ref. interne dolibarr = Produit dans la liste déroulante des champs cibles) ;</span></span></span>
    - <span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);">Assurez-vous que <span style="color: rgb(24, 139, 175);">**les colonnes i et L restent vides dans les champ cibles**</span> correspondants, ils seront remplis automatiquement lors de l'import dans la base de données ;  
        </span></span></span>
    - <span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);">Cliquer sur<span style="color: rgb(24, 139, 175);"> **étape suivante<span style="color: rgb(0, 0, 0);"> </span>**<span style="color: rgb(0, 0, 0);">;</span></span>  
        </span></span></span>
- <span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);">À </span>**l'étape 5**<span style="color: rgb(0, 0, 0);">, cliquer sur<span style="color: rgb(24, 139, 175);"> **lancer la simulation d'import<span style="color: rgb(0, 0, 0);"> </span>**<span style="color: rgb(0, 0, 0);">;</span></span></span></span></span></span></span>
    - <span style="color: rgb(0, 0, 0);">cliquer sur <span style="color: rgb(24, 139, 175);">**lancer la simulation d'import<span style="color: rgb(0, 0, 0);"> </span>**<span style="color: rgb(0, 0, 0);">;  
        </span></span></span><span style="color: rgb(0, 0, 0);">Ici vous serez averti des **éventuelles erreurs** que peut contenir votre fichier ou le choix des champs cible ;</span>
        - <span style="color: rgb(0, 0, 0);">Si l'erreur provient de votre fichier, corrigez-le et reprenez à l'étape 3 ;  
            </span>
        - <span style="color: rgb(0, 0, 0);">Si l'erreur provient des champs cibles, r</span><span style="color: rgb(0, 0, 0);">eprenez à l'étape 4 et corrigez ;  
            </span>
        - <span style="color: rgb(0, 0, 0);">Si aucune erreur, cliquer sur <span style="color: rgb(24, 139, 175);">**importer les données<span style="color: rgb(0, 0, 0);"> </span>**<span style="color: rgb(0, 0, 0);">;</span></span></span>
    - <span style="color: rgb(0, 0, 0);">**Après import** un message en bleu apparaît avec le nombre de ligne importé ou mises à jours.</span>

[![champs-cibles-lot-d'images.png](https://doc.altairis.fr/uploads/images/gallery/2024-01/scaled-1680-/champs-cibles-lot-dimages.png)](https://doc.altairis.fr/uploads/images/gallery/2024-01/champs-cibles-lot-dimages.png)

*Champs cibles*

#### **<span style="color: rgb(0, 0, 0);">2.1.3- Comment remplir le fichier d'import</span>**

<span style="color: rgb(0, 0, 0);">Remplissez les colonnes de votre csv ou excel, dont vous aurez téléchargé un modèle d'exemple en amont. </span>

<span style="color: rgb(0, 0, 0);">**Laisser les colonnes** <span style="color: rgb(24, 139, 175);">**Créé par** <span style="color: rgb(0, 0, 0);">(user creat)</span></span>, <span style="color: rgb(24, 139, 175);">**Mis à jour par**</span> (user modif), **<span style="color: rgb(24, 139, 175);">Last main doc</span>**, <span style="color: rgb(24, 139, 175);">**Id import**</span> (import key), <span style="color: rgb(24, 139, 175);">**Ref.**</span></span><span style="color: rgb(0, 0, 0);"> et <span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);">**Statut** <span style="color: rgb(0, 0, 0);">(status, *sera mis automatiquement en <span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);">statut actif</span></span></span></span></span></span></span></span></span></span>*)<span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);"> </span></span></span></span></span></span></span></span></span></span> **vide** qui seront remplis automatiquement à l'import dans la base de données <span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);"><span style="color: rgb(24, 139, 175);"><span style="color: rgb(0, 0, 0);">(obligatoire pour réaliser l'import)</span></span></span></span>.</span>

<span style="color: rgb(0, 0, 0);"><span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);">Vous n’êtes pas obligé de remplir les colonnes <span style="color: rgb(24, 139, 175);">**note publique et privée**<span style="color: rgb(0, 0, 0);">.</span></span></span></span></span>

<span style="color: rgb(0, 0, 0);">Mettez une <span style="color: rgb(24, 139, 175);">**date de création**</span> ou une **<span style="color: rgb(24, 139, 175);">date de modification </span>**s'il s'agit d'un import pour effectuer une mise à jour, la date doit être au format suivant :</span>

- <span style="color: rgb(0, 0, 0);"><span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);">année-mois-jour (**ex :** 2015-01-01) ou année-mois-jour heures:minutes:secondes (**ex** : 2015-01-01 12:30:00).  
    </span></span></span>

<span style="color: rgb(0, 0, 0);"><span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);">Pour insérer <span style="color: rgb(24, 139, 175);">**le produit**</span> (fk\_product), vous pouvez : </span></span></span>

- <span style="color: rgb(0, 0, 0);"><span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);">Indiquer la ref. du produit (ref. dolibarr) ; </span></span></span>
- <span style="color: rgb(0, 0, 0);"><span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);">ou, si votre ref. est uniquement numérique, indiquer ref:123123 (où 123123 est la référence numérique de votre produit. Si vous n'indiquez pas ref: avant votre référence, Dolibarr va considérer que le nombre que vous importez est un ID de produit, pas une référence) ;</span></span></span>
- <span style="color: rgb(0, 0, 0);"><span style="color: rgb(186, 55, 42);"><span style="color: rgb(0, 0, 0);">Sinon vous pouvez rajouter le produit après l'import en modifiant la fiche *(ce qui n'est pas du tout pratique si vous importez beaucoup de lignes)*.  
    </span></span></span>