Jump to content

display tickets in separate table by department


agilityweb

Recommended Posts

hello

what i want to do is to display tickets in supporttickets.php in a separate table per department.

 

so rather 1 table as is currently with all tickets and separate one for department 1 , 2 etc

 

i was hoping to amend the foreach to pull in only from a single depat then replicate the table

 

i have a department called General support and one called product support

i tried

{foreach key=num item=ticket from=$tickets where $ticket.department='General Support'}

 

 

however i dont even get an error message

 

any ideas?

Link to comment
Share on other sites

You're probably best off pulling the tickets into a PHP block and parsing them into a new array thats keyed by the department. Maybe something like this. (untested)

 

{php}
$alltickets = $this->_tpl_vars['tickets'];
$ticketsout = array();
foreach ($alltickets as $key => $val) {
 $dept = $val['department'];
 $ticketsout[$dept][] = $val;
}

$this->_tpl_vars['modifiedtickets'] = $ticketsout;
{/php}

 

Then parse the array in smarty like this.

 

{foreach key=dept from=$modifiedtickets item=t}
 <h3>{$dept}</h3>
 <table>
   {foreach key=num from=$t item=ticket}
     <tr>
       <td>{$ticket.subject}</td>
       <td>etc</td>
     </tr>
   {/foreach}
 </table>
 <br />
{/foreach}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated