|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
jbmaca Smarty n00b
Joined: 03 Sep 2009 Posts: 4
|
Posted: Thu Sep 03, 2009 7:17 am Post subject: Insert conditional statement |
|
|
First post |
|
Back to top |
|
jbmaca Smarty n00b
Joined: 03 Sep 2009 Posts: 4
|
Posted: Thu Sep 03, 2009 7:17 am Post subject: |
|
|
Second post |
|
Back to top |
|
jbmaca Smarty n00b
Joined: 03 Sep 2009 Posts: 4
|
Posted: Thu Sep 03, 2009 7:17 am Post subject: |
|
|
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&id_product={$product.id_product|intval}&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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Sep 03, 2009 7:11 pm Post subject: |
|
|
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:
and it will pop up a window with all the available template variables. |
|
Back to top |
|
jbmaca Smarty n00b
Joined: 03 Sep 2009 Posts: 4
|
Posted: Fri Sep 04, 2009 12:34 am Post subject: |
|
|
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 |
|
|
|
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
|