Pagina 1 di 1

lista dei prodotti delle categorie figlie in product list

Inviato: 30/08/2007, 17:14
da nextframe
sto cercando una contribution che faccia qualcosa di questo genere:

Esempio: ho appena cliccato su una categoria (contenitori) che contiene ancora 3 categorie figlie

cucina
(pentole)-[piatti]-{bicchieri}
(tegami-padelle-padellini)-[piatti fondi-piattipiani]-{per vino-per acqua-spumante}

attualmente visualizzo (pentole)-[piatti]-{bicchieri}

solo nel caso in cui clicco su una categoria figlia di pentole, piatti o bicchieri inizio a vedere i prodotti.

vorrei una contribution che mi fa vedere i prodotti appena clicco sulla categoria + ampia, facendomi vedere tutti i prodotti di quella categoria e delle categorie figlie. cliccando su una categoria figlia vado a restringere la ricerca visualizzando solo i prodotti inclusi nell'ultima cliccata e nelle categorie sue figlie.

clicco su cucina e vedo tutti i prodotti di cucina e delle sue categorie figlie: capito?

Inviato: 30/08/2007, 17:38
da berte
anche io cercavoq ualksoa del genere ma nn sono riuscito a trovare nulla :(

Inviato: 30/08/2007, 17:57
da dario00
cerchi una contrib del genere?
http://www.effedi.info/index.php?cPath=21
questo e il mio sito

Inviato: 02/09/2007, 12:15
da nextframe
no, neanche la tua esplorazione delle categorie è come quella che intendo io.

Inviato: 03/09/2007, 12:08
da nextframe
se interessasse a qualcuno ho realizzato la contribution.

Codice: Seleziona tutto


Maurizio Petrini - LUCCA - ITALY - www.mauriziopetrini.it - www.nextframe.it
Contribution for show the subcategory's products in category selected


file affected:
catalog/index.php
catalog/includes/function/general.php



install:

1)

 MAKE A BACKUP OF FILES

**************************************************************************************************************************

2)

IN TO "catalog/index.php"

FIND:

  if (isset($cPath) && tep_not_null($cPath)) {
    $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
    $cateqories_products = tep_db_fetch_array($categories_products_query);
    if ($cateqories_products['total'] > 0) {
      $category_depth = 'products'; // display products
    } else {
      $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
      $category_parent = tep_db_fetch_array($category_parent_query);
      if ($category_parent['total'] > 0) {
        $category_depth = 'nested'; // navigate through the categories
      } else {
        $category_depth = 'products'; // category has no products, but display the 'no products' message
      }
    }
  }

REPLACE WHIT:

  //Start Contribution see all subcategories products in category selected ------------------------
  if (isset($cPath) && tep_not_null($cPath)) {
       	$category_depth = 'products'; 
	$new_category[0]=$current_category_id;
	tep_array_category($new_category);
  }
  //End Contribution see all subcategories products in category selected ------------------------



**************************************************************************************************************************
3)

IN TO "catalog/index.php"

FIND:

      if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
        $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
      } else {
// We show them all
        $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
      }


REPLACE WHIT:

  //Start Contribution see all subcategories products in category selected ------------------------
      if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
        $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and (".$string_categories_sql.")";
      } else {
// We show them all
        $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and (".$string_categories_sql.")";
      }
  //End Contribution see all subcategories products in category selected ------------------------




**************************************************************************************************************************
4)

IN TO "catalog/includes/function/general.php"

FIND:

?>


ADD BEFORE:

//Start Contribution see all subcategories products in category selected ------------------------
function tep_array_category($array_category){
	global $string_categories_sql;
	$sql_string="";
	for($i=0;$i<count($array_category);$i++){
		if ($i>0){
			$sql_string.=" OR";
		}	
		$sql_string.=" parent_id = '" . (int)$array_category[$i] . "'";
	}
	$sql= "select categories_id from " . TABLE_CATEGORIES . " where";
	$sql .= $sql_string;
	$category_parent_query = tep_db_query($sql);
	$i=0;
	while( $category_parent = tep_db_fetch_array($category_parent_query)){
		if($string_categories_sql!=""){
			$string_categories_sql .= " OR ";
		}	
		$new_category[$i]=$category_parent["categories_id"];
		$i++;
		$string_categories_sql .= " categories_id = '".$category_parent["categories_id"]."' "  ;
	}
	if($i>0){
		tep_array_category($new_category);
	}else{
		if($string_categories_sql==""){
			$string_categories_sql = " categories_id = '".$array_category[0]."' ";
		}
	}
}
//End Contribution see all subcategories products in category selected ------------------------




**************************************************************************************************************************


5)

END