1 AND parent_category=1 "; $SQL = $SQL . " ORDER BY $temp ASC;"; $retid = mysql_query($SQL); if (!$retid) { echo( mysql_error()); } $i=0; while ($row = mysql_fetch_array($retid)) { $idcategory[$i] = $row["idcategory"]; $name[$i] = $row[$temp]; $i++; }//end while $nrcategory=$i; $stringutil = new String(); $ft = new FastTemplate(TEMPLATE_PATH); $ft->define(array("main"=>"template_allcategories.html")); $ft->define_dynamic("row","main"); for ($i=0;$i<$nrcategory;$i++) { //$ft->assign("ID_CATEGORY",$idcategory[$i]); $name[$i] = $stringutil->CleanLink($name[$i]); //$ft->assign("CATEGORIES",str_replace("+","_",urlencode($name[$i]))); // listallsubcategories.php/{CATEGORIES}/{ID_CATEGORY}/all if (NONSEO==1) $ft->assign("URL_TYPE", "listallsubcategories.php?name=".str_replace("+","_",urlencode($name[$i]))."&id=".$idcategory[$i].""); else $ft->assign("URL_TYPE", "listallsubcategories.php/".str_replace("+","_",urlencode($name[$i]))."/".$idcategory[$i]."/all"); $ft->assign("SUBCATEGORIES",$this->getSubcategories($idcategory[$i], $LANG)); $ft->parse("ROW",".row"); }// end for $ft->multiple_assign_define("LANG_"); $ft->parse("mainContent", "main"); $ft->showDebugInfo(ERROR_DEBUG); $c = $ft->fetch("mainContent"); return $c; }//end getCategories function getSubcategories($parentid, $LANG) { global $cid; $temp = $LANG."_name"; $SQL = " SELECT * FROM ".DB_PREFIX."category WHERE parent_category=".$parentid; $SQL = $SQL . " ORDER BY $temp ASC;"; $retid = mysql_db_query(DB_NAME, $SQL, $cid); if (!$retid) { echo( mysql_error()); } $i=0; while ($row = mysql_fetch_array($retid)) { $idcategory[$i] = $row["idcategory"]; $name[$i] = $row[$temp]; $i++; }//end while $nrsubcat=$i; $stringutil = new String(); $ft = new FastTemplate(TEMPLATE_PATH); $ft->define(array("main"=>"template_allcategoriessubcat.html")); $ft->define_dynamic("row1","main"); if ($nrsubcat>0) { for ($i=0;$i<$nrsubcat;$i++) { //$ft->assign("ID_CATEGORY",$idcategory[$i]); $name[$i] = $stringutil->CleanLink($name[$i]); //$ft->assign("SCATEGORY",str_replace("+","_",urlencode($name[$i]))); $ft->assign("NRPROD", $this->getNumberProducts($idcategory[$i])); // category.php/{SCATEGORY}/{ID_CATEGORY}/ if (NONSEO==1) $ft->assign("URL_TYPE", "category.php?name=".str_replace("+","_",urlencode($name[$i]))."&id=".$idcategory[$i].""); else $ft->assign("URL_TYPE", "category.php/".str_replace("+","_",urlencode($name[$i]))."/".$idcategory[$i]."/"); if ($i!=$nrsubcat-1) $ft->assign("COMMA", ","); else $ft->assign("COMMA", " "); $ft->parse("ROW1",".row1"); }//end for $ft->multiple_assign_define("LANG_"); $ft->parse("mainContent", "main"); $ft->showDebugInfo(ERROR_DEBUG); $c = $ft->fetch("mainContent"); } else { $c=""; } return $c; }//end getSubcategories function listAllCategories($LANG) { //selectarea tuturor produselor $SQL = "SELECT * FROM ".DB_PREFIX."category WHERE idcategory!=1 AND parent_category=1"; $retid = mysql_query($SQL) or die(mysql_error()); $nrtotalcateg = mysql_num_rows($retid); $temp = $LANG."_name"; $ord = $temp; $ordby = "ASC"; $SQL = " SELECT * FROM ".DB_PREFIX."category WHERE idcategory!=1 AND parent_category=1"; $SQL .= " ORDER BY ".$ord." ".$ordby; if (!$retid) { echo( mysql_error()); } $retid = mysql_query($SQL); $i=0; if ($row = mysql_fetch_array($retid)) do{ $id_category[$i] = $row["idcategory"]; $name[$i] = $row[$temp]; $i++; }while ($row = mysql_fetch_array($retid)); $number = $i; $ft = new FastTemplate(TEMPLATE_PATH); $ft->define(array("main"=>"template_category_listallcategories.html")); $ft->assign("SITE_NAME",SITE_NAME); $ft->assign("INDEX_URL",INDEX_URL); $NRCOLUMNCATEG = 2; $rest = $number % $NRCOLUMNCATEG; $buffer = ""; $buffer = $buffer. "\n"; $i=0; $j=0; $stringutil = new String(); while ($i<($number-$rest)) { $buffer = $buffer."\n"; for($qq=1;$qq<=$NRCOLUMNCATEG;$qq++) { $buffer = $buffer."\n"; $i++; }// end for $buffer = $buffer."\n"; }// end while if ($rest!=0) { $buffer = $buffer."\n"; for($qq=1;$qq<=$rest;$qq++) { $buffer = $buffer."\n"; $i++; } // end for for($qq=1;$qq<=$NRCOLUMNCATEG-$rest;$qq++) $buffer = $buffer."\n"; $buffer = $buffer."\n"; } // end if $buffer = $buffer."
\n"; // changed by zoli $buffer = $buffer."CleanLink($name[$i]); $buffer = $buffer.str_replace("+","_",urlencode($name[$i])); $buffer = $buffer."/"; $buffer = $buffer.$id_category[$i]; $buffer = $buffer."/\">\n"; //$buffer = $buffer."\n"; // end changeing $buffer = $buffer.$name[$i]; $buffer = $buffer."(".$this->getNumberProducts($id_category[$i]).")"; $buffer = $buffer."
"; if ($this->getSubcategories($id_category[$i], $LANG)!="") $buffer = $buffer. $this->getSubcategories($id_category[$i], $LANG); else $buffer = $buffer. " "; $buffer = $buffer."
\n"; // changed by zoli $buffer = $buffer."CleanLink($name[$i]); $buffer = $buffer.str_replace("+","_",urlencode($name[$i])); $buffer = $buffer."/"; $buffer = $buffer.$id_category[$i]; $buffer = $buffer."/\">\n"; //$buffer = $buffer."\n"; // end changeing $buffer = $buffer.$name[$i]; $buffer = $buffer."(".$this->getNumberProducts($id_category[$i]).")"; $buffer = $buffer."
"; if ($this->getSubcategories($id_category[$i], $LANG)!="") $buffer = $buffer. $this->getSubcategories($id_category[$i], $LANG); else $buffer = $buffer. " "; $buffer = $buffer."
 
\n"; $ft->assign("LISTCATEG", $buffer); $ft->multiple_assign_define("LANG_"); $ft->parse("mainContent", "main"); $ft->showDebugInfo(ERROR_DEBUG); $c = $ft->fetch("mainContent"); return $c; }//end listAllCategories function getNumberProducts($idcat) { $SQL = "SELECT count(id_product) FROM ".DB_PREFIX."product WHERE id_category=".$idcat." AND availability=1"; $retid = mysql_query($SQL) ; if (!$retid) { echo( mysql_error()); } $nrprod = 0; if ($row = mysql_fetch_array($retid)) { $nrprod = $row[0]; }//end if return $nrprod; }//end getNumberProducts() }//end class ?>