View Single Post
  #4  
Old 08-01-2007, 11:44 AM
 
sharingsunshine sharingsunshine is offline
 

Senior Member
  
Join Date: Aug 2005
Location: Palmyra, VA
Posts: 149
 

Default Re: Conditional Test for Text String

Thanks for getting back to me. However, I am not getting it to work. Can you take a look at my work and see if something is wrong?

This is what is showing in the $sales array on the page I want the condition to work on

name => Buy 3 - SAVE $11.25 - Glyco Essentials

Here is my code on product.tpl

{if $sales}
{elseif $sales and $sales[sale].name|truncate:5 eq "Buy 3"}
{include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"}
{else}
{include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"}
{/if}

My logic:
If $sales is present then don't show the Buy Now button at all unless the name is Buy 3.
If no $sales is present then show the Buy Now button after all.

Any help will be greatly appreciated.

Thanks,

Randal
__________________
***********************
Visit Our Other Web Sites!
∙ Nutritional Herbs and Supplements
<a href="http://www.theherbsplace.com"> The Herbs Place </a>
∙ Frugal Ideas and a Forum To Submit Your Questions
<a href="http://www.thefrugallife.com"> The Frugal Life </a>
∙ Healthy and Natural Pet Products
<a href="http://www.healthypetcorner.com"> Healthy Pet Corner </a>
***********************

Joined 08/02/05
X-Cart Gold Version 4.3.2
Linux RedHat Enterprise
Reply With Quote