Hallo ams,
wenn dir so etwas gefällt
[ Für Gäste sind keine Dateianhänge sichtbar ]
habe ich hier etwas für modified 2.0 mit Template 'tpl_modified' zusammengestellt .
Im 'template/tpl_modified/source/boxes/categories.php' alles mit folgendem Code ersetzen
<?php/* -----------------------------------------------------------------------------------------
$Id: categories.php 4200 2013-01-10 19:47:11Z Tomcraft1980 $
modified eCommerce Shopsoftware
http://www.modified-shop.org
Copyright (c) 2009 - 2013 [www.modified-shop.org]
-----------------------------------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(categories.php,v 1.23 2002/11/12); www.oscommerce.com
(c) 2003 nextcommerce (categories.php,v 1.10 2003/08/17); www.nextcommerce.org
(c) 2006 XT-Commerce
Released under the GNU General Public License
-----------------------------------------------------------------------------------------
Third Party contributions:
Enable_Disable_Categories 1.3 Autor: Mikel Williams | mikel@ladykatcostumes.com
Released under the GNU General Public License
---------------------------------------------------------------------------------------*/// include smartyinclude(DIR_FS_BOXES_INC
. 'smarty_default.php');// set cache id$cache_id = md5($_SESSION['language'].$_SESSION['customers_status']['customers_status'].'-'.$cPath.((SPECIALS_CATEGORIES
=== true || WHATSNEW_CATEGORIES
=== true) ?
'-'.basename($PHP_SELF) : ''));if (!$box_smarty->is_cached(CURRENT_TEMPLATE
.'/boxes/box_categories.html', $cache_id) || !$cache) { // include needed functions require_once (DIR_FS_CATALOG
.'templates/'.CURRENT_TEMPLATE
.'/source/inc/xtc_show_category.inc.php'); require_once (DIR_FS_CATALOG
.'templates/'.CURRENT_TEMPLATE
.'/source/inc/close_ul_tags.inc.php'); require_once (DIR_FS_INC
.'xtc_has_category_subcategories.inc.php'); require_once (DIR_FS_INC
.'xtc_count_products_in_category.inc.php'); $foo = array(); $categories_string = ''; unset($prev_id); $categories_query = xtDBquery
("SELECT c.categories_id,
cd.categories_name,
c.parent_id
FROM ".TABLE_CATEGORIES
." c
JOIN ".TABLE_CATEGORIES_DESCRIPTION
." cd
ON c.categories_id = cd.categories_id
AND cd.language_id='".(int
)$_SESSION['languages_id']."'
AND trim(cd.categories_name) != ''
WHERE c.categories_status = '1'
".CATEGORIES_CONDITIONS_C
."
ORDER BY c.sort_order, cd.categories_name"); if (xtc_db_num_rows
($categories_query, true) > 0) { $sub_categories = array(); while ($categories = xtc_db_fetch_array
($categories_query, true)) { if ($categories['parent_id'] == 0) { $categories['cat_link'] = xtc_href_link
(FILENAME_DEFAULT
, xtc_category_link
($categories['categories_id'],$categories['categories_name'])); $foo[$categories['categories_id']] = array ( 'name' => $categories['categories_name'], 'link' => $categories['cat_link'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo[$prev_id]['next_id'] = $categories['categories_id']; } $prev_id = $categories['categories_id']; if (!isset ($first_element)) { $first_element = $categories['categories_id']; } } else { if (!in_array($categories['parent_id'], $sub_categories)) $sub_categories[] = $categories['parent_id']; } } if (!empty($sub_categories)) { $new_path = ''; $id = $sub_categories; reset($id); while (list ($key, $value) = each($id)) { unset ($prev_id); unset ($first_id); $categories_query = xtDBquery
("SELECT c.categories_id,
cd.categories_name,
c.parent_id
FROM ".TABLE_CATEGORIES
." c
JOIN ".TABLE_CATEGORIES_DESCRIPTION
." cd
ON c.categories_id = cd.categories_id
AND cd.language_id='".(int
)$_SESSION['languages_id']."'
AND trim(cd.categories_name) != ''
WHERE c.categories_status = '1'
AND c.parent_id = '".$value."'
".CATEGORIES_CONDITIONS_C
."
ORDER BY c.sort_order, cd.categories_name"); if (xtc_db_num_rows
($categories_query, true) > 0) { $new_path .= $value; while ($row = xtc_db_fetch_array
($categories_query, true)) { $row['cat_link'] = xtc_href_link
(FILENAME_DEFAULT
, xtc_category_link
($row['categories_id'], $row['categories_name'])); $foo[$row['categories_id']] = array ( 'name' => $row['categories_name'], 'link' => $row['cat_link'], 'parent' => $row['parent_id'], 'level' => $key +1, 'path' => $new_path.'_'.$row['categories_id'], 'next_id' => false ); $foo[$row['categories_id']]['level'] = $foo[$row['parent_id']] ['level'] +1; //p3e/web28 dauerhaft aufgeklappte Kategorien if (isset ($prev_id)) { $foo[$prev_id]['next_id'] = $row['categories_id']; } $prev_id = $row['categories_id']; if (!isset ($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } $foo[$last_id]['next_id'] = isset($foo[$value]['next_id']) ?
$foo[$value]['next_id'] : 0; $foo[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } if (!empty($first_element)) { xtc_show_category
($first_element); } $box_smarty->assign('BOX_CONTENT', $categories_string); }}if (!$cache) { $box_categories = $box_smarty->fetch(CURRENT_TEMPLATE
.'/boxes/box_categories.html');} else { $box_categories = $box_smarty->fetch(CURRENT_TEMPLATE
.'/boxes/box_categories.html', $cache_id);}$smarty->assign('box_CATEGORIES', $box_categories);?> Im 'template/tpl_modified/source/inc/xtc_show_category.inc.php' alles mit folgendem Code ersetzen
<?php /* -----------------------------------------------------------------------------------------
$Id: xtc_show_category.inc.php 4200 2013-01-10 19:47:11Z Tomcraft1980 $
modified eCommerce Shopsoftware
http://www.modified-shop.org
Copyright (c) 2009 - 2013 [www.modified-shop.org]
-----------------------------------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(categories.php,v 1.23 2002/11/12); www.oscommerce.com
(c) 2003 nextcommerce (xtc_show_category.inc.php,v 1.4 2003/08/13); www.nextcommerce.org
(c) 2010 web28 (xtc_show_category.inc.php, v 2.1 2010/11/12); www.rpa-com.de
Released under the GNU General Public License
---------------------------------------------------------------------------------------*/ function xtc_show_category
($counter, $oldlevel=1) { global $foo, $categories_string, $id, $cPath; $level = $foo[$counter]['level']+1; //BOF +++ UL LI Verschachtelung mit Quelltext Tab Einzügen +++ $ul = $tab = ''; for ($i = 1; $i <= $level; $i++) { $tab .= "\t"; } //BOF +++ Kategorien markieren +++ $category_path = explode('_',$cPath); //Kategoriepfad in Array einlesen if ($level > $oldlevel) { //neue Unterebene// $ul = "\n" . $tab. '<ul>'. "\n"; $ul = "\n" . $tab. '<div class="category_button">' . (in_array($foo[$counter]['parent'], $category_path) ?
'-' : '+') . '</div><ul class="subcategories" ' . (!in_array($foo[$counter]['parent'], $category_path) ?
'style="display: none;' : '') . '">'. "\n"; // Kategorien mit Button aufklappen und zuklappen $categories_string = rtrim($categories_string, "\n"); //Zeilenumbruch entfernen $categories_string = substr($categories_string, 0, strlen($categories_string) -5); //letztes </li> entfernen } elseif ($level < $oldlevel) { //zurück zur höheren Ebene $ul = close_ul_tags
($level,$oldlevel); } //EOF +++ UL LI Verschachtelung mit Quelltext Tab Einzügen +++ //Elternkategorie markieren $cat_active_parent = ''; $in_path = in_array($counter, $category_path); //Testen, ob aktuelle Kategorie ID im Kategoriepfad enthalten ist if ($in_path) $cat_active_parent = " activeparent".$level; //Aktive Kategorie markieren $cat_active = ''; $this_category = array_pop($category_path); //Letzter Eintrag im Array ist die aktuelle Kategorie if ($this_category == $counter) $cat_active = " active".$level; //EOF +++ Kategorien markieren +++ //BOF +++ Kategorie Linkerstellung +++ if (trim($categories_string == '')) $categories_string = "\n"; //Zeilenschaltung Codedarstellung $categories_string .= $ul; //UL LI Versschachtelung $categories_string .= $tab; //Tabulator Codedarstellung // $categories_string .= '<li class="level'.$level.$cat_active.$cat_active_parent.'">'; $categories_string .= '<li class="category_li level'.$level.$cat_active.$cat_active_parent.'">'; // Kategorien mit Button aufklappen und zuklappen $categories_string .= '<a href="'.$foo[$counter]['link'].'" title="'. $foo[$counter]['name'] . '">'; $categories_string .= $foo[$counter]['name']; //Anzeige Anzahl der Produkte in Kategorie, für bessere Performance im Admin deaktivieren if (SHOW_COUNTS
== 'true') { $products_in_category = xtc_count_products_in_category
($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '</a></li>'; $categories_string .= "\n"; //Zeilenschaltung Codedarstellung //EOF +++ Kategorie Linkerstellung +++ //Nächste Kategorie if ($foo[$counter]['next_id']) { xtc_show_category
($foo[$counter]['next_id'], $level); } else { if ($level > 1) $categories_string .= close_ul_tags
(1,$level); return; } }?> Im 'template/tpl_modified/stylesheet.css' folgenden Code ganz am Ende einfügen
/* START Kategorien mit Button aufklappen und zuklappen */
.category_li {
position: relative;
}
.category_button {
font-size: 20px;
line-height: 26px;
width: 27px;
height: 27px;
background-color: #e3e3e3;
color: #444;
text-align: center;
cursor:pointer;
position: absolute;
top: 0;
right: 0;
}
ul#categorymenu li.level1 a,
ul#categorymenu li.level2 a,
ul#categorymenu li.level3 a,
ul#categorymenu li.level4 a,
ul#categorymenu li.level5 a {
padding-right: 28px;
}
/* ENDE Kategorien mit Button aufklappen und zuklappen */
Im 'template/tpl_modified/javascript/general_bottom.js.php' folgenden Code ganz am Ende einfügen, also nach '<?php } ?>'
<!-- START Kategorien mit Button aufklappen und zuklappen -->
<script>
$(function(){
$('.category_button').click(function() {
var $this = $(this);
$this.siblings('.subcategories').slideToggle();
$this.text($this.text() == "+" ? "-" : "+");
});
});
</script>
<!-- ENDE Kategorien mit Button aufklappen und zuklappen -->
Gruss
Hanspeter