Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Adding Content Based on Smarty "IF" Statement

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-28-2008, 09:04 AM
 
amadecs amadecs is offline
 

Member
  
Join Date: Jan 2008
Posts: 20
 

Default Adding Content Based on Smarty "IF" Statement

I'm trying to make some customizations to my store, but having a little trouble doing so. I basically want to add or remove call to actions throughout my site depending on what page my visitor is on. So for example, if you look at my store right now: http://www.expresscomputersystems.com/

You'll notice that I have a column on the right that includes a call to action and a few featured products. But, if you go to a product page like this: http://www.expresscomputersystems.com/cisco-npe-g2-processor-pr-18789.html
You'll notice that those featured products are no longer in the right column. I use an "if" statement to do it, like this:

{if $main eq "catalog" and $current_category.category eq ""}
{include file="customer/featured_modifed.tpl" products=$f_products featured="Y"}
{/if}
{if $main eq "catalog" and $current_category.category ne ""}
{include file="customer/featured_modifed.tpl" products=$f_products featured="Y"}
{/if}

My site was designed by an outside team and I'm not too familiar with Smarty, so I'm really trying to figure all of this out for the first time. I basically need to figure out what these statements do:

{if $main eq "catalog" and $current_category.category eq ""}
{if $main eq "catalog" and $current_category.category ne ""}

I have done a little programming in the past, so I do understand if statements, but it's the Smarty tags that are over my head. If someone can break this statement down for me, I'd appreciate it.
__________________
X-Cart: Version 4.1.9
Apache: Version 1.3.39 (Unix)
PHP: Version 5.2.4
Reply With Quote
  #2  
Old 05-28-2008, 09:25 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Adding Content Based on Smarty "IF" Statement

Those if statements mean:

{if $main eq "catalog" and $current_category.category eq ""} = home page

{if $main eq "catalog" and $current_category.category ne ""} = any catalog page except the home page
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 05-28-2008, 09:28 AM
 
amadecs amadecs is offline
 

Member
  
Join Date: Jan 2008
Posts: 20
 

Default Re: Adding Content Based on Smarty "IF" Statement

Sweet! Thanks balinor.

So what would be the statement for static pages? Or a particular static page?
__________________
X-Cart: Version 4.1.9
Apache: Version 1.3.39 (Unix)
PHP: Version 5.2.4
Reply With Quote
  #4  
Old 05-28-2008, 09:33 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Adding Content Based on Smarty "IF" Statement

Read this thread, it'll tell you all you need to know

http://forum.x-cart.com/showthread.php?t=8881
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:18 PM.

   

 
X-Cart forums © 2001-2020