Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 12-19-2004 19:10:16

funvill
Member
Registered: 12-17-2004
Posts: 23
Website

List Of Sub Catagories

Hello
I'm finding this template system a little bit confusing, and I have compiled a few questions that should get me back on track.


Say I have the main categories name "Tables" and I want to get a list of all the sub categories (in a formatted way)

For example:
Main category: Table
Sub categories: 3 legs, 2 legs, 1 leg

Formatting for each of the sub categories
<a href="#">(CGIVAR)category_name(/CGIVAR)</a>

Then when i put this in my main site layout
(CGIGET TYPE="SUB" VALUE="XXXXX" PARAMS="Table")

it would produce
<a href="#">3 legs</a>
<a href="#">2 legs</a>
<a href="#">1 leg</a>

How could i do this
Is this even possible?



Is there a list of (CGIVAR) some where?
for example: (CGIVAR)html_small_font_face(/CGIVAR)
Where would i find the name "html_small_font_face"?
and where would i set it?
Is there any documentation on the different "CGIVAR" variables


I know that "ste_exec_element" is the variable name for "Manage HTML Pages (User)" where is the documentation on this?
What are the variable names for the other categories "Manage HTML Pages (System)",  "Manage Site Elements"


as i said i am pretty confused right now
is there a template tutorial or something like that i missed.

Thank you for your time


-
-

Offline

 

#2 12-21-2004 15:07:03

funvill
Member
Registered: 12-17-2004
Posts: 23
Website

Re: List Of Sub Catagories

hello

I figured out how to display the sub categories of a certain category
(CGIGET TYPE="SUB" VALUE="ste_cat_disp" PARAMS="tables")

Then i went an labeled all the tops and bottoms of every template file that i could find.

but i was unable to find the "" template.
Where is the "ste_cat_disp" template file
Is this template file generated by the system


The output of (CGIGET TYPE="SUB" VALUE="ste_cat_disp" PARAMS="tables") is:

Code:

<!-- [Start] Store Heading - Category (ste_strhd_cat)--><!-- [End] Store Heading - Category -->
<CENTER>
<TABLE WIDTH="470" COLS="3" CELLSPACING="5">
<TR>
<TD VALIGN="TOP" WIDTH="33%"><FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1" COLOR="000000">

<!-- [Start] Display sub-catagories -->
<A HREF="http://www.ablazeinc.ca/cart/cgi-bin/cp-app.cgi?usr=51F3593590&rnd=1736739&rrc=N&affl=&cip=&act=&aff=&pg=cat&ref=Glamour">Glamour</A><BR>
<!-- [End] Display sub-catagories -->

</FONT></TD>
<TD VALIGN="TOP" WIDTH="33%"><FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1" COLOR="000000">
<!-- [Start] Display sub-catagories -->
<A HREF="http://www.ablazeinc.ca/cart/cgi-bin/cp-app.cgi?usr=51F3593590&rnd=1736739&rrc=N&affl=&cip=&act=&aff=&pg=cat&ref=Character">Character</A><BR>
<!-- [End] Display sub-catagories -->

</FONT></TD>
<TD VALIGN="TOP" WIDTH="34%"><FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1" COLOR="000000">
<!-- [Start] Display sub-catagories -->
<A HREF="http://www.ablazeinc.ca/cart/cgi-bin/cp-app.cgi?usr=51F3593590&rnd=1736739&rrc=N&affl=&cip=&act=&aff=&pg=cat&ref=Thongs">Thongs</A><BR>

<!-- [End] Display sub-catagories -->

</FONT></TD>
</TR>
<TR>
<TD VALIGN="TOP" WIDTH="33%"><FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1" COLOR="000000">
<!-- [Start] Display sub-catagories -->
<A HREF="http://www.ablazeinc.ca/cart/cgi-bin/cp-app.cgi?usr=51F3593590&rnd=1736739&rrc=N&affl=&cip=&act=&aff=&pg=cat&ref=Speciality">Speciality</A><BR>
<!-- [End] Display sub-catagories -->

</FONT></TD>
<TD VALIGN="TOP" WIDTH="33%"><FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1" COLOR="000000"><BR></FONT></TD>
<TD VALIGN="TOP" WIDTH="34%"><FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1" COLOR="000000"><BR></FONT></TD>
</TR>
</TABLE>
</CENTER>

as you can see there are extra bits of HTML that i didn't add and i'm not sure where they came from.

Code:

</FONT></TD>
<TD VALIGN="TOP" WIDTH="33%"><FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1" COLOR="000000">
<!-- [Start] Display sub-catagories --><!-- [End] Display sub-catagories -->

Where is this code template defined[/color]
Is there a way for me to make my own SUB category template[/color]
What’s the CGIGET for subcategories


-
-

Offline

 

#3 12-21-2004 17:19:46

funvill
Member
Registered: 12-17-2004
Posts: 23
Website

Re: List Of Sub Catagories

After a lot of searching i found a solution to my problem.

I had to edit


Commenting some of the source code out.
I’m pretty sure that I would get in trouble for posting the file so here are the changes

This is the section that I’m interested in

Code:

#######################################################################
# Ste Cat Show                                                        #
#######################################################################

And comment out the following sections

Code:

print <<ENDOFTEXT;
<CENTER>
<TABLE WIDTH="$html_content_table_size" COLS="$catdisp_columns" CELLSPACING="5">
ENDOFTEXT

Code:

print <<ENDOFTEXT;
<TR>
ENDOFTEXT

Code:

print <<ENDOFTEXT;
<TD VALIGN="TOP" WIDTH="$cell_width_print\%"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color">
ENDOFTEXT

Code:

SWS Commented out 
print <<ENDOFTEXT;
</FONT></TD>
ENDOFTEXT

Code:

SWS Commented out 
print <<ENDOFTEXT;
</TR>
ENDOFTEXT

Code:

print <<ENDOFTEXT;
<TD VALIGN="TOP" WIDTH="$cell_width_print\%"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color"><BR></FONT></TD>
ENDOFTEXT

Code:

print <<ENDOFTEXT;
</TR>
ENDOFTEXT

Code:

print <<ENDOFTEXT;
</TABLE>
</CENTER>
ENDOFTEXT

My question has been solved.


-
-

Offline

 

#4 01-04-2005 11:06:27

myfunkyshop
Member
From: I Live In The Computer
Registered: 12-28-2004
Posts: 152
Website

Re: List Of Sub Catagories

Hi there,

Is there a simple way of adding sub-catagories??

Thank you

Louise


Miss George Clooney



Offline

 

#5 01-04-2005 16:23:53

funvill
Member
Registered: 12-17-2004
Posts: 23
Website

Re: List Of Sub Catagories

myfunkyshop,01/04/2005 11:06:27 AM wrote:

Is there a simple way of adding sub-catagories??

Hello

i'm still trying to figure out this shopping cart and template system.
i don't know of any simpler way of doing it, but here is a much "better" way of doing things.

Add this function to the bottom of


Where ever you want to display a list of the sub categories put


What you are doing is adding a new subroutine called  that dumps out the categories names and links.

Sorry i can not be of any more help i'm still learning my self.
if you find any mistakes feel free to correct me.


Code:

#######################################################################
# Ste Cat sub show                                                    #
#######################################################################

sub ste_cat_sub_show {
&initialize_sub_add('ste_cat_sub_show');

#########
######### This routine displays a category listing.
#########


#########
######### Get a count of the number of items we're displaying.
#########

foreach $row(@catdisp) {

($category_id,$category_name,$category_imgsm,$category_desc) = @$row;

$found_count++;

} ######### End of foreach statement.

##########
########## Figure out the width of the table cells we're
########## going to be presenting.
##########

foreach $row(@catdisp) {
($category_id,$category_name,$category_imgsm,$category_desc) = @$row;
$category_desc = display_parse_string($category_desc);
$category_id_encoded = vars_urlencode($category_id);
$display_count_row++;

##########
########## If this is the first cell in a row we're
########## printing, we need to print a <TR> tag.
##########

&display_print($catdisp_display);

} ######### End of foreach statement.

&initialize_sub_remove('ste_cat_sub_show');
} ######### End of subroutine.


-
-

Offline

 

#6 01-05-2005 05:28:46

myfunkyshop
Member
From: I Live In The Computer
Registered: 12-28-2004
Posts: 152
Website

Re: List Of Sub Catagories

Hi there,


I hope i don't sound too thick, but do i add the code in the ste_cat.pl file or creates a new pl file...

Also Where do i have to add (CGIGET TYPE="SUB" VALUE="ste_cat_sub_show") as i am unsure of this.

Thank you for all the help


Miss George Clooney



Offline

 

#7 01-05-2005 07:07:09

Steven
Member
Registered: 04-21-2004
Posts: 84

Re: List Of Sub Catagories

Hi Funvill, I'm bored and saw your post so I thought I'd help you out.

Yes there is a simplier way.  Here is my code for displaying sub categories in a box similiar to the category display.  This box is only shown where sub categories are available.  Works on any level, and isn't displayed on the items page.

Put this reference in your ste_layout.txt where you want the box to be drawn.  This is in your elements directory.

Code:


(CGIGET TYPE="SUB" VALUE="ste_cat_incat")

Next you need to add the following routine to the top of your ste_cat.pl file in your modules directory.

Code:


#######################################################################
# Ste Sub Cat In this category.. listing                              #
#######################################################################

sub ste_cat_incat {

&initialize_sub_add('ste_cat_incat');

#########
######### This routine displays categories from within store pages.
#########

my $row = "";
my $found_count = "0";
my $catdisp_count = "0";

@catdisp = ();

#########
######### If the page is not 'cat' then we're calling this routine
######### from the splash page and need to use those variables.
#########

if ($fd_pg ne "ste_cat") {

$catdisp_columns = "$store_noncat_catcount";
$catdisp_display = "$store_noncat_catdisp";

$found_count++;

#########
######### Get all of the active categories that should be displayed
######### on the splash page into an array.
#########

$sql_statement = "

SELECT category_id,category_name,category_imgsm,category_desc
FROM category
WHERE category_splashdisp='Y'

";

@catdisp = database_call('category','SELECT',$sql_statement);

foreach $row(@catdisp) {

$catdisp_count++;

} ######### End of foreach statement.

#########
######### Otherwise, we need to use the variables for the main
######### category.
#########

} else {

$dbins_fd_ref = database_quote('category',$fd_ref);

$sql_statement = "

SELECT category_catcount,category_catdisp,category_xcat
FROM category
WHERE category_id=$dbins_fd_ref

";

@catdisp = database_call('category','SELECT',$sql_statement);

foreach $row(@catdisp) {

($catdisp_columns,$catdisp_display,$category_xcat) = @$row;

$found_count++;

} ######### End of foreach statement.

@catdisp = ();

#########
######### Take the $category_xcat and pull items from
######### the category table that match up.
#########

$category_xcat =~ s/\, /\,/gs;

my @related = split (/\,/, $category_xcat);

my $related = "";
my $related_sql = "";

foreach $related(@related) {

if ($related ne "") {

$dbins_category_id = database_quote('category',$related);

$related_sql .= "category_id=$dbins_category_id OR ";

} ######### End of if statement.

} ######### End of foreach statement.

if ($related_sql ne "") {

chop($related_sql);
chop($related_sql);
chop($related_sql);
chop($related_sql);

$sql_statement = "

SELECT category_id,category_name,category_imgsm,category_desc
FROM category
WHERE $related_sql

";

@catdisp = database_call('category','SELECT',$sql_statement);

} ######### End of if statement.

foreach $row(@catdisp) {

$catdisp_count++;

} ######### End of foreach statement.

} ######### End of if statement.

#########
######### If we matched a category and found related items, then
######### we continue.
#########

if ($found_count ne "0" && $catdisp_count ne "0") {

if ($fd_pg eq "ste_cat") {

print <<ENDOFTEXT;
<TABLE width=180 border=0 cellPadding=1 cellSpacing=0 bgColor=FF9829>
 <TBODY>
  <TR> 
   <TD width=100%><TABLE cellSpacing=0 cellPadding=10 width=100% border=0>
     <TBODY>
      <TR> 
       <TD width=100% vAlign=top bgcolor=#FFFFFF><span class=bold><font color=#000000 size=2 face="Verdana, Arial, Helvetica, sans-serif">In 
        this Category:</font></span><br>
        <br>
        <table width=100% border=0 cellspacing=0 cellpadding=0>
         <tr> 
          <td>
ENDOFTEXT

foreach $row(@catdisp) {

($category_id,$category_name) = @$row;

$category_id_encoded = vars_urlencode($category_id);
$seo_category_url = ste_seo_make_url('cat', $category_name, $category_id);

&display_print('ste_cat_list');

}

print <<ENDOFTEXT;
</td>
         </tr>
        </table></TD>
      </TR>
     </TBODY>
    </TABLE></TD>
  </TR>
 </TBODY>
</TABLE><br><br>
ENDOFTEXT

} ######### End of if statement.

}

&initialize_sub_remove('ste_cat_incat');

} ######### End of subroutine.

By the way, $seo_base_url is for ATS's SEO module.  You will need to substitute this with the $common_url string (sp?) I've forgotton what that is now.  But you'll find it in your ste_layout.txt

Steven

Offline

 

#8 01-05-2005 07:22:10

myfunkyshop
Member
From: I Live In The Computer
Registered: 12-28-2004
Posts: 152
Website

Re: List Of Sub Catagories

Hi there,

Thank you for even more help and i still unsure where to put: (CGIGET TYPE="SUB" VALUE="ste_cat_incat") Please look at my website in my signature and could recommend where it should go.. I was thinking next to the catagories but i am not sure what part of that code that is??

Thank you


Miss George Clooney



Offline

 

#9 01-05-2005 12:25:50

funvill
Member
Registered: 12-17-2004
Posts: 23
Website

Re: List Of Sub Catagories

re: myfunkyshop
It does not look like you have an subcategories setup?

Main menu -> Store catalog -> Manage Categories -> Click on any category

Then update "Related Categories" section with the reference strings of other categories.

as Steven said (CGIGET TYPE="SUB" VALUE="ste_cat_incat") should go in  AKA (also known as)

Main menu -> Html pages and elements -> Manage Site Elements -> Site HTML Layout

Thank you Steven I’m going to try your method tonight.


-
-

Offline

 

#10 01-05-2005 12:56:38

funvill
Member
Registered: 12-17-2004
Posts: 23
Website

Re: List Of Sub Catagories

Thanks Steven
it works great alot better then mine.

A note for thous who follow me and do not have ATS's SEO module.

Comment out this line

Code:

$seo_category_url = ste_seo_make_url('cat', $category_name, $category_id);

And replace "ste_cat_list" with what ever template in "Manage Category Listing Displays" you want.

Code:

&display_print('ste_cat_list');

Thanks again works just like I wanted it too in the first place.


-
-

Offline

 

#11 01-05-2005 16:21:54

myfunkyshop
Member
From: I Live In The Computer
Registered: 12-28-2004
Posts: 152
Website

Re: List Of Sub Catagories

 


Miss George Clooney



Offline

 

#12 05-12-2005 06:23:05

mhaysom
Member
Registered: 04-11-2005
Posts: 168

Re: List Of Sub Catagories

Hello, i hope you see this post, ive added this bit : (CGIGET TYPE="SUB" VALUE="ste_cat_incat") but where you say



Next you need to add the following routine to the top of your ste_cat.pl file in your modules directory.


i cant find the ste_cat.pl file.... i have three module folders , one being modules_dbi, _inc_lib... i have added a skin to the site, would this have moved it?

I came across this topic as my sub catagories aren't showing up, do you think all this would solve my problem??

TIA

Offline

 

#13 10-18-2005 19:56:01

tifosi
Member
Registered: 07-28-2004
Posts: 29

Re: List Of Sub Catagories

Here's a modified version incat_plus. It includes a new function cat_get_parent which will drag the parent category of the category you're in (if there is one) while incat will get the subcategories. Useful if you want to have an on the fly heirarchy.

Modified Incat: sub cat_incat_plus()

Code:

#######################################################################
# Ste Sub Cat & Prod In this category.. listing                       #
#######################################################################

sub ste_cat_incat_plus {

&initialize_sub_add('ste_cat_incat_plus');

#########
######### This routine displays categories from within store pages.
#########
my $row = "";
my $found_count = "0";
my $catdisp_count = "0";

@catdisp = ();

#########
######### If the page is not 'cat' then we're calling this routine
######### from the splash page and need to use those variables.
#########

if ($fd_pg ne "ste_cat") {

$catdisp_columns = "$store_noncat_catcount";
$catdisp_display = "$store_noncat_catdisp";

$found_count++;

#########
######### Get all of the active categories that should be displayed
######### on the splash page into an array.
#########

$sql_statement = "

SELECT category_id,category_name,category_imgsm,category_desc
FROM category
WHERE category_splashdisp='Y'

";

@catdisp = database_call('category','SELECT',$sql_statement);

foreach $row(@catdisp) {

$catdisp_count++;

} ######### End of foreach statement.

#########
######### Otherwise, we need to use the variables for the main
######### category.
#########

} else {

$dbins_fd_ref = database_quote('category',$fd_ref);

$sql_statement = "

SELECT category_catcount,category_catdisp,category_xcat
FROM category
WHERE category_id=$dbins_fd_ref

";

@catdisp = database_call('category','SELECT',$sql_statement);

foreach $row(@catdisp) {

($catdisp_columns,$catdisp_display,$category_xcat) = @$row;

$found_count++;

} ######### End of foreach statement.

@catdisp = ();

#########
######### Take the $category_xcat and pull items from
######### the category table that match up.
#########

$category_xcat =~ s/\, /\,/gs;

my @related = split (/\,/, $category_xcat);

my $related = "";
my $related_sql = "";

foreach $related(@related) {

if ($related ne "") {

$dbins_category_id = database_quote('category',$related);

$related_sql .= "category_id=$dbins_category_id OR ";

} ######### End of if statement.

} ######### End of foreach statement.

if ($related_sql ne "") {

chop($related_sql);
chop($related_sql);
chop($related_sql);
chop($related_sql);

$sql_statement = "

SELECT category_id,category_name,category_imgsm,category_desc
FROM category
WHERE $related_sql

";

@catdisp = database_call('category','SELECT',$sql_statement);

} ######### End of if statement.

foreach $row(@catdisp) {

$catdisp_count++;

} ######### End of foreach statement.

} ######### End of if statement.

#########
######### If we matched a category and found related items, then
######### we continue.
#########

if ($found_count ne "0" && $catdisp_count ne "0") {

if ($fd_pg eq "ste_cat") {

#
# Category Head inc call to ste_cat_get_parent()
#
&display_print('ste_cat_incat_plus_head');

foreach $row(@catdisp) {

($category_id,$category_name) = @$row;

$category_id_encoded = vars_urlencode($category_id);

&display_print('ste_cat_list');

}

#
# Category Footer
#
&display_print('ste_cat_incat_plus_foot');

} ######### End of if statement.

}

&initialize_sub_remove('ste_cat_incat_plus');

} ######### End of subroutine.

new function cat_get_parent () (add to ste_cat.pl below cat_incat_plus() )

Code:


#####################################
# Sub ste_cat_get_parent       #
#####################################
sub ste_cat_get_parent {

&initialize_sub_add('ste_cat_get_parent');

my $row_count = "0";
my $sql_str = "";

#########
######### This routine gets the category id of the parent category
######### ffrom the passed category
#########

#only do this if it's a category page
if ($fd_pg eq "ste_cat") {

$dbins_fd_ref = database_quote('category',$fd_ref);

chop($dbins_fd_ref);
$sql_str = substr($dbins_fd_ref,1);

$sql_statement = '

SELECT category_id, category_name
FROM category
WHERE category_xcat like ("%'.$sql_str.'%")
AND category_id<>"'.$sql_str.'"  

';


@cat = database_call('category','SELECT',$sql_statement);

foreach $row(@cat) { 
     $row_count++;     
     ($category_id, $category_name) = @$row; 

     $category_id_encoded = vars_urlencode($category_id);
}

#
# If we've found a parent category then display it
#
if ($row_count gt 0 ) {
#
# Display Header
#
&display_print('ste_cat_parent_head');
#
# Display List
#
&display_print('ste_cat_parent');
#
# Display Footer
#
&display_print('ste_cat_parent_footer');
}

}########End of if statement

&initialize_sub_remove('ste_cat_get_parent');

}

Elements requiring creation in site admin:
ste_cat_incat_plus_head

Code:

<table width="248" border="0" cellpadding="0" cellspacing="0" >
(CGIGET TYPE="SUB" VALUE="ste_cat_get_parent")
 <tr>
   <td height="34" >
    SubCategories
   </td>
   </tr>
   <tr>
    <td>
      <table width="100%" align="centre" height="30" border=0 cellspacing=0 cellpadding=0>
        <tr> 
        <td>
      <br>

ste_cat_incat_plus_foot

Code:

      </ul>
      </td>
    </tr>
   </table>
  </td>
 </tr>
</table>
<br>

'ste_cat_parent_head'

Code:

<TR>
  <TD height="34">
   Parent Category
  </TD>
</TR>
<TR>
 <TD

ste_cat_parent

Code:

<ul>
  <li><A HREF="(CGIVAR)common_url(/CGIVAR)&pg=cat&ref=(CGIVAR)category_id_encoded(/CGIVAR)">(CGIVAR)category_name(/CGIVAR)</A></li>
</ul>

ste_cat_parent_foot

Code:

  </TD>
</TR>

The elements can be changed to suit your template/styles

Stephen

Offline

 

#14 02-26-2006 03:58:03

carllawson
Member
Registered: 02-24-2006
Posts: 2
Website

Re: List Of Sub Catagories

This is my first ever post...here goes:

It looks like the excellent code you wrote speaks to part of what I'm trying to do (?). I need to show category, subcategories, and a 'more..' link in a list on the left side bar of my layout. For ex. -


- Wool
- Pea
- Dress
- More...

- Western
- English
- Hunting
- More..

When the user clicks on the link for 'more', I like to take them to a page with all the subcategories relating to that category (and only that category) listed on the left side. This page could also show the thumbs for all these subcats in the body of the page - when they clicked on one of these, they'd get the thumbs for the products in that subcat.

Any suggestions you have for solving this challenge are greatly appreciated!

Offline

 

Board footer