Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Insert conditional statement

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
jbmaca
Smarty n00b


Joined: 03 Sep 2009
Posts: 4

PostPosted: Thu Sep 03, 2009 7:17 am    Post subject: Insert conditional statement Reply with quote

First post
Back to top
View user's profile Send private message
jbmaca
Smarty n00b


Joined: 03 Sep 2009
Posts: 4

PostPosted: Thu Sep 03, 2009 7:17 am    Post subject: Reply with quote

Second post
Back to top
View user's profile Send private message
jbmaca
Smarty n00b


Joined: 03 Sep 2009
Posts: 4

PostPosted: Thu Sep 03, 2009 7:17 am    Post subject: Reply with quote

Hi,

I'm a total noob when it comes to smarty and php so was wondering if anyone here can help me with a simple request. I'm using PrestaShop and am trying to figure out a way to delete the words "Available" and "Add to cart" just in the Travel section of my website, but retain them in all the other sections. Here's the link to show you what I mean:

http://www.baby-international.com/35-travel

I understand that I need to identify that Travel section in the code somehow and insert a conditional statement? I've been playing around with the code without much luck. Can anyone nudge me in the right direction? Here's the snippet of smarty code that I think I need to modify somehow:

<span {if ($product.allow_oosp OR $product.quantity > 0)}class="availability"{else}class="outofstock"{/if}>{if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if}</span>
{if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2}
<a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$base_dir}cart.php?add&amp;id_product={$product.id_product|intval}&amp;token={$static_token}">{l s='Add to cart'}</a>
{else}
<span class="exclusive">{l s='Add to cart'}</span>


Any help would be greatly appreciated. Many thanks.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Sep 03, 2009 7:11 pm    Post subject: Reply with quote

You need to find a variable in your template that tells you what section you are in, and do something like:

Code:
{if $section eq "Travel"}
  put travel section stuff here
{else}
  put non-travel section stuff here
{/if}


Maybe $section is the one, otherwise you can (temporarily) put this in the template:

Code:
{debug}


and it will pop up a window with all the available template variables.
Back to top
View user's profile Send private message Visit poster's website
jbmaca
Smarty n00b


Joined: 03 Sep 2009
Posts: 4

PostPosted: Fri Sep 04, 2009 12:34 am    Post subject: Reply with quote

many thanks for the reply mohrt. i'll try working with that and see if i get anywhere with it. thanks again.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP