Quote:
Originally Posted by dgreen
Could you post exactly how to use this? I think this is what I have been trying to do but I couldn't figure out how to implement it.
|
This is a very quick and dirty solution which doesn't use the "xcart" way of creating database queries by using variable names, but it works. I inserted the following code at line 143 of "product.php":
Code:
$cat_result = db_query(" SELECT xcart_products_categories.categoryid,xcart_categories.category,xcart_categories.parentid FROM xcart_products_categories, xcart_categories WHERE xcart_products_categories.productid = $productid AND xcart_categories.categoryid = xcart_products_categories.categoryid AND xcart_categories.parentid != 0");
while ($category = db_fetch_row($cat_result)) {
if ($category) { $product_categories[] = $category; }
}
$smarty->assign("product_categories",$product_categories);
This selects all the categories that this product is in, unless they are parent categories, and assigns the array (where each row =array(category id, category name)) to Smarty as $product_categories.
In skin1/customer/main/product.tpl I added an include to call my new ugly "categories.tpl" which in its most basic (and quite ugly) form looks like this:
Code:
{section name=category loop=$product_categories}
[img]{$ImagesDir}/categories/{$product_categories[category].0}.gif[/img]
{/section}
James.
xx