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

How do I display all subcategories along with all products

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 10-26-2007, 10:37 AM
 
mikalou mikalou is offline
 

Advanced Member
  
Join Date: Jun 2005
Posts: 71
 

Default Re: How do I display all subcategories along with all products

That store that I linked to is 4.1.8 and I used the instructions that were listed in a post above mine with the one modification that I mentioned in one of my other posts.
__________________
X-Cart Gold 4.2.2 - 3.1.19
Reply With Quote
  #12  
Old 10-26-2007, 03:29 PM
  designtheweb's Avatar 
designtheweb designtheweb is offline
 

Senior Member
  
Join Date: Mar 2005
Location: Sydney Australia
Posts: 132
 

Default Re: How do I display all subcategories along with all products

I have tried this one and it works well except for one thing, it is only showing up the products of the last category not in other categories with products on the same level.

Any ideas?

Thanks.
__________________
"The more you know - the less you pay"

Various websites using

4.66 Pro & 5
Reply With Quote
  #13  
Old 10-27-2007, 05:27 PM
 
MoonDog MoonDog is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 93
 

Default Re: Display SubCategory titles with products

I just created something similar to what you need from an old posting a couple of days ago.
I just modified it a little to make it work on v4.1.8

First of all, kudos to the creator and all those that contributed to the original mod.

Start by opening up the xcart/include/categories.php file.
And find these lines of code: (it's at the bottom)
Code:
if (!empty($subcategories)) $smarty->assign("subcategories", $subcategories); $smarty->assign("cat", $cat); ?>
And right above those lines of code add:
Code:
//Subcategories in menu function sort_by_order_by($a, $b) { if ($a['order_by'] == $b['order_by']) { return 0; } return ($a['order_by'] < $b['order_by']) ? -1 : 1; } function func_getallsubcat() { $raj =func_get_categories_list("", true, "all"); $raj1=$raj['all_categories']; usort($raj1 ,"sort_by_order_by"); $ll=array(); foreach ($raj1 as $k=>$val) { if($val['parentid']!="0") { $ll[$val['parentid']][]=$val; } } return $ll; } $smarty->assign("allsubcategories", func_getallsubcat()); //Subcategorie in menu - end

Now, replace your skin1/customer/categories.tpl with this modified categories.tpl

Code:
{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *} {* modified *} <div id="sidenavcontainer"> {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {include file="modules/Fancy_Categories/categories.tpl"} {assign var="fc_cellpadding" value="0"} {else} {if $config.General.root_categories eq "Y"} <ul id="mainmenu"> {foreach from=$categories item=c} {if $cat eq $c.categoryid || $current_category.parentid eq $c.categoryid} <li><h3><a class="current" href="home.php?cat={$c.categoryid}">{$c.category}</a></h3></li> {else} <li><h3><a href="home.php?cat={$c.categoryid}">{$c.category}</a></h3></li> {/if} {assign var=in value=$c.categoryid} {* CONDITIONAL DROP DOWN ITEMS FROM TOP CATEGORY *} <ul id="submenu"> {foreach from=$allsubcategories.$in item=c } {if $cat eq $c.categoryid} <li><h4><a class="current" href="home.php?cat={$c.categoryid}">{$c.category}</a></h4></li> {else} <li><h4><a href="home.php?cat={$c.categoryid}">{$c.category}</a></h4></li> {/if} {/foreach} </ul> {* /CONDITIONAL *} {/foreach} {else} {foreach from=$subcategories item=c key=catid} <li><a href="home.php?cat={$catid}">{$c.category}</a></li> {/foreach} {/if} </ul> {/if} </div> {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}
And the last thing you need to do is copy the following code and add it to the bottom of your skin1.css file
Code:
/** * sidenavcontainer is 181px wide and a minimum of 400px high * It has a little padding top and bottom as well * Modify it to suit your layout */ html, body, ul, ol, li, p, h1, h2, h3, h4, h5, h6, form, fieldset, a { list-style-type: none; margin: 0; padding: 0; border: 0; } /*#sidenavcontainer { padding:200px 0 10px 0; PADDING-LEFT: 20px; PADDING-BOTTOM: 10px; width:181px; min-height:0px; float:left; } */ h3{ /* PRODUCT CATEGORIES */ padding:200; margin:100; font-size:11px; font-style:normal; font-weight:normal; } #sidenavcontainer h3 { margin:0 0 0 0px; padding:0px; } h4{ /* PRODUCT SUB-CATEGORIES */ padding:0; margin:0; font-size:11px; font-style:normal; font-weight:normal; } #sidenavcontainer h4 { margin:0 0 0 20px; padding:20; padding-bottom:2px; } #sidenavcontainer a { color:#000000; text-decoration:none; } #sidenavcontainer a:hover { color:#FF0000; text-decoration:none; } #sidenavcontainer .current { color:#3333FF; }

And that's it.

- MoonDog -
__________________
X-CART Gold v4.1.8
Reply With Quote
  #14  
Old 10-28-2007, 07:15 AM
 
RobinBraves RobinBraves is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: FL
Posts: 98
 

Default Re: Display SubCategory titles with products

I followed the steps you gave, MoonDog, and I don't see a change: http://sentimentalist.net/store/greeting-cards-c-1.html

I even ran cleanup.php to make sure my temp files were cleaned out.

Did I do something wrong?
__________________
Version 4.1.11
Reply With Quote
  #15  
Old 10-28-2007, 10:53 AM
 
andyweb andyweb is offline
 

Newbie
  
Join Date: Sep 2007
Posts: 2
 

Default Re: Display SubCategory titles with products

Hi MoonDog,

Thanks so much for this post.
I am also having the same problem.

I followed all the instructions, but still cant get the products to display in the menu.
It now displays the subcategories.
__________________
X-Car Version 4.1.8
Reply With Quote
  #16  
Old 10-28-2007, 12:31 PM
 
MoonDog MoonDog is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 93
 

Default Re: Display SubCategory titles with products

RobinBraves,

Unfortunately you won't be able to use this code on your site . I went to your site (great site by the way) and noticed that you are using javascript code for your current menu. Since you have a customized menu you will have to remove and modify your code in order for this to work. By the way, on your site, the last three items of your custom menu doesn't work in Internet Explorer 6. You can't see any of the text unless you hover over them. It works OK in Firefox though.

andyweb,

I've copied the code from this post and followed my exact instructions to see if there was a typo or bad code. I re-installed it and tested it and it still works like a charm. I've attached a thumbnail so you can see what it is suppose to look like.
You might try re-doing the installation again in case you made a previous mistake.

- MoonDog -
Attached Thumbnails
Click image for larger version

Name:	menu.jpg
Views:	366
Size:	48.6 KB
ID:	601  
__________________
X-CART Gold v4.1.8
Reply With Quote
  #17  
Old 10-28-2007, 02:16 PM
 
RobinBraves RobinBraves is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: FL
Posts: 98
 

Default Re: Display SubCategory titles with products

Not sure if this is what I will need. Does this make the actual page in the middle show the subcategory titles with all their products listed below?

Example:
-------------------------------------------------------
Celebration
-------------------------------------------------------
product1 product2 product3

product4 product5

------------------------------------------------------
Gratitude
------------------------------------------------------
product1 product2 product3

------------------------------------------------------
Seasonal
------------------------------------------------------
product1 product2 product3

product4 product5 product6

product7
__________________
Version 4.1.11
Reply With Quote
  #18  
Old 10-28-2007, 03:37 PM
 
MoonDog MoonDog is offline
 

Advanced Member
  
Join Date: Aug 2007
Posts: 93
 

Default Re: Display SubCategory titles with products

RobinRaves,

Quote:

Does this make the actual page in the middle show the subcategory titles with all their products listed below?

My mistake . I thought you needed a categories menu with the listed sub-categories on the left side of the page.

I did post some code a while back that deals with sub-categories and sub-sub-categories in the middle of the page, but it used graphics and text. I'm not sure if this is what you need, but click here to go there. I've placed two thumbnail images on the bottom of that post so you can see if that is what you need.

- MoonDog -
__________________
X-CART Gold v4.1.8
Reply With Quote
  #19  
Old 10-28-2007, 08:19 PM
 
RobinBraves RobinBraves is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: FL
Posts: 98
 

Default Re: Display SubCategory titles with products

No problem, MoonDog. I really do appreciate your help. I took a look at that other forum and it is not what I need.

What I need is seen here:
http://www.jackmansfabrics.com/Bridal-Fabrics-p-1-c-294.html

This page shows a SubCategory Heading with the products below and then ANOTHER SubCategory Heading below that and its products below and so forth.

By default, x-cart just shows the subcategories (with or without images) but not the products. You actually have to click on the subcategory to see the products of just that subcategory.

I need for my customer to see all the subcategory headings with the corresponding products below each.

I hope that makes sense. I saw 1 thread about this, but it was not made for 4.1.8 or newer.

I'm kinda bummed out. Good news is... I think I am going to use this mod anyway because the menu I have is "jumpy" and I'm not a huge fan.
__________________
Version 4.1.11
Reply With Quote
  #20  
Old 10-29-2007, 09:08 PM
 
RobinBraves RobinBraves is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: FL
Posts: 98
 

Default Re: How do I display all subcategories along with all products

Quote:
Originally Posted by mikalou
That store that I linked to is 4.1.8 and I used the instructions that were listed in a post above mine with the one modification that I mentioned in one of my other posts.

Okay, I followed the instructions exactly and also made the update that you posted. Here is what my page looks like:

http://sentimentalist.net/store/greeting-cards-c-1.html

Any suggestions? What could I be doing wrong/
__________________
Version 4.1.11
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


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 08:17 AM.

   

 
X-Cart forums © 2001-2020