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

V4 - keeping first level subcategories viewable at all times

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #21  
Old 02-25-2005, 09:40 AM
 
Sonia Sonia is offline
 

Advanced Member
  
Join Date: Feb 2005
Posts: 72
 

Default

Yes, I'm still at it...and am feeling stupid with this Smarty code.

I added this code to home.tpl

Code:
{if $smarty.get.cat eq "248"} {include file="menu_blah.tpl"} {elseif $categories ne "" and ($active_modules.Fancy_Categories ne "" or $config.General.root_categories eq "Y" or $subcategories ne "")} { include file="customer/categories.tpl" }

The file "menu_blah.tpl" is the custom menu I want to show in all the pages of a certain category. The problem is that menu only shows on one page, not the rest of it's category. I'm sure the code I need to change is : {$smarty.get.cat eq "248"}, but to what?

I'm still trying to control the order of the menu being shown at any given time. Like the control freak I am...

Thanks in advance...
__________________
Sonia

www.vidaville.com
Xcart Gold 4.0.16
platform - Windows
Reply With Quote
  #22  
Old 02-25-2005, 09:55 AM
 
fernando fernando is offline
 

Member
  
Join Date: Oct 2004
Posts: 29
 

Default

I'm not sure what's in $smarty.get.cat. Would it be the current category that you're browsing?

In my code, I figure out what the (topmost) category we're browsing is by:

Code:
{assign var=current_category_top value=$current_category.categoryid_path|regex_replace:"/\/.*/":""}

So that variable current_category_top will hold the topmost category in the current category tree.

So if you're browsing

Food :: Chinese :: Noodles :: Very thin ACME noodles

current_category_top will report "Food". Would this do the trick for you?

This is all trial and error... but I'd suggest you'd try this:

Code:
{assign var=current_category_top value=$current_category.categoryid_path|regex_replace:"/\/.*/":""} {if $current_category_top eq "248"} {include file="menu_blah.tpl"} {elseif $categories ne "" and ($active_modules.Fancy_Categories ne "" or $config.General.root_categories eq "Y" or $subcategories ne "")} { include file="customer/categories.tpl" }
__________________
Fernando
Sorry, I\'m not using x-cart anymore, so I am unable to reply to enquiries about modules. Thank you.
Reply With Quote
  #23  
Old 02-25-2005, 10:30 AM
 
Sonia Sonia is offline
 

Advanced Member
  
Join Date: Feb 2005
Posts: 72
 

Default

Fernando, you're a genius. That worked perfectly. It's a bit manual, but it's really only me that makes changes to this sort of thing, so that's okay.

Brilliant! I can move onto all the other annoying details...

Have a good one!
__________________
Sonia

www.vidaville.com
Xcart Gold 4.0.16
platform - Windows
Reply With Quote
  #24  
Old 02-25-2005, 10:39 AM
 
fernando fernando is offline
 

Member
  
Join Date: Oct 2004
Posts: 29
 

Default

Amazing how I can't ever get it right the first time around when I work for my own store! Haha!

Glad I could be of help.
__________________
Fernando
Sorry, I\'m not using x-cart anymore, so I am unable to reply to enquiries about modules. Thank you.
Reply With Quote
  #25  
Old 03-15-2005, 10:34 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Quote:
1: modify categories.php so that the allcategories array is sorted by position (or probably better, create a sorted allcategories array clon and working with it from the .tpl)

Been messing with categories.php, and I have manged to get the sub-cats to be nicely ordered by position in the admin area, but no such luck on the customer side. Here's what I have in categories.php:

Code:
if ($flag == "all") $sort_condition = " ORDER BY $sql_tbl[categories].order_by"; else $sort_condition = " ORDER BY $sql_tbl[categories].order_by"; } elseif (defined('MANAGE_CATEGORIES')) $sort_condition = " ORDER BY $sql_tbl[categories].order_by";

Any other place I should be adding an order_by??? Thanks in advance!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #26  
Old 03-17-2005, 12:04 PM
 
gabriela gabriela is offline
 

Member
  
Join Date: Sep 2003
Posts: 22
 

Default

I commented out
Code:
usort($all_categories, "func_categories_sort");
around line 154 and works for me.
Reply With Quote
  #27  
Old 03-17-2005, 02:11 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Beautiful, thanks!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #28  
Old 03-20-2005, 03:50 PM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default

I'm trying to implement the code from zilker (thanks, btw ), and till now I manage to display the categories horizontal in the head and to show the subcategories in the left menu, when a categorie is clicked.
So far so good...

But after clicking on a subcategorie the whole box with subcategories disappears. Like zilker I would like the box with subcategories to stay visible so a customer can choose another subcategorie without having to click again on the categorie.
I've tried to use the code provided by shan, but without any luck...

Could someone please be so kind to show how to do this?
Many thanks in advance!
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
  #29  
Old 04-11-2005, 10:34 AM
  Hyperdelicious's Avatar 
Hyperdelicious Hyperdelicious is offline
 

Senior Member
  
Join Date: Sep 2002
Location: In the Middle of Nowhere
Posts: 138
 

Default show sub categories only when main category is selected

This mod works great in 4.0.13 by combining heads Fernando and Gabriela provide X-er's with code that will list sub categories under the main category

Example:

MAIN NAV 1
MAIN NAV 2
sub nav 1
sub nav 2
sub nav 3
sub nav 4
MAIN NAV 3
MAIN NAV 4

Just add Fernando's code to customer/main/subcategories.tpl and to ensure categories maintain their 'order by' status take Gabriela's advice editing out 'usort' item within the includes/categories.php.

One other thing I hadn't found mentioned here... you must have "Always show Root Categories' checked in the admin section under general settings.

Thanks.
Reply With Quote
  #30  
Old 04-12-2005, 02:59 PM
 
Jerrad Jerrad is offline
 

X-Adept
  
Join Date: Nov 2004
Location: The Netherlands
Posts: 484
 

Default

I've got it also working, but I'm looking for a solution to display all levels
of subcategories.
Not in a permanent way but only when a first level subcategorie is clicked.
The link below shows roughly what I'm looking for.

http://www.udm4.com/demos/expanding-multiple.php
__________________
X-Cart 4.0.12
Heavy modified with paid, free and forum mods.
PHP 5.2.5 | MYSQL 5.0.51a
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:48 AM.

   

 
X-Cart forums © 2001-2020