Jump to content

Créer un lien (client) pour exporter les produits (dropshipping)


PauseGreen

Recommended Posts

Bonjour,

Je souhaiterai créer un lien pour permettre à mes clients professionnels en dropshipping, d'extraire mes produits afin de maintenir à jour leur stock.

Il y a bien la requête d'export disponible sur Backoffice:

SELECT SQL_CALC_FOUND_ROWS p.`id_product`  AS `id_product`,
 p.`reference`  AS `reference`,
 sa.`price`  AS `price`,
 p.`id_shop_default`  AS `id_shop_default`,
 p.`is_virtual`  AS `is_virtual`,
 pl.`name`  AS `name`,
 pl.`link_rewrite`  AS `link_rewrite`,
 sa.`active`  AS `active`,
 shop.`name`  AS `shopname`,
 image_shop.`id_image`  AS `id_image`,
 cl.`name`  AS `name_category`,
 0 AS `price_final`,
 pd.`nb_downloadable`  AS `nb_downloadable`,
 sav.`quantity`  AS `sav_quantity`,
 IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`,
 cp.`position`  AS `position` 
FROM  `******_product` p 
 LEFT JOIN `******_product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = 1 AND pl.`id_shop` = 1) 
 LEFT JOIN `******_stock_available` sav ON (sav.`id_product` = p.`id_product` AND sav.`id_product_attribute` = 0 AND sav.id_shop = 1  AND sav.id_shop_group = 0 ) 
 JOIN `******_product_shop` sa ON (p.`id_product` = sa.`id_product` AND sa.id_shop = 1) 
 LEFT JOIN `******_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND cl.`id_lang` = 1 AND cl.id_shop = 1) 
 LEFT JOIN `******_category` c ON (c.`id_category` = cl.`id_category`) 
 LEFT JOIN `******_shop` shop ON (shop.id_shop = 1) 
 LEFT JOIN `******_image_shop` image_shop ON (image_shop.`id_product` = p.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = 1) 
 LEFT JOIN `******_image` i ON (i.`id_image` = image_shop.`id_image`) 
 LEFT JOIN `******_product_download` pd ON (pd.`id_product` = p.`id_product`) 
 INNER JOIN `******_category_product` cp ON (cp.`id_product` = p.`id_product` AND cp.`id_category` = 2) 
WHERE (1 AND state = 1)
 
ORDER BY  `id_product` asc
 
LIMIT 0, 300
;

 

J'ai créer un bouton sur l'espace mon compte

1165292292_boutonpro.jpg.2d35b51bc0d7eed2f2dfdad74de4ea23.jpg

Mais je ne sais pas comment créer un lien pouvant être disponible sans passer par le BackOffice voir même si cela est possible.

Car le lien actuel:

https://pausegreen.fr/admin***************/index.php/sell/catalog/products/export?_token=*********************************

Fonctionne seulement si je suis connecté au BackOffice.

Merci pour votre aide.

 

 

Link to comment
Share on other sites

Bonjour,

Tout d'abord merci pour la réponse.

Êtes vous sûr qu'un lien est disponible sur le front pour que les clients puissent télécharger le fichier.csv ?

---

Je reste ouvert à toutes autres solutions, via un fichier.html, j'ai fait quelques essais mais ça ne donne rien de positif.

<html>
<head>
<title> </title>
</head>
<body>

<?php

// DSN

$dsn = 'mysql:host=********;
		dbname=***********;
		port=**********;
		charset=utf8';

// Test de la connexion

try {
 
$pdo = new PDO($dsn, 'mdp_bdd' , '');

}
catch (PDOException $exception) {
 
 mail('**********@*******.fr', 'PDOException', $exception->getMessage());
 exit('Erreur de connexion à la base de données');
 
}

// Requête export produit

$query = $pdo->query("SELECT SQL_CALC_FOUND_ROWS p.`id_product`  AS `id_product`,
 p.`reference`  AS `reference`,
 sa.`price`  AS `price`,
 p.`id_shop_default`  AS `id_shop_default`,
 p.`is_virtual`  AS `is_virtual`,
 pl.`name`  AS `name`,
 pl.`link_rewrite`  AS `link_rewrite`,
 sa.`active`  AS `active`,
 shop.`name`  AS `shopname`,
 image_shop.`id_image`  AS `id_image`,
 cl.`name`  AS `name_category`,
 0 AS `price_final`,
 pd.`nb_downloadable`  AS `nb_downloadable`,
 sav.`quantity`  AS `sav_quantity`,
 IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`,
 cp.`position`  AS `position` 
FROM  `******_product` p 
 LEFT JOIN `******_product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = 1 AND pl.`id_shop` = 1) 
 LEFT JOIN `******_stock_available` sav ON (sav.`id_product` = p.`id_product` AND sav.`id_product_attribute` = 0 AND sav.id_shop = 1  AND sav.id_shop_group = 0 ) 
 JOIN `******_product_shop` sa ON (p.`id_product` = sa.`id_product` AND sa.id_shop = 1) 
 LEFT JOIN `******_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND cl.`id_lang` = 1 AND cl.id_shop = 1) 
 LEFT JOIN `******_category` c ON (c.`id_category` = cl.`id_category`) 
 LEFT JOIN `******_shop` shop ON (shop.id_shop = 1) 
 LEFT JOIN `******_image_shop` image_shop ON (image_shop.`id_product` = p.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = 1) 
 LEFT JOIN `******_image` i ON (i.`id_image` = image_shop.`id_image`) 
 LEFT JOIN `******_product_download` pd ON (pd.`id_product` = p.`id_product`) 
 INNER JOIN `******_category_product` cp ON (cp.`id_product` = p.`id_product` AND cp.`id_category` = 2) 
WHERE (1 AND state = 1)
ORDER BY  `id_product` asc
LIMIT 0, 300;");

$resultat = $query->fetchAll();

?>

</body>
</html>

 

Link to comment
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
×
×
  • Create New...