Quote:
Originally Posted by PhilJ
PHP Code:
# Get Product Manufacturer
if($products){
foreach($products as $key=> $product)
$products[$key]["manufacturerid"] = func_query_first_cell("SELECT manufacturerid FROM $sql_tbl[manufacturers] WHERE manufacturerid=" . $product["manufacturerid"]);
$products[$key]["manufacturer"] = func_query_first_cell("SELECT manufacturer FROM $sql_tbl[manufacturers] WHERE manufacturerid=" . $product["manufacturerid"]);
}
# /Get Product Manufacturer
|
The above is not correct. This should work better:
PHP Code:
if($products)
foreach($products as $key=> $product)
$products[$key]['manufacturer'] = func_query_first_cell("SELECT manufacturer FROM $sql_tbl[manufacturers] WHERE manufacturerid=$product[manufacturerid]");
I believe you should already have the list of all manufacturers so there should be no need to do a query to get them. In theory:
PHP Code:
{if $product.manufacturerid}
{foreach from=$manufacturers_menu item=m}
{if $m.manufacturerid eq $product.manufacturerid}
<p><a href="manufacturers.php?manufacturerid={$product.manufacturerid}">{$m.manufacturer|amp}</a></p>
{/if}
{/foreach}
{/if}