I am really in mess as I am unable to solve problem with Smarty Multi Dimension array.

Below is the way I want to execute Smarty.

First of all I will list all customers. Than I want list of all items purchased by that customer. I have two tables inside mysql (customer, sale). In Customer table only information related to his name and email is stored. While in sale table information related to item, price and customer is sold.

Below is the way I will execute my smarty.



In PHP File I have added below things.

$allcustomer = $fetchObj->getAllcustomer
$customer_name = $allcustomer['customer_name'];
$fetchObj->customer_name = $customer_name;
$allitem = $fetchObj->getAllitembycust();


In class file I am fetching content through below script for item list inside each customer

function getAllitembycust()
global $db,$smarty;
$sql = " SELECT * FROM sale WHERE customer_name = '$this->customer_name' ORDER BY date ASC";
$theList= $db->getAll($sql);
return $theList;

In .tpl file below code is their.

{foreach from=$allcustomer item=allcustomer}

{foreach from=$allitem item=allitem}