I'm pretty sure this is possible, maybe via a custom function, but I can't seem to get my head around it.
I have an array which I am merging with the template:
$qry = " SELECT p.agreement_id, p.agreement_title, count( product_id) as usecount
FROM ".INV_PREFIX."product_agreements p
LEFT OUTER JOIN ic_products i
ON p.agreement_id = i.product_agreement
WHERE p.owner_id = ".$mbr_config['id']."
GROUP BY p.agreement_id, p.agreement_title";
$agreements = $db->get_results($qry, ARRAY_A);
$TBS->MergeBlock('agreements',$agreements); |
TEMPLATE:
<tr>
<td class="light">[agreements.agreement_title;noerr;block=tr]</td>
<td class="light">[agreements.usecount;noerr] Products</td>
<td class="dark alignright"><a href="#">Edit</a> | <a href="#">Delete</a></td>
</tr> |
What I want to do is, if the agreements.usecount >0 then disable the "Delete" link for that row as products are currently using that agreement. So just have it show "Delete" as opposed to <a href="#">Delete</a>
Any pointers on the easiest way to accomplish this?