View Single Post
  #6  
Old 10-04-2006, 09:36 AM
 
anthony anthony is offline
 

Newbie
  
Join Date: Aug 2005
Posts: 3
 

Default Re: If statement checking for items in cart

Quote:
Originally Posted by DanUK
Is there also a statement along the same lines to check for a particular item in the cart?


I looked all over for this recently and then ended up just coding it myself in products.tpl. Should be a similar process for any other page. For the curious:

4.1.3

products.php

before

Code:
$smarty->assign("products",$products);

add
Code:
x_load('cart'); require $xcart_dir."/include/cart_process.php"; x_session_register("cart"); $cartprods = func_products_in_cart($cart, $membershipid); foreach($cartprods as $product){ $prodids[$product['productid']] = 'Y'; } $smarty->assign("cartprods",$prodids);

then in products.tpl

Code:
{assign var="pid" value=$products[product].productid} {if $cartprods[$pid] eq "Y"} ... {else} ... {/if}


hope that helps.
__________________
anthony
www.pointbweb.com
4.1.3
Reply With Quote