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 Main/Root Categories Page Mod needs last bit of help (https://forum.x-cart.com/showthread.php?t=32913)

Hunabku 07-31-2007 03:12 AM

New Main/Root Categories Page Mod needs last bit of help
 
I am so close to posting a new mod for a main/root categories page that uses content from a static page and a dynamic listing of root cats, but i don't know how to show the root cat icon.

Basically i took code out of subcategories.tpl and modified it to list root cats then inserted it into an if statement inside pages.tpl that tests if we are on the root cat static page. See moded pages.tpl below:

Code:

{* $Id: pages.tpl,v 1.3.2.1 2005/01/19 06:42:51 max Exp $ *}
{capture name=dialog}
{if $page_content ne ''}
{if $config.General.parse_smarty_tags eq "Y"}

{**Main/Root Categories Page mod.  Replace the page id "9" in the next line of code with the corresponding id of the static page you created for your main categories.**}
{if ($smarty.get.pageid eq "9")}
{$page_content}<br><br>
{if $categories}
{**The code below is extracted from subcategories.tpl and slightly modified so that all references to "sub cats" are changed to "cats".**}
<TABLE border="0" cellspacing="5" width="100%">
{foreach from=$categories item=cat}
<TR>
{if $tmp and $first_cat ne "Y"}
<TD valign="top" rowspan="{count value=$categories print="Y"}"><IMG src="{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/icon.php?categoryid={$cat}{/if}"></TD>
{assign var="first_cat" value="Y"}
{/if}
        <TD align="left" width="95%">&nbsp;<A href="home.php?cat={ $cat.categoryid }"><FONT class="ItemsList">{ $cat.category|escape }</FONT></A><BR></TD>
        <TD align="right" nowrap><FONT class="Text">{if $config.Appearance.count_products eq "Y"}
{if $cat.product_count}{ $cat.product_count } {$lng.lbl_products}
{elseif $cat.subcategory_count}{ $cat.subcategory_count } {$lng.lbl_categories|lower}
{/if}
        {/if}</FONT></TD>
</TR>
{/foreach}
</TABLE>
{/if}
{else}
{eval var=$page_content}
{/if}
{**End Main/Root Categories Page mod.**}

{else}
{$page_content}
{/if}
{/if}
{/capture}
{include file="dialog.tpl" title=$page_data.title content=$smarty.capture.dialog extra="width=100%"}


This line should show the root cat icon but it is still for subcat icon: <TD valign="top" rowspan="{count value=$categories print="Y"}"><IMG src="{if $current_category.icon_url}{$current_category.icon _url}{else}{$xcart_web_dir}/icon.php?categoryid={$cat}{/if}"></TD>

Any ideas?

mffowler 08-13-2007 08:33 AM

Re: New Main/Root Categories Page Mod needs last bit of help
 
Try this:

Code:

<img src="{if $c.icon_url}{$c.icon_url}{else}{$xcart_web_dir}/image.php?id={$cat}&amp;type=C{/if}">

- Mike

inebriate 08-13-2007 02:23 PM

Re: New Main/Root Categories Page Mod needs last bit of help
 
are you displaying a categories listing with icons on the main page?

if so, look at http://forum.x-cart.com/showthread.php?t=32237 , I made a similar mod but if I remember correctly, I used welcome.tpl to insert my code to put it at the top and in a seperate section

Hunabku 08-13-2007 03:11 PM

Re: New Main/Root Categories Page Mod needs last bit of help
 
Hey you guys, thanks for the help.

The technique I used was to create a static page for my Main/Root category page - so the client could insert copy in it easily. I do that by modifying pages.tpl with an if statement to include categories.tpl - see Beginners Example of Static Page with Dynamic Content.

I tried modifying categories.tpl to show icons (from within pages) but to no avail. I think i already tried mffowler's example code earlier and it didn't seem to work. Eventually I gave up and the client is happy not having the icons so if we figure this out now - I guess it would be to complete a mod for x-cart users' sake.

inebriate 08-13-2007 05:10 PM

Re: New Main/Root Categories Page Mod needs last bit of help
 
you may want to look at http://forum.x-cart.com/showthread.php?t=32195 ? it uses positioning rather than id number


All times are GMT -8. The time now is 09:53 PM.

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