Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Drop down/flyout categories... where do I start?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-26-2003, 09:16 AM
  JeffQuestad's Avatar 
JeffQuestad JeffQuestad is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 33
 

Default Drop down/flyout categories... where do I start?

I want to make a fly out version of my cateogy menu.... Something I am used to doing in Dreamweaver in static web sites, but not in a site like this.

Is there a plug in available, even a commecially available one, that will make this easier? I would like categoires to flyout showing subcategories, etc.

Thanks
Reply With Quote
  #2  
Old 09-26-2003, 11:36 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Is it just one level of subcategories that you would like?
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 09-26-2003, 11:37 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

also what version are you running?
__________________
ex x-cart guru
Reply With Quote
  #4  
Old 09-26-2003, 11:43 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Actually...here's the code for include/categories.php:

Code:
<? /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2003 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2003 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: categories.php,v 1.46.2.1 2003/06/02 11:57:44 svowl Exp $ # # # For users some categories may be disabled # if ($current_area == "C") { $membership_condition = " AND ($sql_tbl[categories].membership='$user_account[membership]' OR $sql_tbl[categories].membership='') "; } else { $membership_condition = ""; } // funkydunk modification // amended query to get the main cat and subcat for each record $categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 1) as maincat, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 2) as subcat from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category")); # # Put all categories into $all_categories array and find current_category # by categoryid stored in $cat # if(!$categories_data) $categories_data = array(); foreach($categories_data as $k=>$category_data) { if ($current_area == "C") { $int_res = func_query_first("SELECT * FROM $sql_tbl[categories_lng] WHERE code='$store_language' AND categoryid='$category_data[categoryid]'"); if ($int_res["category"]) $categories_data[$k]["category_name"] = $category_data["category_name"] = $int_res["category"]; if ($int_res["description"]) $categories_data[$k]["description"] = $category_data["description"] = $int_res["description"]; } if ($category_data["categoryid"]==$cat) { $current_category = $category_data; } // funkydunk code if(strstr($category_data["category"],"/")) { if ($category_data["category"] == $category_data["subcat"]){ // echo "got one"; // after taking off the initial category name this checks to see if this is only a sub category with no categories below it. // if i didn't do this the subcategory would be duplicated in the list $categories_data[$k]["subcatonly"]="true"; } } // end of funkydunk amended code $all_categories = $categories_data; // func_print_r ($all_categories); } # # Put all root categories to $categories array # Put all subcategories of current_category to $categories array # foreach($all_categories as $all_category) { $category=$all_category["category"]; $cur_dir_len = strlen($current_category["category"]); if(!strstr($category,"/")) { $categories[]=$all_category; if(empty($current_category)) { $subcategories[]=$all_category; } } if(substr($category,0,$cur_dir_len+1) == $current_category["category"]."/" and $category!=$current_category["category"]) if(!strstr(substr($category,$cur_dir_len+1),"/")) { $all_category["category"]=ereg_replace("^.*/","",$all_category["category"]); $subcategories[]=$all_category; } } # # Put subcategory_count to $subcategories array # if ($subcategories) foreach($subcategories as $key =>$subcategory) { $subcategory["subcategory_count"]=0; foreach($all_categories as $all_category) { if ($all_category["categoryid"]==$subcategory["categoryid"]) { $cur_dir_len = strlen($all_category["category"]); $current_subcategory=$all_category["category"]; } } foreach($all_categories as $all_category) { $category=$all_category["category"]; if(substr($category,0,$cur_dir_len+1) == $current_subcategory."/" and $category!=$current_subcategory) if(!strstr(substr($category,$cur_dir_len+1),"/")) $subcategory["subcategory_count"]++; } $subcategories[$key]["subcategory_count"]=$subcategory["subcategory_count"]; } # # Generate category sequence, i.e. # Books, Books/Poetry, Books/Poetry/Philosophy ... # $current_category_array = explode("/",$current_category["category"]); $prev = $current_category_array[0]; list($key,$val)=each($current_category_array); $new_array = array($val); while(list($key,$val)=each($current_category_array)) { $new_array[] = $prev."/".$val; $prev = $prev."/".$val; } unset($current_category_array); # # Generate array for displaying categories sequence in location # $category_location=array(); reset($all_categories); $my_cats = array (); foreach($all_categories as $all_category) { $categoryid=$all_category["categoryid"]; $category=$all_category["category"]; $my_cats [$categoryid] = $category; } asort ($my_cats); foreach ($my_cats as $categoryid => $category) { reset ($new_array); while(list($key,$val)=each($new_array)) { if ($val==$category) { foreach($categories_data as $category_data) { if ($category_data["categoryid"] == $categoryid) $val = $category_data["category_name"]; } $category_location[]=array(ereg_replace(".*/","",$val),"home.php?cat=".$categoryid); } } } # # Assign Smarty variables # $smarty->assign("allcategories",$all_categories); $smarty->assign("categories",$categories); $smarty->assign("subcategories",$subcategories); $smarty->assign("current_category",$current_category); $smarty->assign("cat",$cat); ?>
__________________
ex x-cart guru
Reply With Quote
  #5  
Old 09-29-2003, 06:52 AM
  JeffQuestad's Avatar 
JeffQuestad JeffQuestad is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 33
 

Default

I am running the most recent version of X-Cart. We just installed it last week.

I would actually like the menus to show more than one level deep of subcategorie, at least one more.

I am looking over this chunk of code you sent me now to see if it makes sense to me. I'm not especially experienced with this kind of thing.

Jeff
Reply With Quote
  #6  
Old 10-08-2003, 12:14 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Jeff

I am working on a downloadable mod for drop down menus whereby you can just switch this on/off in admin and have all the submenus poluated by the database.

I will let you know when it is complete.
__________________
ex x-cart guru
Reply With Quote
  #7  
Old 10-27-2003, 11:04 AM
 
cbarning cbarning is offline
 

Advanced Member
  
Join Date: Aug 2003
Posts: 38
 

Default SubCategories

Is that Sub Cat thing work with ver 3.4.6?
__________________
4.0.0 in dev, 3.4.14 deluxegrills.com, 3.4.6 kegworks.com Modded by X-Cart: Freight Zones, Linkshare, Shipping Fixes, Individual Product Shipping Methods, Banners, Custom Export for FileMaker Pro, PHP: 4.3.7, MySQL server: 4.0.20, Apache1.3.1 OS: Linux
Reply With Quote
  #8  
Old 10-28-2003, 01:58 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

It will work with 3.4.x and 3.5.x versions when completed....still about a week or so away I am afraid
__________________
ex x-cart guru
Reply With Quote
  #9  
Old 10-28-2003, 01:52 PM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

Hi Funky,

I definitely want this mod too. I need a horozontal category list where each parent category goes into its own table cell. Will that type of set up work with what you're doing?

Thanks,
Cameron
Reply With Quote
  #10  
Old 10-29-2003, 12:06 PM
 
cbarning cbarning is offline
 

Advanced Member
  
Join Date: Aug 2003
Posts: 38
 

Default Can it be done like the OS Commerce style?

Can it be done like the OS Commerce style?

Main Cat
Sub Cat 1
Sub Cat 2
Main Cat
Main Cat
Main Cat
__________________
4.0.0 in dev, 3.4.14 deluxegrills.com, 3.4.6 kegworks.com Modded by X-Cart: Freight Zones, Linkshare, Shipping Fixes, Individual Product Shipping Methods, Banners, Custom Export for FileMaker Pro, PHP: 4.3.7, MySQL server: 4.0.20, Apache1.3.1 OS: Linux
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:33 AM.

   

 
X-Cart forums © 2001-2020