Sign in to follow this  
Followers 0

Exporter les produits

11 posts in this topic

Posted · Report post

Bonjour,

je oudrais savoir si il est possible d'exporter les fiches des produits afin de pouvoir par exemple imprimer un catalogue papier.

L'exporter vers access ou excel par exemple.

Et après soit utiliser un traitement de texte, ou publisher et insérer les données dans la page comme on le souhaite.

Merci

Share this post


: post
Share on other sites

Posted · Report post

 

Share this post


: post
Share on other sites

Posted · Report post

J'ai essayer d'exporter la table peel_produit epour excel ou en csv pour Ms excel.

Mais ca me donne des données qui ne sont pas sous forme de tableau comme normalement c'est le cas sous excel.

Est ce que il n'y a que ça où il y a une autre solution ?

Share this post


: post
Share on other sites

Posted · Report post

 

Share this post


: post
Share on other sites

Posted · Report post

Oui j'utilise l'export de phpmyadmin.

Share this post


: post
Share on other sites

Posted · Report post

J'ai créé un fichier export_produit qui se base sur export_clients.

Voici le code :

<?

include("../configuration.inc.php");

header("Content-Type: application/vnd.ms-excel");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

header("Content-disposition: filename=export_produits_".date("d-m-Y").".xls");

$sqlC = "SELECT u.* FROM peel_produits u INNER JOIN peel_sites_pivots sp ON (u.id_utilisateur = sp.utilisateur_id) WHERE sp.site_id = '".intval($_SESSION['ecom']['id'])."' AND u.priv = 'util'";

echo "Reference produit\t Nom\t Description\t Prix\r\n";

$resC = mysql_query($sqlC);

$elem = "";

while ($C = mysql_fetch_array($resC)) {

$elem .= html_entity_decode($C['reference'])." \t ";

$elem .= html_entity_decode($C['nom_fr'])." \t ";

$elem .= html_entity_decode($C['description_fr'])." \t ";

$elem .= html_entity_decode($C['prix'])." \t ";

}

echo "$elem\r\n";

function fxsl($chaine) {

$chaine = number_format($chaine,2);

$chaine = str_replace(".",",",$chaine);

$chaine = str_replace(" ","",$chaine);

return $chaine;

}

?>

Ensuite dans administrer/modeles/haut.php, j'ai rajouter où je veux Export produits.

Quand je test, je clic sur export produits.

J'ai la fenêtre pour ouvrir ou télécharger.

J'ouvre.

Dans excel, j'ai bien sur la première ligne les nom des catégories que j'ai mis.

Mais dans la deuxième ligne, là où il devrait y avoir les produits, dans la première cellule, j'ai un mesage d'erruer :

<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>d:\www\titiboutik.fr\htdocs\administrer\export_produits.php</b> on line <b>20</b><br />

Pouvez vous me dire d'où vient ce problème ?

Merci

Share this post


: post
Share on other sites

Posted · Report post

 

Share this post


: post
Share on other sites

Posted · Report post

Je dois mettre

mysql_query("SELECT reference,nom_".$_SESSION['langue'].",description_".$_SESSION['langue'].",prix FROM peel_produits WHERE etat=1");

à la place de

$sqlC = "SELECT u.* FROM peel_produits u INNER JOIN peel_sites_pivots sp ON (u.id_utilisateur = sp.utilisateur_id) WHERE sp.site_id = '".intval($_SESSION['ecom']['id'])."' AND u.priv = 'util'";

Si c'est le cas, j'ai un encore un message

Share this post


: post
Share on other sites

Posted · Report post

 

Share this post


: post
Share on other sites

Posted · Report post

En mettant le code là j'ai plus d'erreur.

<?

include("../configuration.inc.php");

header("Content-Type: application/vnd.ms-excel");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

header("Content-disposition: filename=export_produits_".date("d-m-Y").".xls");

echo "Reference produit\t Nom\t Description\t Prix\r\n";

$resC = mysql_query("SELECT reference,nom_".$_SESSION['langue'].",description_".$_SESSION['langue'].",prix FROM peel_produits WHERE etat=1");

$elem = "";

while ($C = mysql_fetch_array($resC)) {

$elem .= html_entity_decode($C['reference'])." \t ";

$elem .= html_entity_decode($C['nom_fr'])." \t ";

$elem .= html_entity_decode($C['description_fr'])." \t ";

$elem .= html_entity_decode($C['prix'])." \t ";

}

echo "$elem\r\n";

function fxsl($chaine) {

$chaine = number_format($chaine,2);

$chaine = str_replace(".",",",$chaine);

$chaine = str_replace(" ","",$chaine);

return $chaine;

}

?>

Quand j'ouvre le fichier Excel, ca ne se présente pas comme d'habitude. Ca fai pareil que quand j'exporte directement depuis phpmyadmin.

Et quand je lance publusher, je fais publipostage et j'ouvre une base de données.

Il me dit que ce n'est pas le bon format pour ouvrir la base de données.

Share this post


: post
Share on other sites

Posted · Report post

 

Share this post


: post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

Twitter Advisto ecommerce

Facebook PEEL Shopping