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)
-   -   Hiding and showing elements on different pages (https://forum.x-cart.com/showthread.php?t=57894)

mekon 02-04-2011 12:33 AM

Hiding and showing elements on different pages
 
Hello all, my first time using xcart so please go easy, I used to work with Actinic ecommerce software but got sick and tired of it. :-)

Getting used to the structure and how the store works. Im throwing myself in at the deep end and creating a fresh template.
One of the things I want to do is hide or show various elements depending on what page the user is on.

Im aware that this can be done and have achieved it on some items, but for this one im stuck >>


In content.tpl I have created a space which will hold a rotating / fading jquery slider, this needs to appear as default apart from various pages, these being:

cart stuff
product pages
category pages

On the category pages only, I want to replace this div with another which holds the current category image. I have found out how to do this: http://forum.x-cart.com/showthread.php?t=54046


Being a designer and not being a programmer (having a head that works that way) im guessing at what I need.

So far I have got the following which show the category images:

<div id="banner">
<img src="{if $current_category.icon_url}{$current_category.icon _url}
{else}{$xcart_web_dir}/image.php?id={$cat}&amp;type=C{/if}" alt="Home & Garden" />
</div><!-- / banner -->

How do I hide this on every other page, but show the other div as default apart from the cart stuff and product pages?

I have got this far for the hiding on the product and cart page. Ive tried to find something which would allow hiding on the categories but haven't been able to.

{if ($main neq 'product' and $main neq 'cart' or $cart_empty) and $main neq 'checkout'}
<div id="banner">
jquery slider
</div><!-- / banner -->
{/if}


If's and else's direction needed please.

Thanks in advance.
Kon

pauldodman 02-04-2011 01:46 AM

Re: Hiding and showing elements on different pages
 
Category pages you'd need:
$main neq "catalog"

mekon 02-04-2011 02:14 AM

Re: Hiding and showing elements on different pages
 
Thanks for the reply Paul, that hides it on the home page too though

mekon 02-04-2011 02:34 AM

Re: Hiding and showing elements on different pages
 
Almost there with this...just need to show the jquery slider on the home page.

Instead of using 'catalog' is there another way of hiding the top code on the category pages but showing it on the home?

{if ($main neq 'product' and $main neq 'catalog' and $main neq 'catalog' and $main neq 'cart' or $cart_empty) and $main neq 'checkout'}

<div id="banner">
Jquery banner thing
</div><!-- / banner -->

{/if}


{if $current_category.category neq ""}

<div id="banner">
<img src="{if $current_category.icon_url}{$current_category.icon _url}
{else}{$xcart_web_dir}/image.php?id={$cat}&amp;type=C{/if}" alt="Alt here" />
</div><!-- / banner -->

{/if}

pauldodman 02-04-2011 02:36 AM

Re: Hiding and showing elements on different pages
 
The home page itself is defined by
$main eq "catalog" and $current_category.category eq ""

So you'll need to combine this into your if statement.

mekon 02-04-2011 04:27 AM

Re: Hiding and showing elements on different pages
 
Thanks a lot Paul, got there in the end:

{if ($main neq 'product' and $current_category.category eq "" and $main neq 'cart' or $cart_empty) and $main neq 'checkout'}

<div id="banner">
Jquery banner thing
</div><!-- / banner -->

{/if}


All times are GMT -8. The time now is 05:27 PM.

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