X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   NEW - Sub-Category Display (https://forum.x-cart.com/showthread.php?t=4341)

rodneyw 09-13-2003 02:57 PM

NEW - Sub-Category Display
 
ok, been working on having the sub-categories display in a drop down menu.

I've actually got it working, it's not real 'pretty' yet but seems to work. What I can't seem to get is to display the current category image only.

here's the code if anyone is intrested in using it or helping me :wink:

Code:

{* $Id: subcategories.tpl,v 1.32 2003/04/24 09:50:33 svowl Exp $ *}
{ include file="location.tpl" }
{if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu ne "Y"}



{include file="modules/Bestsellers/bestsellers.tpl"}
{/if}





{literal}
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function switchpage(select) {
// JavaScript function for switching to web page when user
// selects option from the given list box.
  var index;

  for(index=0; index<select.options.length; index++)
    if(select.options[index].selected)
      {
        if(select.options[index].value!="")
          window.location.href=select.options[index].value;
        break;
      }
}
// -->
</SCRIPT>
{/literal}


{ include file="customer/main/navigation.tpl" }
{if ($navigation_page eq "")||($navigation_page eq "1")}{$current_category.description|regex_replace:"/[\n]/":"
"}

{/if}
{capture name=dialog}
{assign var="tmp" value="0"}
{section name=cat_num loop=$subcategories}
{if $subcategories[cat_num].category}{assign var="tmp" value="1"}{/if}
{/section}
{if $tmp}
<SELECT NAME="url" onchange="switchpage(this)">
  <OPTION VALUE=""> Choose Subcategory</option>
{section name=cat_num loop=$subcategories}
  <OPTION VALUE="home.php?cat={ $subcategories[cat_num].categoryid }"> { $subcategories[cat_num].category_name|escape }</option>
    {/section}
</SELECT>
{else}

{/if}

<br clear=_all><hr size=1 noshade>

{include file="customer/main/products.tpl" products=$products}
{if $products eq "" and $tmp eq "0"}
{$lng.txt_no_products_in_cat}
{/if}
{/capture}
{include file="dialog.tpl" title=$current_category.category_name|regex_replace:"/.*\//":"" content=$smarty.capture.dialog extra="width=100%"}
{if $products eq ""}
{if $f_products ne ""}



{include file="customer/main/featured.tpl"}
{/if}
{/if}
{ include file="customer/main/navigation.tpl" }


Mad 09-14-2003 03:39 PM

Got a sample somewhere of how it looks and acts at the moment? Sounds really interesting!

rodneyw 09-14-2003 04:57 PM

no, but I will put it up somehwere and let you take a look.

It's just a normal drop-down menu that will display each sub-category that is with in THAT category..IF there are sub-categories present. If not, it won't display.

Select the sub-category and a javascript takes you to that sub-category. It will go as deep as you have levels of categories

MiguelS 09-16-2003 07:23 AM

Is there anyway to call the categories list from a different area, because that code only works in the actual subcategory. For example say i have:

CATEGORIES:
Category1 <--- Subcategory1a, Subcategory2a, Subcategory3a
Category2 <--- Subcategory1b, Subcategory2b, Subcategory3b
Category3 <--- Subcategory1c, Subcategory2c, Subcategory3c

And i put that code inside on the main page it will list Category1, Category2, and Category3, if i put it directly under Category1 it will display Subcategory1a, Subcategory2a, Subcategory3a right?

Is there a way I can have something where it will call a specific subcategory list from the main page, where i can put that code directly under the main page, but i want it to list all the subcategories of category1?


All times are GMT -8. The time now is 03:50 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.