I'm new to the eZComponents framework and I 'm using the Mvc Tools and persistent object to manipulate data from mysql.
I can get a single product on a page but I cannot list my products! Can someone help me with this code:
controller.php
public function doListproducts()
{
$ret = new ezcMvcResult;
$session = ezcPersistentSessionInstance::get();
$q = $session->createFindQuery('Product');
$objects = $session->findIterator($q, 'Product');
//$objects = $session->find($q, 'Product');
foreach ( $objects as $object )
{
$ret->variables['products'] = $object;
//$ret->variables['products'] = $object->getState();
}
return $ret;
}
template:
{use $products}
{foreach $products as $product}
{$article['product']}<br>{$product['body']}<br><br>
{/foreach}
The comments are different solutions but don't work either. Thanks for your help