| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Need help customizing category listing | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Need help customizing category listing
OK... I need some help from the pros here... I am trying to do a customization for the category listing and just cant figure it out.
What I would like is when you click on a category, that you have the subcategory listing below the catagory that was clicked. I know that you can nest sections, but I can't figure out the proper way to do it. The closest that I have gotten is: Code:
This is close but not right. It list the first category only once, then list the main categories again as su categories. Then when you click on a category, it DOES list the sub categories inder the category clicked, but it does not list the remaining categories. If I change it to: Code:
Am I making any sense at all? |
|||||||||
#2
|
|||||||
|
|||||||
Cascading Category/SubCategory Listings
Unfortunately, I have planned on doing this for a customer, but have not worked through it yet. But, I'll take a stab at this one...
If you are at the top level of the category tree, the subcategories are the same as the top-level categories, and that is why the first piece of code shows the main categories where you are expecting to see subs. The reason they aren't repeated is likely because you are using the same counter (cat_num) for both section loops. When it finishes the second section loop, the counter is left at the end and is falling out of the both the nested and outer loop. In the second piece of code your two loops are exclusive of one another, meaning that the first loop completes {/section} prior to starting the second loop. At the top level, I would expect it to run the whole category listing twice? Sorry, this has been more diagnostic of your code and not helping yet. The first code snippet looks the closest. You need to give each counter variable a different name and add a test to see if the category is the same as the category that was selected prior to listing the subcategories. Otherwise, you will not know where to cascade the subcategory listing. I can work up an example next week if you still are stuck. Hope this helps!
__________________
-Derrick FreeRangeMinds, LLC |
|||||||
#3
|
|||||||
|
|||||||
I am trying to get this same feature. I found a site that utilizes it on a different platform. oscommerce open source storefront. The store is carnutz.cc. I am not a programmer by any means, but would love to pickup this code.
Thanks |
|||||||
#4
|
|||||||
|
|||||||
SOLUTION - Category Listing w/nested subcategories
Much easier than I thought. TelaFirma was _really_ close, just added a simple check for match of $cat. This was made to the 3.2.1 customer/categories.tpl file... I didn't build a third option for root_categories, I just used the "N" option.
Quote:
__________________
-Derrick FreeRangeMinds, LLC |
|||||||
#5
|
|||||||
|
|||||||
I am using version 2.4. Was able to get this to work, somewhat. Few issues, not sure if you guys are experiencing with a newer version.
1) Empty categories (no products) are showing up. 2) Once I click on the subcategory, they go away only displaying the top categories. Needs to show the second level sub categories. Please let me know if you are not having these problems. If not, I will look to upgrading. Thanks |
|||||||
#6
|
|||||||
|
|||||||
Hmmm
Jeff,
I just checked on this and you are right, once you click on the subcategory, the category list reverts back to the top level categories only instead of staying with the subcategory listing. Not a big surprise considering it reparses the category listings using the new "cat" that you just clicked on and it doesn't have any subcategories to the sub-category you just clicked on. Let me think about that and look at the code tomorrow. What about multi-level sub-categories? The "hack" that I sent out will only work for one level of sub-category. Do you have multiple levels of sub-categories? On the issue of empty categories being displayed, the existing system already did that. If you want to shut off a category that doesn't have any products, you can "disable" that category in the admin interface.
__________________
-Derrick FreeRangeMinds, LLC |
|||||||
#7
|
|||||||
|
|||||||
I do have multi levels of categories, but I only want to display the main category and the first sub-category on the left bar.
My store will be setup offering different categories and different items under that. For ease of naviagtion, once a customer picks the initial category, which they will most likely remain within, they can then navigate within that category very easily. I will utilize the disable function on empty categories. Thank you! |
|||||||
#8
|
|||||||||
|
|||||||||
Yes, this is VERY close... I think that if we could just keep the single sub-cateogry list displayed, that would be enough to be useful...
|
|||||||||
#9
|
|||||||
|
|||||||
Cascading Category Names
Sorry for the delay. Looks like I need to make a small change to categories.php. I'm booked solid today, but will get a change out tomorrow (Friday US time) to do this.
__________________
-Derrick FreeRangeMinds, LLC |
|||||||
#10
|
|||||||||
|
|||||||||
No rush... no rush at all....
|
|||||||||
|
|||
X-Cart forums © 2001-2020
|