Jump to content

Conditional images on category page.


Recommended Posts

Hi,

 

Along the top of my category page I have a banner, which shows An image and text, pretty much the same way it is done in the default theme.

 

I have modified breadcrumbs.tpl to show the description and short description, and also it has been modified to show two logos on either side of the description, see here:

<div class="row">

	<div class="col-sm-2">
	<img src="/img/additional_images/USDA_seal_small.png">
	</div>
	<div class="col-sm-8 dave_centre_breadcrumb_tpl">
		<span class="category-name">
		{strip}
		{$category->name|escape:'html':'UTF-8'}
		{if isset($categoryNameComplement)}
		{$categoryNameComplement|escape:'html':'UTF-8'}
		{/if}
		{/strip}
		
		{* from here added by dave*}
		{if $category->description}<div class="dave_cat_desc">{if Tools::strlen($category->description) > 350}<div id="category_description_short">{$description_short}</div>{else}<div>{$category->description}</div>{/if}</div>{/if}

		
		{* up to here *}
		</span>
	</div>

	{* this is the logoextra.png image dave *}
	<div class="col-sm-2 hidden-phone">
		<img src="/img/additional_images/logoextra_outerGlw.png">
	</div>
   	</div>

As you can see I have three columns in this row, The first column contains an image, the second column shows the description, an the third column shows an image.

 

Now my question is this: I only want the first column image shown for certain categories, not all.

 

I am sure it can be done with an {if} construct, but I don't know what the condition is, how can I check for a category?

 

so for example:

if category=Allowed

show image

else

don't show image

 

How do I manage something like that?

 

Regards,

Dave.

 

Link to comment
Share on other sites

I have tried this:

<div class="col-sm-2">
	
	
	{if $category eq 'Wild Organic Cold Extraction'}
	<img src="/img/additional_images/USDA_seal_small.png">
	{elseif $category eq 'Wild Organic Stone Mill'}
	<img src="/img/additional_images/USDA_seal_small.png">
	{/if}
	
	
	</div>

But it doesn't work, I think I have got the conditions wrong, anyone know how to do this?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...