View Single Post
  #19  
Old 03-27-2012, 02:24 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Display manufacturer list on category page

I was thinking that $manufacturers used the actual id as the first key of the 2 dimensional array. But I did a quick check and the first key is just a counter - so my code needs to be fixed. No time to try this - syntax may be off, but something like this should do the trick:

In products.php:
Code:
foreach ($products as $k => $v) { $manufac_id = $products[$k]['manufacturerid']; $manuf_this_cat[$manufac_id] = func_query_first_cell ("SELECT manufacturer FROM $sql_tbl[manufacturers] WHERE $sql_tbl[manufacturers].manufacturerid='$manufac_id'"); } $smarty->assign('manuf_this_cat',$manuf_this_cat);

Then in the template:
Code:
{if $manuf_this_cat} <hr /> <ul> {foreach from=$manuf_this_cat key=k item=v} <li> manufacturerid:{$k}<br /> name:{$v}<br /> link: <a href="manufacturers.php?manufacturerid={$k}">{$v}</a> </li> {/foreach} </ul> <hr /> {/if}
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote