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)
-   -   Rearranging and reconfiguring categories problem (https://forum.x-cart.com/showthread.php?t=8617)

mikea93449 07-25-2004 11:03 AM

Rearranging and reconfiguring categories problem
 
Hi everyone,

This is my first experience with X-cart and its pretty cool. I'm using version 3.5.9 (linix) and am trying to change the way the navigation displays. If you look at http://www.solutionsforliving.biz/index.php you will see that I have the category navigation going across the top horizontally as images. I currently have them in the head.tpl file but believe that I need to change it to the categories.tpl, but I'm not sure. Ideally I would like the category image buttons to have a rollover effect, but I'm not sure where if that is possible. Also, I'm confused as to how I make each category button a functional link. And, since I'm begging for help, where the current categories are listed on the left side I would like to display the subcategories. The subcategories should remain until a new category is clicked on. Is this all possible? Any help and advice you can give me is much appreciated. Thank you in advance.

Mike

shan 07-26-2004 04:59 AM

this is the code that will give you root categories in a horizontal line

Code:

<table cellpadding="5" cellspacing="0"><tr>

{section name=cat_num loop=$categories}
<td>
<font class=CategoriesList>{$categories[cat_num].category_name}</font>

</td>
{/section}

</tr>
</table>


mikea93449 07-26-2004 06:58 AM

Thank you Shan! That works great to display the categories horizontally :D . I've put that code into the head.tpl file as can be seen at http://www.solutionsforliving.biz/index.php. What I would like to do is use the images right above the category listings as the actual category links instead of text. Also, in home.tpl I would like to replace the categories.tpl with the subcategories.tpl include but have the subcategories.tpl be reformatted to match the other menus. What should I do next?

shan 07-26-2004 07:37 AM

save your images in skin1/navpics/ folder and name them so that the file name is that same as the category id with the gif extension.

for example your storage category image should be saved as 103.gif

Code:

<table cellpadding="5" cellspacing="0"><tr>

{section name=cat_num loop=$categories}

<td>
<a href="home.php?cat={$categories[cat_num].categoryid}" >

<img src ="{$ImagesDir}/navpics/{$categories[cat_num].categoryid}.gif">

</a>
</td>

{/section}

</tr>
</table>


you should be able to see what is going on from the code ive supplied now.

theres a setting in general settings about showing subcategories in the categories menu

mikea93449 07-26-2004 04:17 PM

Thank you again Shan! The fixes you stated worked perfectly! :D My categories menu that was showing on the left now reads Sub-Categories (categories.tpl) and displays the sub-categories for whatever category is clicked on at the top of the page.

The weird thing that happens is once you click on a sub-category item, the sub-categories disappear. Is there anyway to keep the sub-categories visible until a new category is clicked on?

Thank you again for your help!
Mike

Once again... the site is located at: http://www.solutionsforliving.biz/index.php

shan 07-26-2004 04:37 PM

afraid not, its one of the drawbacks on how the categories are stored in the database in versions before v4.0.0

its because there are no more subcategories that nothing shows

mikea93449 07-26-2004 04:46 PM

Hi Shan,
Would upgrading to 4.0 help? Or is there any other way to modify the code to keep the subcategories in place?

Thank you,
Mike

shan 07-26-2004 04:49 PM

Ive had the same problem myself

Ive not tried it in 4 yet but I see the way that categories are handled is better.

V4 is not realy ready for production sites yet even though Im developing one myself at the moment. its not due for release for a while though.

best way prior to v4 is to get rid of the categories side menu altogether and just use the subcategory links that appear in the center column

mikea93449 07-26-2004 05:00 PM

Actually, what I was hoping to do was to keep the subcategories on the left, then in the middle column, display featured products when the main category is clicked on, then product listings when the subcategory is selected. I don't suppose there would be anyway to write a new *.tpl file that would be able to keep the subcategories listed?

Thanks again,
Mike

shan 07-27-2004 03:44 AM

i gave up in the end when trying it with v3.5.x

BCSE 07-27-2004 07:06 AM

You should be able to modify categories.php to give you the sub categories of the parent category if no sub-sub categories exist. I hope that makes sense.

It would take quite a bit of work. If I weren't so strapped for time right now, I'd look into it further for you.

If I get some spare time, I'll try to figure it out.

Nice looking site BTW! :)

Carrie

mikea93449 07-27-2004 07:24 AM

Thanks BCSE!
I appreciate both yours and Shans help and advice :D . Any help you can give me about modifying the categories.tpl file to keep the sub-categories visible would be invaluable. In its current state, it's not going to work very well without it.

Thank you again,
Mike

BCSE 07-27-2004 07:29 AM

Well, you're going to have to change the PHP code to do what you want it to do. It's not going to be simple from first glance at categories.php

I have to get a large list of things done today. I'll try to slip it in to see if its possible to do. It should be possible, it's just not going to be easy.

Carrie

mikea93449 07-27-2004 08:10 AM

Thanks Carrie! :D Just to let you know, this is my first experience in dealing with PHP so any fixes you have to share with me will probably require some patience on your part - but I do catch on to things fairly quickly. I really appreciate your help!

Mike

BCSE 07-30-2004 08:29 AM

No problem. I haven't forgotten about this. I'm just super swamped this week with "emergency" X-cart work. It's on my list of to-do.

Carrie

mikea93449 07-31-2004 06:18 PM

Thanks Carrie! I'm anxious to see if this will work. Hope you get your fires put out! :D Say, can you or anyone else guide me to where I can increase the font size used in the product text display area? I'm sure its in the css file somewhere, but I must be missing it.

Thanks again,
Mike

BCSE 08-01-2004 07:13 PM

I think I have it! I had a few minutes tonight to take a stab at it and seem to have it. It's not completely tested though, so let me know if you find any problems with it.

Here's how to try it:
1. - BACK UP skin1/customer/categories.tpl
- BACK UP include/categories.php

2. Add this code to include/categories.php:
Code:

# BCSE Begin
if(empty($subcategories))
{
        $pos=strpos($current_category["category"],"/");

        while(!$pos===false)
        {
                $previous_pos=$pos;
                $pos=strpos($current_category["category"],"/",$pos+1);
        }
        $parent = substr($current_category["category"],0,($previous_pos+$pos));

        if (!empty($parent))
                $cur_dir_len = strlen($parent);

        foreach($all_categories as $all_category)
        {
               
                $category=$all_category["category"];

                if(!strstr($category,"/")) {

                                if(empty($parent)) {
                                        $super_subcategories[]=$all_category;
                                }
                }

                if(!empty($parent) and substr($category,0,$cur_dir_len+1) == $parent."/" and $category!=$parent)
                {
                        if(!strstr(substr($category,$cur_dir_len+1),"/"))
                        {
                                $all_category["category"]=ereg_replace("^.*/","",$all_category["category"]);
                                $super_subcategories[]=$all_category;
                        }
                }

        }
       
        if(!empty($super_subcategories))
        {
                $smarty->assign("super_subcategory",$super_subcategories);

        }
}

# BCSE End


After:
Code:

#
# Put all root categories to $categories array
# Put all subcategories of current_category to $categories array
#
if (!empty($current_category))
        $cur_dir_len = strlen($current_category["category"]);

foreach($all_categories as $all_category) {

        $category=$all_category["category"];

        if(!strstr($category,"/")) {
            $categories[]=$all_category;
                        if(empty($current_category)) {
                                $subcategories[]=$all_category;
                        }
        }

        if(!empty($current_category) and substr($category,0,$cur_dir_len+1) == $current_category["category"]."/" and $category!=$current_category["category"])
                if(!strstr(substr($category,$cur_dir_len+1),"/")) {
                        $all_category["category"]=ereg_replace("^.*/","",$all_category["category"]);
                        $subcategories[]=$all_category;
                }

}


3. Add this code to skin1/customer/categories.tpl
Code:

{* BCSE Begin *}
{section name=super_idx loop=$super_subcategory}
<font class=CategoriesList>{$super_subcategory[super_idx].category_name}</font>

{/section}
{* BCSE End *}


Before:
Code:

{/if}
{/if}


{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu }


I tested this on 3.5.10. It should work on 3.5.9.

Hope this helps!

Carrie

mikea93449 08-02-2004 06:18 AM

Hi Carrie,
Thank you for the mod, but I can't seem to get it working. Here is the complete code that I currently have for categories.tpl (including your mod):

Code:

{* $Id: categories.tpl,v 1.19.2.1 2004/03/16 12:12:16 svowl Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"}
{else}
{if $config.General.root_categories eq "Y"}
{section name=cat_num loop=$categories}
<font class=CategoriesList>{$categories[cat_num].category_name}</font>

{/section}
{else} {section name=cat_num loop=$subcategories}
<font class=CategoriesList>{$subcategories[cat_num].category_name}</font>

{/section}
{* BCSE Begin *}
{section name=super_idx loop=$super_subcategory}
<font class=CategoriesList>{$super_subcategory[super_idx].category_name}</font>
 
{/section}
{* BCSE End *}
{/if}
{/if}


{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu }


And here is the code I have currently for categories.php (including your mod). This was found in htdocs/admin. There wasn't a categories.php in the customer directory so I hope I modified the right one.

Code:

#
# $Id: categories.php,v 1.18.2.3 2004/03/09 09:13:26 svowl Exp $
#

require "./auth.php";
require $xcart_dir."/include/security.php";

require $xcart_dir."/include/categories.php";

if (empty($mode)) $mode = "";

#
# Counts products and subcategories
#
if (is_array(@$subcategories)) {
        $smarty->assign("subcategories",$subcategories);
}

#
# Ajust category_location array
#
if (is_array(@$category_location)) {
        reset($category_location);
        while(list($key,$cat_loc) = each($category_location))
                $category_location[$key][1] = str_replace("home.php","categories.php",$category_location[$key][1]);

        if(!empty($current_category)) $location = $category_location;
}

# BCSE Begin
if(empty($subcategories))
{
$pos=strpos($current_category["category"],"/");

while(!$pos===false)
{
$previous_pos=$pos;
$pos=strpos($current_category["category"],"/",$pos+1);
}
$parent = substr($current_category["category"],0,($previous_pos+$pos));

if (!empty($parent))
$cur_dir_len = strlen($parent);

foreach($all_categories as $all_category)
{

$category=$all_category["category"];

if(!strstr($category,"/")) {
$categories[]=$all_category;
if(empty($parent)) {
$super_subcategories[]=$all_category;
}
}

if(!empty($parent) and substr($category,0,$cur_dir_len+1) == $parent."/" and $category!=$parent)
{
if(!strstr(substr($category,$cur_dir_len+1),"/"))
{
$all_category["category"]=ereg_replace("^.*/","",$all_category["category"]);
$super_subcategories[]=$all_category;
}
}

}

if(!empty($super_subcategories))
{
$smarty->assign("super_subcategory",$super_subcategories);

}
}

# BCSE End

# FEATURED PRODUCTS
$f_cat = (empty ($cat) ? "0" : $cat);

if ($REQUEST_METHOD=="POST") {
while(list($key,$val)=each($HTTP_POST_VARS)) {
if (strstr($key,"-")) {
list($field,$productid)=split("-",$key);
if ($field=="avail")
$val="Y";
db_query("update $sql_tbl[featured_products] set avail='N', $field='$val' where productid='$productid' AND categoryid='$f_cat'");
}
}

if ($newproductid!="") {
$newavail=($newavail=="on" ? "Y" : "N");
if ($neworder=="") {
$maxorder = array_pop(func_query_first("select max(product_order) from $sql_tbl[featured_products] WHERE categoryid='$f_cat'"));
$neworder=$maxorder+1;
}

if (func_query_first("select productid from $sql_tbl[products] where productid='$newproductid'") and array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[featured_products] WHERE productid='$newproductid' AND categoryid='$f_cat'")) == 0)
db_query("insert into $sql_tbl[featured_products] (productid, product_order, avail, categoryid) values ('$newproductid','$neworder','$newavail', '$f_cat')");
}
func_header_location("categories.php?cat=$cat");
}

if ($mode == "delete") {
db_query ("DELETE FROM $sql_tbl[featured_products] WHERE productid='$productid' AND categoryid='$f_cat'");
func_header_location("categories.php?cat=$cat");
}

$products = func_query ("SELECT $sql_tbl[featured_products].productid, $sql_tbl[products].product, $sql_tbl[featured_products].product_order, $sql_tbl[featured_products].avail from $sql_tbl[featured_products], $sql_tbl[products] where $sql_tbl[featured_products].productid=$sql_tbl[products].productid AND $sql_tbl[featured_products].categoryid='$f_cat' order by $sql_tbl[featured_products].product_order");
$smarty->assign ("products", $products);
$smarty->assign ("f_cat", $f_cat);

$smarty->assign("location",@$location);
$smarty->assign("main","categories");

@include $xcart_dir."/modules/gold_display.php";
$smarty->display("admin/home.tpl");
?>


Can you see anything I have done wrong?

Thanks again for looking into this :D .

Mike

BCSE 08-02-2004 06:29 AM

It's in include directory. So restore your admin/categories.php file and edit the include/categories.php instead. Sorry about that! Not sure why I said customer/categories.php I reflected the changes in my previous post.

Let me know if that doesn't work!

Carrie

mikea93449 08-03-2004 02:38 AM

Hi Carrie,
I'm not sure if I did something wrong or not but the categories are now kind of screwed up in how they are displaying. You can view what it is doing at http://www.solutionsforliving.biz and clicking on any of the category links across the top portion of the page. I'm posting the code for the 3 files that seem to be affected:

include/categories.php:

Code:

#
# $Id: categories.php,v 1.52.2.5 2004/04/21 05:36:49 mclap Exp $
#

if ( !defined('XCART_SESSION_START') ) { header("Location: ../"); die("Access denied"); }

if (empty($cat)) $cat = 0;

#
# For users some categories may be disabled
#

if ($current_area == "C" and !empty($user_account)) {
$membership_condition = " AND ($sql_tbl[categories].membership='$user_account[membership]' OR $sql_tbl[categories].membership='') ";
} else {
$membership_condition = " AND ($sql_tbl[categories].membership='') ";
}

$categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category"));

#
# Put all categories into $all_categories array and find current_category
# by categoryid stored in $cat
#
if(!$categories_data) $categories_data = array();

$current_category = "";

foreach($categories_data as $k=>$category_data) {
if ($current_area == "C") {
$int_res = func_query_first("SELECT * FROM $sql_tbl[categories_lng] WHERE code='$store_language' AND categoryid='$category_data[categoryid]'");
if (!empty($int_res["category"])) {
$categories_data[$k]["category_name_orig"] = $category_data["category_name_orig"] = $category_data["category_name"];
$categories_data[$k]["category_name"] = $category_data["category_name"] = $int_res["category"];
}
if (!empty($int_res["description"]))
$categories_data[$k]["description"] = $category_data["description"] = $int_res["description"];
               
}
if ($category_data["categoryid"]==$cat) {
$current_category = $category_data;
}
}

if (empty($current_category)) $cat = 0;

$all_categories = $categories_data;

#
#
#
if (!empty($active_modules["Fancy_Categories"]))
@include $xcart_dir."/modules/Fancy_Categories/fancy_categories.php";

# BCSE Begin
if(empty($subcategories))
{
$pos=strpos($current_category["category"],"/");

while(!$pos===false)
{
$previous_pos=$pos;
$pos=strpos($current_category["category"],"/",$pos+1);
}
$parent = substr($current_category["category"],0,($previous_pos+$pos));

if (!empty($parent))
$cur_dir_len = strlen($parent);

foreach($all_categories as $all_category)
{

$category=$all_category["category"];

if(!strstr($category,"/")) {
$categories[]=$all_category;
if(empty($parent)) {
$super_subcategories[]=$all_category;
}
}

if(!empty($parent) and substr($category,0,$cur_dir_len+1) == $parent."/" and $category!=$parent)
{
if(!strstr(substr($category,$cur_dir_len+1),"/"))
{
$all_category["category"]=ereg_replace("^.*/","",$all_category["category"]);
$super_subcategories[]=$all_category;
}
}

}

if(!empty($super_subcategories))
{
$smarty->assign("super_subcategory",$super_subcategories);

}
}

# BCSE End

#
# Put all root categories to $categories array
# Put all subcategories of current_category to $categories array
#
if (!empty($current_category))
$cur_dir_len = strlen($current_category["category"]);

foreach($all_categories as $all_category) {

$category=$all_category["category"];

if(!strstr($category,"/")) {
$categories[]=$all_category;
if(empty($current_category)) {
$subcategories[]=$all_category;
}
}

if(!empty($current_category) and substr($category,0,$cur_dir_len+1) == $current_category["category"]."/" and $category!=$current_category["category"])
if(!strstr(substr($category,$cur_dir_len+1),"/")) {
$all_category["category"]=ereg_replace("^.*/","",$all_category["category"]);
$subcategories[]=$all_category;
}

}


#
# Put  subcategory_count  to $subcategories array
#
if (!empty($subcategories))
foreach($subcategories as $key =>$subcategory) {
       
$subcategory["subcategory_count"]=0;

foreach($all_categories as $all_category) {
if ($all_category["categoryid"]==$subcategory["categoryid"]) {               
$cur_dir_len = strlen($all_category["category"]);
$current_subcategory=$all_category["category"];
}               
}
       
foreach($all_categories as $all_category) {
$category=$all_category["category"];
if(substr($category,0,$cur_dir_len+1) == $current_subcategory."/" and $category!=$current_subcategory)
if(!strstr(substr($category,$cur_dir_len+1),"/"))
$subcategory["subcategory_count"]++;
}
$subcategories[$key]["subcategory_count"]=$subcategory["subcategory_count"];
}

#
# Generate category sequence, i.e.
# Books, Books/Poetry, Books/Poetry/Philosophy ...
#

if (!empty($current_category)) {

$current_category_array = explode("/",$current_category["category"]);
$prev = $current_category_array[0];
list($key,$val)=each($current_category_array);

$new_array = array($val);

while(list($key,$val)=each($current_category_array)) {
$new_array[] = $prev."/".$val;
$prev = $prev."/".$val;
}
unset($current_category_array);

#
# Generate array for displaying categories sequence in location
#

$category_location=array();
reset($all_categories);

$my_cats = array ();

foreach($all_categories as $all_category) {

$categoryid=$all_category["categoryid"];
$category=$all_category["category"];

$my_cats [$categoryid] = $category;
}

asort ($my_cats);

foreach ($my_cats as $categoryid => $category) {
reset ($new_array);
while(list($key,$val)=each($new_array)) {
if ($val==$category) {
foreach($categories_data as $category_data) {
if ($category_data["categoryid"] == $categoryid)
$val = $category_data["category_name"];
}
$category_location[]=array(ereg_replace(".*/","",$val),"home.php?cat=".$categoryid);
}
}
}

}

if ($current_area == "C" and !empty($current_category) and $config["Images"]["icons_location"] == "FS") {
$current_category["image_path"] = array_pop(func_query_first("SELECT image_path FROM $sql_tbl[icons] WHERE categoryid='$cat'"));
if (eregi("^(http|ftp)://", $current_category["image_path"])) {
# image_path is an URL
$current_category["icon_url"] = $current_category["image_path"];
}
elseif (!strncmp($xcart_dir, $current_category["image_path"], strlen($xcart_dir))) {

# image_path is an locally placed image
$current_category["icon_url"] = $current_location.substr($current_category["image_path"], strlen($xcart_dir));
}
}

#
# Assign Smarty variables
#

$smarty->assign("allcategories",$all_categories);
$smarty->assign("categories",$categories);
if (!empty($subcategories))
$smarty->assign("subcategories",$subcategories);
if (!empty($current_category))
$smarty->assign("current_category",$current_category);
$smarty->assign("cat",$cat);
?>


catagories.tpl:

Code:

{* $Id: categories.tpl,v 1.19.2.1 2004/03/16 12:12:16 svowl Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"}
{else}
{if $config.General.root_categories eq "Y"}
{section name=cat_num loop=$categories}
<font class=CategoriesList>{$categories[cat_num].category_name}</font>

{/section}
{else} {section name=cat_num loop=$subcategories}
<font class=CategoriesList>{$subcategories[cat_num].category_name}</font>

{/section}
{* BCSE Begin *}
{section name=super_idx loop=$super_subcategory}
<font class=CategoriesList>{$super_subcategory[super_idx].category_name}</font>
 
{/section}
{* BCSE End *}
{/if}
{/if}


{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu }


and head.tpl:

Code:

{* $Id: head.tpl,v 1.30.2.3 2004/03/09 08:28:25 svowl Exp $ *}
<table border="0" width="768" cellspacing="0" cellpadding="0">
<tr>
<td width="768">
<img src ="{$ImagesDir}/logo1_01.gif" border="0"><img border="0" src ="{$ImagesDir}/logo1_06.gif"><img border="0" src ="{$ImagesDir}/logo1_07.gif"><img border="0" src ="{$ImagesDir}/logo1_08.gif"><img border="0" src ="{$ImagesDir}/logo1_09.gif"><img border="0" src ="{$ImagesDir}/logo1_10.gif"><img border="0" src ="{$ImagesDir}/logo1_11.gif"><img border="0" src ="{$ImagesDir}/logo1_12.gif"></td>
</tr>
</table>
<table width="768" border="0" cellpadding="0" cellspacing="0"><tr><td width="8">[img]{$ImageDir}/logo1_13.gif[/img]</td>
{section name=cat_num loop=$categories}
<td width="760">
<a href="home.php?cat={$categories[cat_num].categoryid}" >
<img src ="{$ImagesDir}/navpics/{$categories[cat_num].categoryid}.gif" border="0">
</a>
</td>
{/section}
</tr>
</table>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="768">
<TR>
<TD  colspan=2 class=VertMenuBorder>[img]{$ImagesDir}/spacer.gif[/img]</TD>
</TR>
<TR>
<TD class=HeadLine height=22>
{if $usertype eq "C"}
{ include file="customer/search.tpl" }
{/if}
</TD>
<TD class=HeadLine align=right>
{if $usertype eq "C" and $all_languages_numba gt 1}
<table border=0 cellpadding=0 cellspacing=0>
<FORM action="home.php" method=GET name=sl_form>
<INPUT type=hidden name="redirect" value="{$smarty.server.PHP_SELF}?{$smarty.server.QUERY_STRING}">
<tr>
<td>
{$lng.lbl_select_language}:
<SELECT name=sl onChange="javascript: document.sl_form.submit()">
{section name=ai loop=$all_languages}
<OPTION value="{$all_languages[ai].code}"{if $store_language eq $all_languages[ai].code} selected{/if}>{$all_languages[ai].language}</OPTION>
{/section}
</SELECT>
</td></tr>
</FORM>
</table>
{elseif ($usertype eq "P" or $usertype eq "A") and $login and $all_languages_numba gt 1}
<table border=0 cellpadding=0 cellspacing=0>
<FORM action="{$smarty.server.REQUEST_URI}" method=POST name=asl_form>
<tr>
<td>Current language:</td>
<td>
<INPUT type=hidden name="redirect" value="{$smarty.server.QUERY_STRING}">
<SELECT name=asl onChange="javascript: document.asl_form.submit()">
{section name=ai loop=$all_languages}
<OPTION value="{$all_languages[ai].code}"{if $current_language eq $all_languages[ai].code} selected{/if}>{$all_languages[ai].language}</OPTION>
{/section}
</SELECT>
</td></tr>
</FORM>
</table>
{else}

{/if}
</TD>
</TR>
<TR>
<TD  colspan=2 class=VertMenuBorder>[img]{$ImagesDir}/spacer.gif[/img]</TD>
</TR>
{*<TR>
<TD colspan=2 class=NumberOfArticles align=right>{insert name="productsonline"} {$lng.lbl_products} {if $config.Appearance.show_in_stock eq "N"}{$lng.lbl_and} {insert name="itemsonline"} {$lng.lbl_items} {/if}{$lng.lbl_online}</TD>
</TR>*}
</TABLE>




I really don't know what to do to fix this at this point so any help you can offer will be much appreciated.

Thanks again,
Mike

BCSE 08-03-2004 04:46 AM

I see what's going on. You didn't put my code in the right spot. Maybe it would be better explained to say to put it infront of this code:

Code:

#
# Put  subcategory_count  to $subcategories array
#
if (!empty($subcategories))
foreach($subcategories as $key =>$subcategory) {
       
        $subcategory["subcategory_count"]=0;

        foreach($all_categories as $all_category) {
                if ($all_category["categoryid"]==$subcategory["categoryid"]) {               
                        $cur_dir_len = strlen($all_category["category"]);
                        $current_subcategory=$all_category["category"];
                }               
        }


The code depends on the subcategories being created (or not created). So it has to go below the subcategory creation.

Otherwise, it looks like you have it if you notice browsing down the categories to say here:
http://www.solutionsforliving.biz/customer/home.php?cat=131
you have the parent's subcategories on the left side.

Also, since you have the root categories across the top, I have fixed my code to allow for that. So recopy the php code in my original fix so you don't have 2 copies of the root categories at the top.

Carrie

mikea93449 08-03-2004 07:51 AM

CARRIE YOU'RE A GENIUS!!! :D Everything works perfectly. Thank you so much for taking time out to solve this problem and for your patience in dealing with my lack of php experience. You're very nice to do so.

I don't mean to take advantage of your generosity, but I do have one last issue. When a main category is clicked on across the top, in the center section of the page the subcategories are listed in addition to the subcategories now being listed on the left. What I would like is for featured products to be displayed in the center of the page instead of the subcategory listings. I'm assuming this is an easy fix and I only need to be pointed in the right direction, but what do I know? :wink: Also, I'm thinking that the word "description" that appears at the top of the center section can be changed by editing a file in the languages section. Am I close?

I promise I won't take up any more of your time after this.

Thanks again for your kindness in helping me out!

Mike

BCSE 08-04-2004 07:45 AM

Glad you got it working! :)

I don't know about the genious part! LOL Many would argue on that one! ;)

As far as getting rid of the categories in the middle, edit skin1/customer/main/subcategories.tpl and comment out much of the top that displays sub categories. Then it should just show featured products and/or products.

You'd want to start the commenting on this line:
Code:

{section name=cat_num loop=$subcategories}

And would probably want to end the commenting after:
Code:

{ if %cat_num.last% }
</table>
{/if}
{/section}


I hope that makes sense!

To change the "description" word, try going into your categories and editing them. You will probably see the word "description" in the description section. I hope that makes sense when you look at it.

Good luck with the site! I think it looks nice and clean!

Carrie

shan 08-04-2004 07:50 AM

heres a similar thread for doing this in V4

http://forum.x-cart.com/viewtopic.php?t=12058

mikea93449 08-04-2004 05:17 PM

Thank you again Carrie & Shan... you've both been very helpful and without your advice I would never be as far along with this as I am. Thanks again... now I just have to figure out the back end stuff... stay tuned for more posts in the future. :wink:

Mike

johnnydos 10-22-2004 12:00 PM

thanks for the code
 
Carrie,

I second mikea93449's sentiments. Works very nicely. Being able to access sibling categories is key.

Thanks

BCSE 03-20-2005 06:17 AM

You can see an example of the mod discussed here on:
http://www.purpleturtlekids.com

It's an old site I did a long time ago (2 years?) that I have revisited and made the look a bit fresher (within their budget).

If you click on the category tabs you will notice when you get to the end of a category tree branch (where there's no more subcategories) it will still show the previous set of subcategories in the purple bar.

Carrie

Hyperdelicious 04-11-2005 10:00 AM

only show sub categories
 
Quote:

Originally Posted by shan
heres a similar thread for doing this in V4

http://forum.x-cart.com/viewtopic.php?t=12058



The link Shan provided works great for me in 4.0.13 ... however, unlike what is mentioned here it does not discuss showing only the sub categories.


All times are GMT -8. The time now is 10:36 AM.

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