View Single Post
  #5  
Old 02-13-2013, 11:36 PM
 
strimpf strimpf is offline
 

Newbie
  
Join Date: Feb 2013
Posts: 4
 

Default Re: Detect that session is viewing the Shopping Cart in home.tpl

I have been looking at this for a little while now and I am not getting it.

In home.tpl, I would like to check if $main = 'cart' or 'checkout' and if so, check the first 3 chars of the name of the first item [0] in the cart(could be the first 3 chars of the SKU which might be better) to see if it matches the string 'SLC'. If it does, I am going to change the css used to render the header and some other features in the home.tpl template. I have this working based on Category and Product, but can't seem to get a handle on the first product in the cart and check values on it.

I think I don't understand the scope of $cart. It is a php variable so I don't think I can use it directly in Smarty code. I will put a snippet of my busted code below so you can see the depths of my ignorance.

Code:
{$item_is_special = ""} {if $main eq "cart" or $main eq "checkout" or $main eq "order_message"} {if $products ne ""} {*foreach from=$products item=product*} {if $product[0].producttitle|substr:0:3 eq "SLC"} {$item_is_special = "Y"} {/if} {/if} {/if}

I don't think I even declared the local variable $item_is_special correctly.

UPDATE: (ok, nevermind about the question below. Found the answer here)
Also, is there documentation for XCart that shows the structure of the $cart object and $product object?


Thanks in advance for your time.
__________________
4.5.2
Reply With Quote