Create an Array that interacts with CS-Cart Smarty Variables

I’m new to Smarty and CS-Cart in general,





I was able to create a foreach loop in smarty, outputting a list of categories:


<br />
{foreach from=$categories item="category" name="categories"}<br />
  {$category.category}<br />
{/foreach}<br />

```<br />
<br />
That works, but now I'm trying to create an array with the information, but I don't know where to begin.<br />
<br />
I tried doing it in html, putting my code in between {php} {/php} tags, but cscart seemed to ignore it all together.

Please explain further? You San to store the info from cs cart array into. A new array??

thank you for responding!



Yes, I'm trying to store information from a CS Cart array into my own array. I'm doing this because I'm trying to write a custom PHP function on a product list template.



I don't know the first thing about doing that in CS Cart.

Just change the setting in config.local.php to allow php template code in templates.

don't use PHP in templates!!!



If you have a PHP array just assign it to a template variable in your PHP code like:


Registry::get('view')->assign('name_of_variable', $array_data);




Embedding PHP code in templates is not only bad design, but it causes the template engine to recurse which chews up performance.