Smarty field name in PHP?

This code in a .tpl -



I’m in product_details.tpl trying to display some fields:


{php}

session_start();

$_SESSION[‘product’] = “BBBBBBB”;

{/php}

{$product.product}


{$product.product_id}


{$smarty.session.product}




Yields this output -



I’m in product_details.tpl trying to display some fields:

Test Base

30472

BBBBBBB



And that’s exactly what I’d expect.

Now … how can I change the statement $_SESSION[‘product’] = “BBBBBBB”;

to get the value of {$product.product}?



Here’s a few that DIDN’t work -



$_SESSION[‘product’] = $product.product;

$_SESSION[‘product’] = {$product.product};

$_SESSION[‘product’] = {$smarty.product.product};

$_SESSION[‘product’] = $smarty.product.product;

The quickest way for me to find the answer is to give up and do a post.



The answer was here -

[url]http://forum.cs-cart.com/showthread.php?t=3218&highlight=get_template_vars[/url]



and looks like this (note lines 2,5 and 6) -



I’m in product_details.tpl trying to display some fields:


{assign var=smarty_var_get value=$product.product}

{php}

session_start();

$smarty_var = $this->get_template_vars(‘smarty_var_get’);

$_SESSION[‘product’] = $smarty_var;

{/php}