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
  #11  
Old 02-15-2005, 05:46 AM
 
Zak Zak is offline
 

Member
  
Join Date: May 2004
Posts: 18
 

Default

I really like this mod Fernando did and implemented it on a site. Yet, we do have a problem with it in that once a customer gets to the products, no categories at all show up. I wonder if there is a way this could be written to show the subcategories of the root category where the products are located. Any ideas or help appreciated.

Zak
Version 4.0.11
Reply With Quote
  #12  
Old 02-15-2005, 05:50 AM
 
BerGer
    
Posts: n/a
 

Default

@mpj: please post your current status and some lines of code. Perhaps i can help you to solve the poblems.

@all: Is it possible to give out only the 1st category on each time in a new box?
Reply With Quote
  #13  
Old 02-15-2005, 07:24 AM
 
fernando fernando is offline
 

Member
  
Join Date: Oct 2004
Posts: 29
 

Default

Hi,

I'll check to see if the version posted here is up to date. If it isn't, I'll be glad to post the latest version later on.
__________________
Fernando
Sorry, I\'m not using x-cart anymore, so I am unable to reply to enquiries about modules. Thank you.
Reply With Quote
  #14  
Old 02-16-2005, 09:43 AM
 
mpj mpj is offline
 

Senior Member
  
Join Date: Feb 2005
Posts: 106
 

Default

fernando

your code works great! i implemented this with another mod and it IS exactly what I was looking for.

Had a real problem getting {parentid} and {categoryid}


many thanks.

- mpj


my code is still in beta so as soon as i get bugs out, i'll post and share with everyone.
__________________
X-Cart 4.0.11


{My simple mods}
Adding Market list and % save on product detail
Quantity input box
Reply With Quote
  #15  
Old 02-24-2005, 07:07 AM
 
Sonia Sonia is offline
 

Advanced Member
  
Join Date: Feb 2005
Posts: 72
 

Default Fernando's code

hi there! I have implemented Fernando's code too, and like it. I was wondering, though, if I can use that code to make my menu be expanded at all times. I would imagine it's a piece of that code, but I don't know what piece.
__________________
Sonia

www.vidaville.com
Xcart Gold 4.0.16
platform - Windows
Reply With Quote
  #16  
Old 02-24-2005, 07:56 AM
 
mpj mpj is offline
 

Senior Member
  
Join Date: Feb 2005
Posts: 106
 

Default

hi sonia,

you may want to look at this link

http://forum.x-cart.com/viewtopic.php?t=14905&highlight=subcategories

hth

- mpj
__________________
X-Cart 4.0.11


{My simple mods}
Adding Market list and % save on product detail
Quantity input box
Reply With Quote
  #17  
Old 02-24-2005, 08:07 AM
 
Sonia Sonia is offline
 

Advanced Member
  
Join Date: Feb 2005
Posts: 72
 

Default

Actually, I did, but I don't want that one because the list is unordered. I want to maintain the POS order I've determined in the software.
__________________
Sonia

www.vidaville.com
Xcart Gold 4.0.16
platform - Windows
Reply With Quote
  #18  
Old 02-25-2005, 04:37 AM
 
Sonia Sonia is offline
 

Advanced Member
  
Join Date: Feb 2005
Posts: 72
 

Default

Okay, I'm still wrestling with this code, and to top it off my partner and I keep changing our minds as to how to approach the navigation for our site.

At the moment, I am using the famous "Fernando Code", but the sort order is by alphabet. I have tried various changes to the "include/categories.php" page (see http://forum.x-cart.com/viewtopic.php?t=11876&highlight=categories+php), but the subcategory menu continues to list in alphabetical order. I think I need to sort the order in his code somehow, but I don't know how. Here's his code again, added of course to categories.tpl:

Code:
{* Added by Fernando. Show first level of subcategories *} {if $current_category ne "" } {section name=subcat loop=$allcategories} {assign var=topmostcat value=$allcategories[subcat].categoryid_path|regex_replace:"/\/.*/":""} {assign var=current_category_top value=$current_category.categoryid_path|regex_replace:"/\/.*/":""} {if $current_category_top eq $topmostcat and $categories[cat_num].categoryid eq $topmostcat and $allcategories[subcat].parentid eq $topmostcat and $allcategories[subcat].categoryid ne $current_category_top} {$allcategories[subcat].category|truncate:20:"...":true} {/if} {/section} {/if} {* End added by Fernando *}

I'm thinking there's got to be code I can add to his that will allow me to sort the list by "order_by" (POS) instead. Can anyone help me with this?
__________________
Sonia

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

Member
  
Join Date: Oct 2004
Posts: 29
 

Default

Hi Sonia,

Unfortunately, Smarty doesn't have an array ordering function (I did look for this one when I wrote the code...).

There's two options as I see it:

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)
2: create a smarty {sortarray} function. Perhaps a more drastic approach, but then again, a good way to contribute to a different project!!
__________________
Fernando
Sorry, I\'m not using x-cart anymore, so I am unable to reply to enquiries about modules. Thank you.
Reply With Quote
  #20  
Old 02-25-2005, 07:55 AM
 
Sonia Sonia is offline
 

Advanced Member
  
Join Date: Feb 2005
Posts: 72
 

Default

That would be me as a deer in headlights when it comes to smarty code, so I will have to think of something else for now.

Thanks, Fernando, both for supplying us all with that great code, and for responding now.
__________________
Sonia

www.vidaville.com
Xcart Gold 4.0.16
platform - Windows
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 10:21 AM.

   

 
X-Cart forums © 2001-2020