Jump to content

Massive errors in Smarty Cache


Recommended Posts

I keep getting errors in the product.tpl smarty cache file.  What I'm trying to do is if the product has a particular tag it will show a particular element.  I'm using smarty to see if the product has the tag "rent".  If it does then an image will show.

 

The error log have entries like this:

Warning:  in_array() expects parameter 2 to be array, null given in 

/cache/smarty/compile/94/4d/52/944d5284e871d0de7a0c6b84ebb2089ad579ed8b.file.product.tpl.php on line 330

 

Line 330 is: 

<?php if (in_array('rent',$_smarty_tpl->tpl_vars['product']->value->tags[1])) {?> 
<img id="turnKeyimg" alt="TurnKey Rental Option" 
src="<?php echo $_smarty_tpl->tpl_vars['tpl_uri']->value;
?>

The actual tpl looks like this:

{if in_array('rent', $product->tags.1)}
     <img id="turnKeyimg" alt="TurnKey Rental Option" src="{$tpl_uri}img/key.png"/>
     <h3>TurnKey Rental Option</h3>
     <p>Also available for immediate rental.<br />Request a quote today</p>
{/if}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...