troubleshooting Question

Smarty Foreach Help Needed

Avatar of sharingsunshine
sharingsunshineFlag for United States of America asked on
PHP
13 Comments1 Solution278 ViewsLast Modified:
I have a need to parse the contents of the cart for a particular productid.  I have found the exact foreach code I am using in a smarty .tpl that is being included above my code in the same .tpl file.  So I am confused why it won't work.

{foreach from=$products item=product name=products}
    {$product.productid}
     {if $product.productid eq 357}
     {include file="promotions/cleanstart_promo.tpl"}
     {/if}
     {/foreach}

When I use this code I get this error:

Invalid argument supplied for foreach()

The table has the key productid.  What am I doing wrong.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros