Zen Cart Logo
Forums / Addon Sideboxes / Categories Dressing

Categories Dressing

Views: 531,468

Results 301 to 320 of 2,268
29 Jun 2008, 18:07
#301
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Categories Dressing

Juliet -

All you need to do for an image based menu is to name the images like catimg23.gif or catimg5_17.gif (using the cPath of the category for the numbers) and save them in /includes/templates/your_template/images/.

Make the images the exact pixel size you want them to display at.
You can find the cPath for each category by bringing it up onscreen and looking at the address bar at the top of the window. The URL will include ...&cPath=5_17&... for category 5_17. (If you have an SEO mod installed it will be different.)

29 Jun 2008, 18:29
#302
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Categories Dressing

Relentless -

Changing the stylesheet will not make your headings into links; you need to add the HTML link code to the heading text in tpl_categories.php.```php
case '28': //replace number with your desired cPath
//$content .= '<hr class="catBoxDivider" />' . "\n";
// to add divider uncomment this line
$content .= '<span class="catBoxHeading1">'
. (file_exists(DIR_WS_TEMPLATE_IMAGES . 'cathead'
. $current_path . '.gif') ? zen_image(DIR_WS_TEMPLATE_IMAGES
. 'cathead' . $current_path . '.gif')
//I would like these Headings,to be links.
. '</span>':'

Air Conditioning<br />
Split System<br />
Ducted<br /></span>'
. $disp_block_head) . "\n";
break;

You can change the <span> to an <a href=...> using the zen_href_link() function which will automatically give you the link to the category immediately below the heading.```php
case '28': //replace number with your desired cPath
$content .= '<a class="catBoxHeading1" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">>Air Conditioning<br />
Split System<br />
Ducted<br /></a>'
. $disp_block_head) . "\n";
break;
```You can add styling if you want in the stylesheet:

a.catBoxHeading1:visited {add style);
a.catBoxHeading1:hover {add style);
a.catBoxHeading1:active {add style);
29 Jun 2008, 21:53
#303
relentless avatar

relentless

New Zenner

Join Date:
Sep 2007
Posts:
56
Plugin Contributions:
0

Re: Categories Dressing

See your previous entry
$content .= '<a class="catBoxHeading1" href="'
Is this correct see dbl. quotes at end of line
$content .= '<a class="catBoxHeading1" href=""
Thank you
Relentless

30 Jun 2008, 00:38
#304
relentless avatar

relentless

New Zenner

Join Date:
Sep 2007
Posts:
56
Plugin Contributions:
0

Re: Categories Dressing

<?php // is this is the change to enable Heading link case '28': //replace number with your desired cPath $content .= '<a href="catBoxHeading1"' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '"> >Air Conditioning<br /> Split System<br /> Ducted<br /></a>' . $disp_block_head) . "\n"; break; ?>

Thank you Relentless
Entry 303 ignore

30 Jun 2008, 00:50
#305
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Categories Dressing

The above will not work. You can't combine the class tag and the href like that.
The double and single quotes you show in the previous post are correct, but I will check the rest over for typos.

30 Jun 2008, 15:16
#306
beggarsbones avatar

beggarsbones

New Zenner

Join Date:
Dec 2007
Posts:
54
Plugin Contributions:
0

Re: Categories Dressing

MoltoDelta, Gjh42

thanks for the input - i've fixed the semi colon and the size (the size was my bad 8s and 0s look alike to bad eyes, but now even with the corrected height when you mouse over where gc should be the hover image pushes the menu down) and arranged the sort order for gc to be on top.

i'll continue to fuss with it, and if i figure it out i'll let yall know. thanks!

01 Jul 2008, 01:03
#307
relentless avatar

relentless

New Zenner

Join Date:
Sep 2007
Posts:
56
Plugin Contributions:
0

Re: Categories Dressing

It is always better if you research an issue yourself, thank you.
I think this is correct.

<?php { case '28': //replace number with your desired cPath $content .= '<a href="http://www.samplewebsite.com/index.php?main_page=index&cPath=28&zenid=xxx...">' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">>Air Conditioning<br /> Split System<br /> Ducted<br /></a>' . $disp_block_head) . "\n"; break; ) ?>

Relentless

01 Jul 2008, 12:29
#308
silvioto avatar

silvioto

New Zenner

Join Date:
Jan 2008
Posts:
2
Plugin Contributions:
0

Re: Categories Dressing

Here's a way to use categories dressing on multilanguage site? When I switch language the mod don't work. I think is only a configuration issue... the site is https://www.kipria.it/store.

Tanks.
Silvio.

01 Jul 2008, 16:36
#309
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Categories Dressing

Sorry, I didn't build it to work with multiple languages. I have another mod, Image Titles, which does work for multiple languages, and it would be relatively easy to change Categories Dressing to work the same for images, but the heading and subtext text is coded into the template file and would require changing the way the mod is constructed, to draw text from a language file instead of direct code.

This is a worthy thing to do, but I don't see having time in the near future to do it. I have thought about this in the past, and will continue to poke at it. I will eventually make it happen.

01 Jul 2008, 16:54
#310
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Categories Dressing

A way to do this without inventing new coding has occurred to me. It is a workaround, not an elegant solution, but it will do the job for now.

What you are having problems with is the subtext. Find this section in tpl_categories.php (yours will be larger because you already have several cases customized)```php
// categories dressing - add subtext below a cat
switch ($current_path) {
case '23': //replace number with your desired cPath
$content .= '<span class="catBoxSubtext">Subtext for cat 23 escape apostrophe's</span>' . $disp_block . "\n";
break;
} // subtext


      if ($_SESSION['language'] == 'english') {
... set of cases for english
      }else{ //language is italian
... set of cases for italian
      } //if language
```php
      // categories dressing - add subtext below a cat
      if ($_SESSION['language'] == 'english') {
      switch ($current_path) {
	  case '23': //replace number with your desired cPath
        $content .= '<span class="catBoxSubtext">Subtext for cat 23 escape apostrophe\'s</span>' . $disp_block . "\n"; 
      break;
      } //english subtext
      }else{ //language is italian
      switch ($current_path) {
	  case '23': //replace number with your desired cPath
        $content .= '<span class="catBoxSubtext">Subtext for cat 23 escape apostrophe\'s</span>' . $disp_block . "\n"; 
      break;
      } //italian subtext
      } //if language
01 Jul 2008, 17:11
#311
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Categories Dressing

Relentless -
What you posted will essentially include the href twice, and have no class tag for the link.

<a href="http://www.samplewebsite.com/index.php?main_page=index&cPath=28">' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">

ht tp://ww w.samplewebsite.com/index.php?main_page=index&cPath=28

is exactly what

zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path'])

evaluates to, so you would get in execution

<a href="http://www.samplewebsite.com/index.php?main_page=index&cPath=28">http://www.samplewebsite.com/index.php?main_page=index&cPath=28">

01 Jul 2008, 23:23
#312
relentless avatar

relentless

New Zenner

Join Date:
Sep 2007
Posts:
56
Plugin Contributions:
0

Re: Categories Dressing

I have not worked with class and herf in php before.
I think I am close.

<?php { case '28': //replace number with your desired cPath $content .= '<a class="'. a.catBoxHeading1 . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">'>Air Conditioning<br /> Split System<br /> Ducted<br /></a>' . $disp_block_head) . "\n"; break; } ?>

This is the css

.catBoxHeading1 {
font-family: arial,verdana,helvetica, sans-serif;
font-weight: bold;
font-size: 1em;
color: #00DD00;
margin-top: 2px;
margin-bottom: 2px;
padding-top:2px;
padding-bottom:2px;
margin-left:-6px;
}

a.catBoxHeading1:visited {
font-family: arial,verdana,helvetica, sans-serif;
font-weight: bold;
font-size: 1em;
color: #00CD00;
margin-top: 2px;
margin-bottom: 2px;
padding-top:2px;
padding-bottom:2px;
margin-left:-6px;
}

a.catBoxHeading1:hover {
font-family: arial,verdana,helvetica, sans-serif;
font-weight: bold;
font-size: 1em;
color: #000000;
margin-top: 2px;
margin-bottom: 2px;
padding-top:2px;
padding-bottom:2px;
margin-left:-6px;
}

a.catBoxHeading1:active {
font-family: arial,verdana,helvetica, sans-serif;
font-weight: bold;
font-size: 1em;
color:#FF0000;
margin-top: 2px;
margin-bottom: 2px;
padding-top:2px;
padding-bottom:2px;
margin-left:-6px;
}
Thank You
Relentless

02 Jul 2008, 07:30
#313
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Categories Dressing

Using [php] tags in your post will show up certain coding errors:```php
$content .= '<a class="'. a.catBoxHeading1 . '" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">'>Air Conditioning<br /> Split System<br /> Ducted<br /></a>' . $disp_block_head) . "\n";

You don't want the single quote before the >, as that will tell php that the text string is finished and the rest is php code.
```php
$content .= '<a class="catBoxHeading1" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">>Air Conditioning<br /> Split System<br /> Ducted<br /></a>' . $disp_block_head) . "\n";

The css looks good, although you don't need to spell out so much. The first set is ok, but the rest differ only in the color, and don't need to have the rest of the properties mentioned. They will be inherited from the link declaration unless specifically changed.

a.catBoxHeading1:visited {
color: #00CD00;
}

02 Jul 2008, 12:00
#314
silvioto avatar

silvioto

New Zenner

Join Date:
Jan 2008
Posts:
2
Plugin Contributions:
0

Re: Categories Dressing

Thanks a lot gjh42! This solution worked very well and I resolved my problem. Thanks again...

Silvio.

03 Jul 2008, 00:35
#315
relentless avatar

relentless

New Zenner

Join Date:
Sep 2007
Posts:
56
Plugin Contributions:
0

Re: Categories Dressing

/*I see that I have arrived back at your original PHP code entry,
now it makes sense, is this correct, to put in tpl_categories.php. */

<?php case '28': //replace number with your desired cPath $content .= '<a class="catBoxHeading1" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">>Air Conditioning<br /> Split System<br /> Ducted<br /></a>' . $disp_block_head) . "\n"; break; ?>

This is the css

.catBoxHeading1 {
font-family: arial,verdana,helvetica, sans-serif;
font-weight: bold;
font-size: 1em;
color: #00DD00;
margin-top: 2px;
margin-bottom: 2px;
padding-top:2px;
padding-bottom:2px;
margin-left:-6px;
}

a.catBoxHeading1:visited {
color: #00CD00;
}
a.catBoxHeading1:hover {
color: 000;
}
a.catBoxHeading1:active {
color: #f30;
}
Thank You
Relentless

03 Jul 2008, 08:03
#316
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Categories Dressing

That looks correct. Try it and see!

03 Jul 2008, 23:33
#317
relentless avatar

relentless

New Zenner

Join Date:
Sep 2007
Posts:
56
Plugin Contributions:
0

Re: Categories Dressing

I got this error
Parse error: syntax error, unexpected ')' in
/home2/xxxxxx/public_html/includes/templates/zencart_zen/sideboxes/tpl_categories.php on line 47
Line 47 is part of this PHP, I do not see the ')'
------This caused the error. I commented the original PHP, in case of an error.
// categories dressing - add (divider and) heading above a cat
$disp_block_head = '';
//$disp_block_head = '<br />'; // for heading not block uncomment this line
switch ($current_path) {
case '28': //replace number with your desired cPath
$content .= '<a class="catBoxHeading1" href="' . zen_href_link(FILENAME_DEFAULT, $box_categories_array[$i]['path']) . '">>Air Conditioning<br /> Split System<br /> Ducted<br /></a>' . $disp_block_head) . "\n";
//$content .= '<hr class="catBoxDivider" />' . "\n"; // to add divider uncomment this line
//$content .= '<span class="catBoxHeading1">' . (file_exists(DIR_WS_TEMPLATE_IMAGES . 'cathead' . $current_path . '.gif') ? //zen_image(DIR_WS_TEMPLATE_IMAGES . 'cathead' . $current_path . '.gif') . '</span>':'>Split System<br /> Air Conditioning<br /> //Ducted<br /></span>' . $disp_block_head) . "\n";
break;
Thank You
Relentless

04 Jul 2008, 05:37
#318
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Categories Dressing

With the deletion of

. (file_exists(DIR_WS_TEMPLATE_IMAGES . 'cathead' . $current_path . '.gif') ? //zen_image(DIR_WS_TEMPLATE_IMAGES . 'cathead' . $current_path . '.gif') .

the ) after $disp_block_head should have been removed also. I missed that in the original simplification.

04 Jul 2008, 09:52
#319
jvanree avatar

jvanree

Zen Follower

Join Date:
Mar 2008
Location:
Gouda, Netherlands
Posts:
211
Plugin Contributions:
0

Re: Categories Dressing

@ Glenn

Thank you for helping out!

05 Jul 2008, 01:27
#320
relentless avatar

relentless

New Zenner

Join Date:
Sep 2007
Posts:
56
Plugin Contributions:
0

Re: Categories Dressing

The Categories Dressing Heading link is working,
.catBoxHeading1 css line 911 the [color: #00DD00;] not working.
It's the color that makes the Heading
the color is inherited from the a:link, css line 23 with color:ff11bb;
now the heading is the same #color as the Category links.
Is there a fix for this?
Or is it a matter of a total css link overhaul.
Thank You
Relentless