Jump to content

Export de produits d'un catégorie spécifique -


Recommended Posts

Bonjour,

 

Je voudrais pouvoir extraire seulement les produits appartenant à une catégorie spécifique à partir de ce script :

 

SELECT
p.`id_product` AS `ID`,
p.`active` AS `Actif`,
pl.`name` AS `Nom`,
p.`price` AS `Price`,
p.`reference`AS `reference`,
p.`ecotax` AS `Ecotax`,
p.`weight` AS `Weight`,
p.`quantity` AS `Quantity`,
pl.`description_short` AS `Desc_short`,
pl.`description` AS `Desc_long`,
p.`id_category_default` AS `categorie`
FROM `ps_product` p
LEFT JOIN `ps_product_lang` pl ON (p.`id_product` = pl.`id_product`) 
WHERE pl.`id_lang` = 2
 
Est-il possible de modifier ce script pour (par exemple) extraire uniquement les produits qui appartiendraient à la catégorie 48 ?
Je pense que oui mais je ne sais pas comment m'y prendre....
 
Merci pour votre aide
Edited by chti56 (see edit history)
Link to comment
Share on other sites

Salut,

SELECT
p.`id_product` AS `ID`,
p.`active` AS `Actif`,
pl.`name` AS `Nom`,
p.`price` AS `Price`,
p.`reference`AS `reference`,
p.`ecotax` AS `Ecotax`,
p.`weight` AS `Weight`,
p.`quantity` AS `Quantity`,
pl.`description_short` AS `Desc_short`,
pl.`description` AS `Desc_long`,
p.`id_category_default` AS `categorie`
FROM `ps_product` p
LEFT JOIN `ps_product_lang` pl ON (p.`id_product` = pl.`id_product`) 
WHERE pl.`id_lang` = 2
AND p.`id_category_default` = 48

La facon simple si tes produits sotn en categorie par default 48 sinon il faut encore croiser des tables....

Edited by Alex-Kodd (see edit history)
Link to comment
Share on other sites


SELECT

p.`id_product` AS `ID`,

p.`active` AS `Actif`,

pl.`name` AS `Nom`,

p.`price` AS `Price`,

p.`reference`AS `reference`,

p.`ecotax` AS `Ecotax`,

p.`weight` AS `Weight`,

p.`quantity` AS `Quantity`,

pl.`description_short` AS `Desc_short`,

pl.`description` AS `Desc_long`,

p.`id_category_default` AS `categorie`

FROM `ps_product` p

LEFT JOIN `ps_product_lang` pl ON (p.`id_product` = pl.`id_product`)

LEFT JOIN `ps_category_product` cp ON (p.`id_product` = cp.`id_product`)

WHERE pl.`id_lang` = 2

AND cp.`id_category` = 48

 

Link to comment
Share on other sites

Bonjour,

Merci pour le coup de main.. Ca fonctionne parfaitement.

 

Par contre (et ça n'a rien à voir avec le script), lors de l'import j'ai une erreur Timout qui m'empêche d'importer les produits exportés grâce à ce script.

 

Merci encore !!

 

JP

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...