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)
-   -   Horizontal Category Links (https://forum.x-cart.com/showthread.php?t=39079)

tamicampos 04-14-2008 06:45 PM

Horizontal Category Links
 
Hello,

I have searched the forum and asked the original poster but have not found an answer or gotten a reply. I added horizontal categories to my site but the links don't work. They are still on the vertical menu also (I wanted to wait to take them off until I got these working) and those work fine. I know how to add a regular link but with the dynamically changing categories, I am lost. I don't want to lose the ability to change category names in the Admin area. Please help.

Holub 04-15-2008 12:28 AM

Re: Horizontal Category Links
 
You should modify /skin1/customer/categories.tpl to horizontal layout. Also you should change the place where this templates including - in /skin1/customer/home.tpl.

balinor 04-15-2008 04:00 AM

Re: Horizontal Category Links
 
Moving to Template Editing, as this is not a bug.

kube 04-15-2008 02:16 PM

Re: Horizontal Category Links
 
Hi tamicampos,

If you want similar functionality to categories.tpl and for them to be displayed horizontally somewhere other than the side columns, for instance, in the main body.

Make a duplicate of categories.tpl and name the duplicate something like categories_horz.tpl

Then inside the categories_horz.tpl replace everything with this...
Code:

{capture name=menu}
{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
<span class="CategoriesList"><a href="home.php?cat={$c.categoryid}" class="VertMenuItems">{$c.category}</a></span>
{/foreach}
{else} {foreach from=$subcategories item=c key=catid}
<span class="CategoriesList"><a href="home.php?cat={$catid}" class="VertMenuItems">{$c.category}</a></span>
{/foreach}
{/if}
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}


and to reference it; plonk the following in a suitable place... (provided that the duplicate was in the same folder as categories.tpl)

Code:

{include file="customer/categories_horz.tpl"}

Hope this helps.

tamicampos 04-29-2008 01:20 PM

Re: Horizontal Category Links
 
Hello,

I moved my categories to horizontal in the head.tpl and it works great for IE but the links do not work in either Firefox or in Safari. Any idea why? Do you know how I can fix that? The other links work fine (home, shopping cart, search, etc.) My URL is www.kookoomonkey.com .

Thanks.

kube 04-29-2008 02:14 PM

Re: Horizontal Category Links
 
The code isn't forming correctly. IE can be forgiving (misleading) in that department. They're outputting like this...
<a href="home.php?cat=103" </a>

Any chance of seeing the code you have entered?

tamicampos 04-29-2008 02:56 PM

Re: Horizontal Category Links
 
Absolutely!! Here it is (fexcerpt from head.tpl)


{*Horizontal Navigation Bar*}
<td class="HeadLine" height="45" align="center">
{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
<a href="home.php?cat={$c.categoryid}" </a>
<font color="99cccc">{$c.category}{if not %categories.last%}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;{/if}</font>{/foreach}
{else}
{foreach from=$subcategories item=c key=catid}
<font color="99cccc">{$c.category}{if not %categories.last%}&nbsp;;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;{/if}</font>
{/foreach}
{/if}
{if ($usertype eq "C" || $usertype eq "B") && $all_languages_cnt gt 1}
<form action="home.php" method="get" name="sl_form">
<input type="hidden" name="redirect" value="{$smarty.server.PHP_SELF}?{$smarty.server.Q UERY_STRING|amp}" />
<table cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px;"><b>{$lng.lbl_select_language}:</b></td>
<td><select name="sl" onchange="javascript: this.form.submit();">
{section name=ai loop=$all_languages}
<option value="{$all_languages[ai].code}"{if $store_language eq $all_languages[ai].code} selected="selected"{/if}>{$all_languages[ai].language}</option>
{/section}
</select></td>
</tr>
</table>
</form>
{else}
&nbsp;
{/if}
</td>
</tr>
{else}

kube 04-29-2008 03:47 PM

Re: Horizontal Category Links
 
Try replacing this part of your code below...
Code:

{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
<a href="home.php?cat={$c.categoryid}" </a>
<font color="99cccc">{$c.category}{if not %categories.last%}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;{/if}</font>{/foreach}
{else}
{foreach from=$subcategories item=c key=catid}
<font color="99cccc">{$c.category}{if not %categories.last%}&nbsp;;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;{/if}</font>
{/foreach}
{/if}


With this...
Code:

{if $config.General.root_categories eq "Y"}
<span class="catnav">
{foreach from=$categories item=c name=thisloop}
<a href="home.php?cat={$c.categoryid}"{if $smarty.foreach.thisloop.last} class="navlastitem"{/if}>{$c.category}</a>
{/foreach}
</span>
{/if}


Check if it is okay. And if it is, then add this to your css file.
Code:

.catnav A, .catnav A:link, .catnav A:visited {
color:#99CCCC;
margin-right:20px;
text-decoration:none;
}
.catnav A:hover {
color:#FF0000;
text-decoration:underline;
}
.catnav A.navlastitem {
margin-right:0px;
}


Hope this helps.

tamicampos 05-01-2008 11:13 AM

Re: Horizontal Category Links
 
This is the error message I got.


Error: Smarty error: [in head.tpl line 71]: syntax error: unexpected {else} (Smarty_Compiler.class.php, line 468) in /home/cute4uki/public_html/store/Smarty-2.6.12/Smarty.class.php on line 1095

Parse error: syntax error, unexpected T_ELSE in /home/cute4uki/public_html/store/var/templates_c/%%68^689^68964653%%head.tpl.php on line 109

kube 05-01-2008 03:14 PM

Re: Horizontal Category Links
 
Hi tami,

The code is a straight swap. It shouldn't produce that result.

If you can, upload a full head.tpl as an attachment and I'll/we'll try to find out where the mistake lies - if you'd like.

tamicampos 05-02-2008 03:53 AM

Re: Horizontal Category Links
 
You are awesome! I really appreciate it! I have learned a lot but am still very green!

{* $Id: head.tpl,v 1.58.2.1 2007/09/03 06:15:21 max Exp $ *}
{* Top Row*}
<table cellpadding="5" cellspacing="0" width="100%">
<tr>
<td colspan="2" class="HeadLine" height="22">
&nbsp;<a href="home.php">Home</a> &nbsp;&nbsp;&nbsp;
<a href="cart.php">Shopping Cart</a> &nbsp;&nbsp;&nbsp;
<a href="help.php?section=contactus&mode=update">Cont act Us</a>
<td class="HeadLine" align="right">
{if $usertype eq "C"}
{ include file="customer/search.tpl" }
{/if}
</td>
</tr>
</table>
{*Thin Line*}
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td colspan="2" class="HeadThinLine"><img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" /></td>
{*Logo Banner*}
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="HeadLogo" height="100"><a href="home.php"><img src="{$ImagesDir}/kookoomonkeylogo2.jpg" width="244" height="100" alt="" /></a></td>
<td class="HeadRightBox">
{if $usertype eq "C"}
{include file="customer/top_menu.tpl"}
{/if}
</td>
</tr>
</table>
{*Thin Line*}
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td colspan="2" class="HeadThinLine"><img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" /></td>
</tr>
{if $main ne "fast_lane_checkout"}
<tr>
{*Horizontal Navigation Bar*}
<td class="HeadLine" height="45" align="center">
{if $config.General.root_categories eq "Y"}
<span class="catnav">
{foreach from=$categories item=c name=thisloop}
<a href="home.php?cat={$c.categoryid}"{if $smarty.foreach.thisloop.last} class="navlastitem"{/if}>{$c.category}</a>
{/foreach}
</span>
{/if}
{else}
{foreach from=$subcategories item=c key=catid}
<font color="99cccc">{$c.category}{if not %categories.last%}&nbsp;;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;{/if}</font>
{/foreach}
{/if}
{if ($usertype eq "C" || $usertype eq "B") && $all_languages_cnt gt 1}
<form action="home.php" method="get" name="sl_form">
<input type="hidden" name="redirect" value="{$smarty.server.PHP_SELF}?{$smarty.server.Q UERY_STRING|amp}" />
<table cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px;"><b>{$lng.lbl_select_language}:</b></td>
<td><select name="sl" onchange="javascript: this.form.submit();">
{section name=ai loop=$all_languages}
<option value="{$all_languages[ai].code}"{if $store_language eq $all_languages[ai].code} selected="selected"{/if}>{$all_languages[ai].language}</option>
{/section}
</select></td>
</tr>
</table>
</form>
{else}
&nbsp;
{/if}
</td>
</tr>
{else}
{* Fast Lane Checkout page *}
<tr>
<td colspan="2" class="HeadLine">
<form action="{$xcart_web_dir}/include/login.php" method="post" name="toploginform">
<input type="hidden" name="mode" value="logout" />
<input type="hidden" name="redirect" value="{$redirect|escape}" />
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="FLCAuthPreBox">
{if $active_modules.SnS_connector and $sns_collector_path_url ne '' && $config.SnS_connector.sns_display_button eq 'Y'}
<img src="{$ImagesDir}/rarrow.gif" alt="" valign="middle" /><b>{include file="modules/SnS_connector/button.tpl" text_link="Y"}</b>
{else}
<img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" />
{/if}
</td>
{if $login ne ""}
<td align="right" font-color="#ffffff" nowrap="nowrap"><b>{$userinfo.firstname} {$userinfo.lastname}</b> {$lng.txt_logged_in}</td>
<td class="FLCAuthBox">
{if $js_enabled}
{include file="buttons/button.tpl" button_title=$lng.lbl_logoff href="javascript: document.toploginform.submit();" js_to_href="Y"}
{else}
{include file="buttons/logout_menu.tpl"}
{/if}
</td>
{/if}
</tr>
</table>
</form>
</td>
</tr>
{/if}
<tr>
<td colspan="2" class="HeadThinLine"><img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" /></td>
</tr>
{******** Remove this line to display how much products there are online ****
<tr>
{insert name="productsonline" assign="_productsonline"}
<td colspan="2" class="NumberOfArticles" align="right">
{if $config.Appearance.show_in_stock eq "Y"}
{insert name="itemsonline" assign="_itemsonline"}
{$lng.lbl_products_and_items_online|substitute:"X" :$_productsonline:"Y":$_itemsonline}
{else}
{$lng.lbl_products_online|substitute:"X":$_product sonline}
{/if}
&nbsp;
</td>
</tr>
**** Remove this line to display how much products there are online ********}
{*
{if $main ne "fast_lane_checkout"}
<tr>
<td colspan="2" valign="middle" height="32">
<table cellspacing="0" cellpadding="0" width="100%">
<tr>
<td class="HeadTopPad"><img src="{$ImagesDir}/spacer.gif" alt="" /></td>
{if (($main eq 'catalog' && $cat ne '') || $main eq 'product' || ($main eq 'comparison' && $mode eq 'compare_table') || ($main eq 'choosing' && $smarty.get.mode eq 'choose')) && $config.Appearance.enabled_printable_version eq 'Y'}
<td class="PrintableRow" align="right">{include file="printable.tpl"}</td>
{/if}
</tr>
</table>
</td>
</tr>
{else}
<tr>
<td colspan="2" class="FLCTopPad"><img src="{$ImagesDir}/spacer.gif" alt="" /></td>
</tr>
{/if}
*}
</table>

Group Imaging 05-02-2008 09:24 AM

Re: Horizontal Category Links
 
From what I can tell it has nothing to do with your code Kube. I got a similar message when I tried this and I think it's just that the initial code provided has one too many "{else}" statements. I think this should work for you Tami:
Code:

{*Horizontal Navigation Bar*}
<td class="HeadLine" height="45" align="center">
{if $config.General.root_categories eq "Y"}
<span class="catnav">
{foreach from=$categories item=c name=thisloop}
<a href="home.php?cat={$c.categoryid}"{if $smarty.foreach.thisloop.last} class="navlastitem"{/if}>{$c.category}</a>
{/foreach}
</span>
{/if}
{if ($usertype eq "C" || $usertype eq "B") && $all_languages_cnt gt 1}
<form action="home.php" method="get" name="sl_form">
<input type="hidden" name="redirect" value="{$smarty.server.PHP_SELF}?{$smarty.server.Q UERY_STRING|amp}" />
<table cellpadding="0" cellspacing="0">
<tr>
<td style="padding-right: 5px;"><b>{$lng.lbl_select_language}:</b></td>
<td><select name="sl" onchange="javascript: this.form.submit();">
{section name=ai loop=$all_languages}
<option value="{$all_languages[ai].code}"{if $store_language eq $all_languages[ai].code} selected="selected"{/if}>{$all_languages[ai].language}</option>
{/section}
</select></td>
</tr>
</table>
</form>
{else}
&nbsp;
{/if}
</td>
</tr>


tamicampos 05-04-2008 02:29 PM

Re: Horizontal Category Links
 
You guys are great! Thanks so much for the help. It is working fine now in all browsers.


All times are GMT -8. The time now is 05:32 AM.

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