85 lines
4.4 KiB
Plaintext
Executable File
85 lines
4.4 KiB
Plaintext
Executable File
peux-tu ecrire un programme en php qui va prendre en entrée un fichier excel ou .csv grace à un bouton parcourir et charger le contenu de ce fichier dans les tables mysql correspondantes avec un bouton charger. Voilà le format des tables :
|
|
1 - table produit :
|
|
TABLE `produits` (
|
|
`idPrd` int(4) NOT NULL DEFAULT 0,
|
|
`refPrd` varchar(50) NOT NULL DEFAULT '-',
|
|
`idFam` int(3) DEFAULT 1,
|
|
`idCat` int(3) DEFAULT 1,
|
|
`lienImagePt` varchar(255) NOT NULL DEFAULT './Catalogue/_images_produits/prdDefaut.png',
|
|
`lienImageGd` varchar(255) NOT NULL DEFAULT './Catalogue/_images_produits/grandes/prdDefaut.png',
|
|
`promo` decimal(10,2) DEFAULT 0.00,
|
|
`gondole` int(1) DEFAULT 0,
|
|
`new` int(1) NOT NULL DEFAULT 0,
|
|
`afficheGond` int(3) DEFAULT 0,
|
|
`prixHt` decimal(12,4) DEFAULT 0.0000,
|
|
`prixTtc` decimal(12,4) DEFAULT 0.0000,
|
|
`tva` int(1) DEFAULT 0,
|
|
`idEtat` int(3) DEFAULT 1,
|
|
`delais` int(3) NOT NULL DEFAULT 1,
|
|
`uniteDelais` int(1) DEFAULT 0,
|
|
`poids` decimal(5,2) DEFAULT 0.00,
|
|
`unitePoids` int(1) DEFAULT 0,
|
|
`annee` varchar(4) NOT NULL DEFAULT '-',
|
|
`stock` int(3) DEFAULT 1,
|
|
`idPaysPrd` int(3) NOT NULL DEFAULT 0,
|
|
`idMailPrd` varchar(255) NOT NULL DEFAULT '-',
|
|
`couleur1` int(3) NOT NULL DEFAULT 0,
|
|
`couleur2` int(3) NOT NULL DEFAULT 0,
|
|
`couleur3` int(3) NOT NULL DEFAULT 0,
|
|
`idLargeur` decimal(9,2) NOT NULL DEFAULT 0.00,
|
|
`uniteLarg` int(2) NOT NULL DEFAULT 1,
|
|
`idHauteur` decimal(9,2) NOT NULL DEFAULT 0.00,
|
|
`uniteHaut` int(2) NOT NULL DEFAULT 1,
|
|
`idLongueur` decimal(9,2) NOT NULL DEFAULT 0.00,
|
|
`uniteLong` int(2) NOT NULL DEFAULT 1,
|
|
`idDates` int(3) NOT NULL DEFAULT 0,
|
|
`idType1` int(3) NOT NULL DEFAULT 0,
|
|
`idType2` int(3) NOT NULL DEFAULT 0,
|
|
`idType3` int(3) NOT NULL DEFAULT 0,
|
|
`idType4` int(3) NOT NULL DEFAULT 0,
|
|
`idType5` int(3) NOT NULL DEFAULT 0,
|
|
`idType6` int(3) NOT NULL DEFAULT 0,
|
|
`idType7` int(3) NOT NULL DEFAULT 0,
|
|
`idType8` int(3) NOT NULL DEFAULT 0,
|
|
`idType9` int(3) NOT NULL DEFAULT 0,
|
|
`idType10` int(3) NOT NULL DEFAULT 0,
|
|
`idType11` int(1) NOT NULL DEFAULT 0,
|
|
`idType12` int(1) NOT NULL DEFAULT 0,
|
|
`idType13` int(1) NOT NULL DEFAULT 0,
|
|
`idType14` int(1) NOT NULL DEFAULT 0,
|
|
`idType15` int(1) NOT NULL DEFAULT 0,
|
|
`idType16` int(1) NOT NULL DEFAULT 0,
|
|
`idType17` int(1) NOT NULL DEFAULT 0,
|
|
`idType18` int(1) NOT NULL DEFAULT 0,
|
|
`idType19` int(1) NOT NULL DEFAULT 0,
|
|
`idType20` int(1) NOT NULL DEFAULT 0,
|
|
`idType21` int(1) NOT NULL DEFAULT 0,
|
|
`idType22` int(1) NOT NULL DEFAULT 0,
|
|
`idType23` int(1) NOT NULL DEFAULT 0,
|
|
`lienImgGauche` varchar(200) NOT NULL DEFAULT '-',
|
|
`lienImgDroite` varchar(200) NOT NULL DEFAULT '-',
|
|
`lienImgDessus` varchar(200) NOT NULL DEFAULT '-',
|
|
`lienImgDessous` varchar(200) NOT NULL DEFAULT '-',
|
|
`lienVideo` varchar(200) NOT NULL DEFAULT '-',
|
|
`lienNotice` varchar(200) NOT NULL DEFAULT '-',
|
|
`statusPrd` int(1) NOT NULL DEFAULT 1
|
|
)
|
|
|
|
2 - table libelle des produits :
|
|
TABLE `produitslibelle` (
|
|
`numPrd` int(3) NOT NULL,
|
|
`idPrd` int(4) NOT NULL DEFAULT 0,
|
|
`idLg` char(3) NOT NULL DEFAULT '',
|
|
`nomPrd` varchar(115) NOT NULL DEFAULT '',
|
|
`descCourt` text NOT NULL,
|
|
`descLong` text NOT NULL DEFAULT '-'
|
|
)
|
|
idLg peut valoir 'FRA', 'ENG', 'DEU', 'ESP' ou 'ITA'. Si vide forcer à 'FRA'.
|
|
une fois le fichier d'entrée chargé avec le bouton parcourir, il faudra le charger dans la base de données mysql avec PDO et les points suivants :
|
|
- il faut faire un contrôle des champs obligatoires et de leur format pour chaque champ.
|
|
- En cas d'erreur d'un champs d'entrée il faut signaler l'erreur en français et proposer de continuer en ignorant l'erreur ou bien d'arrêter tout le chargement.
|
|
- il faudra aussi proposer un bouton parcourrir pour telecharger un dossier d'images. Chaque lien d'image dans le fichier excel doit pouvoir correspondre a une image existante dans le dossier d'image. Le format zip est accepté, dans ce cs il faudra le décompresser. Les images svg, png, bmp, gif, jpeg, jpg, webp sont acceptées. les autres format non.
|
|
|
|
- il faut en plus faire une page d'explication en php moderne, avec un lien pour ouvrir cette page en mode modale à partir d'un petit icone d'aide. La page d'explication doit expliquer ce qui est attendu dans le fichier d'entrée .csv ou excel. le css doit etre inclus dans la page. un exemple dans la page d'aide est nécessaire
|
|
|
|
Egalement fournit moi séparement un exemple de fichier excel ou .csv d'entrée compatible, avec 5 produits, ainsi qu'un fichier zip avec 5 images grandes et 5 images petites correspondant aux 5 produits |