Jump to content

Can i use Smarty variable in the Product Description?


Recommended Posts

Hi,

 

Is it possible to use smarty variables in the product description?

 

I need to add:

 

{if $cookie->isLogged()}
<p>logged in</p>
{else}
<p>not logged in</p>
{/if}

 

Any workaround to get these working in the description? At the moment it just displays the code and does not run it?

 

Cheers

Link to comment
Share on other sites

well in my opinion: YES. but it isn't as simple as it seems.

 

you can create a block with class like .onlyforlogged in description (by using HTML in wysiwyg editor), for example:

<div class="onlyforlogged">HIDDEN CONTENT HEREE</div>

 

next, add into product.tpl template file code like below:

{if !$cookie->isLogged()}
{literal}
<script>
$(".onlyforlogged").remove();
</script>
{/literal}
{/if}

Link to comment
Share on other sites

well i checked this code on my own test shop and you've got right - the code still appears in source. So maybe the best way is to change content, exactly as you said.

 

try to add:

 

 

{if !$cookie->isLogged()}

{literal}

<script>

$(".onlyforlogged").html('log in first');

</script>

{/literal}

{/if}

 

 

EDIT

it works the same as first code :(

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...