osCommerce France : Accueil Forum Portail osCommerce France Réponses aux questions Foire aux contributions

Bienvenue invité ( Connexion | Inscription )

 
Reply to this topicStart new topic
> categories_status dans product all, Comment intégrer categorie status dans la page product all ?
polo
posté 22 Oct 2015, 14:58
Message #1


Ceinture marron OSC
Icône de groupe

Groupe : Membres
Messages : 1441
Inscrit : 24-April 03
Membre no 1102



Bonjour,


J'ai 2 code à adapter, il s'agit de la query de la page product all, actuellement elle m'affiche toute les catégorie et tous les produits, même ceux qui sont inactif, comment faire ?

voici le code de categorie status

Code
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_status = '1' and c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");


et voici le code de la page product all:

Code
  $all_products_query = tep_db_query("select c.categories_id, c.categories_name, p.products_id, p.products_model, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_description, m.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join . " . TABLE_MANUFACTURERS . " m on m.manufacturers_id = p.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES_DESCRIPTION . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc where p.products_id = pd.products_id and p.products_id = pc.products_id and p.products_status = 1 and pc.categories_id = c.categories_id AND c.language_id = '" . (int)$languages_id . "' and pd.language_id = '" . (int)$languages_id . "'" . " order by c.categories_name, pd.products_name asc");


Comment fusionner les 2 ?

Merci pour votre aide..


--------------------
OSC 2.1.3 et MS2 (PHP Version 5.2.17)
Go to the top of the page
 
Bonbec
posté 3 Nov 2015, 10:40
Message #2


Ceinture marron OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1543
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Bonjour,

Je ne suis pas bien doué dans les queries mais je vais essayer.
Si je comprends bien ta première requête, tu as un champ categories_status dans ta table TABLE_CATEGORIES.

Si oui, alors ta 2ème requète devrait ressembler à ceci :
Code
  $all_products_query = tep_db_query("select c.categories_id, c.categories_name, p.products_id, p.products_model, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_description, m.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join . " . TABLE_MANUFACTURERS . " m on m.manufacturers_id = p.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " tc, " . TABLE_CATEGORIES_DESCRIPTION . " c, " .TABLE_PRODUCTS_TO_CATEGORIES . " pc where tc.categories_status = '1' and p.products_id = pd.products_id and p.products_id = pc.products_id and p.products_status = 1 and pc.categories_id = c.categories_id AND c.language_id = '" . (int)$languages_id . "' and pd.language_id = '" . (int)$languages_id . "'" . " order by c.categories_name, pd.products_name asc");

Pas testé ...


--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc Phoenix
Go to the top of the page
 
polo
posté 5 Nov 2015, 10:31
Message #3


Ceinture marron OSC
Icône de groupe

Groupe : Membres
Messages : 1441
Inscrit : 24-April 03
Membre no 1102



Merci pour ton aide Bonbec,

Mais apparemment il y à encore une erreur car j'ai un jolie internal server error. biggrin.gif



--------------------
OSC 2.1.3 et MS2 (PHP Version 5.2.17)
Go to the top of the page
 

Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



RSS Version bas débit Nous sommes le : 28th March 2024 - 20:09
Ce site est déclaré auprès de la commision Nationale
de l'Informatique et des Libertés (déclaration n°: 1043896)