$output .= "<li class='MainCategory'><strong class='category'><a class='productlink' href='".wpsc_category_url($option['id'])."'>".stripslashes($option['name']).$addCount."</a></strong>";
}else{
// Adrian - otherwise create normal category text with or without product count
if (!$image) {
$output .= "<li class='MainCategory'><strong class='category'><a class='productlink' href='".wpsc_category_url($option['id'])."'>".stripslashes($option['name']).$addCount."</a></strong>";
} else {
$output .= "<li class='MainCategory'><img src='".get_option('siteurl')."/wp-content/uploads/wpsc/category_images/".$option['image']."'><br><strong class='category'><a class='productlink' href='".wpsc_category_url($option['id'])."'>".stripslashes($option['name']).$addCount."</a></strong>";
}
}//end get_option
$subcategory_sql = "SELECT * FROM `".$wpdb->prefix."product_categories` WHERE `group_id` IN ('$category_group') AND `active`='1' AND `category_parent` = '".$option['id']."' ORDER BY `id`";
$subcategories = $wpdb->get_results($subcategory_sql,ARRAY_A);
if($subcategories != null)
{
$output .= display_subcategories($option['id']);
} else {
// Adrian - check if the user wants categories only or sliding categories
if (get_option('permalink_structure')!=''){
$uri = $_SERVER['REQUEST_URI'];
$category = explode('/',$uri);
$count = count($category);
$category_nice_name = $category[$count-2];
$category_nice_name2 = $wpdb->get_var("SELECT `nice-name` FROM {$wpdb->prefix}product_categories WHERE id='{$option['id']}'");
if ($category_nice_name == $category_nice_name2) {
$list_product=true;
} else {
$list_product=false;
}
}
if ((get_option('catsprods_display_type') == 1) && (($option['id'] == $_GET['category']) || $list_product) ){
// Adrian - display all products for that category
$product_sql = "SELECT product_id FROM `".$wpdb->prefix."item_category_associations` WHERE `category_id` = '".$option['id']."'";
$productIDs = $wpdb->get_results($product_sql,ARRAY_A);
if($productIDs != null){
$output .= "<ul>";
foreach($productIDs as $productID){
$ID = $productID['product_id'];
$productName_sql = "SELECT * FROM `".$wpdb->prefix."product_list` WHERE `id` = '".$ID."'";
$productName = $wpdb->get_results($productName_sql,ARRAY_A);
if ($productName[0]['active'])
$output .= "<li><a class='productlink' href='".wpsc_product_url($ID,$option['id'])."'>".$productName[0]['name']."</a></li>";
}//end foreach
$output .= "</ul>";
}//end if productsIDs
}//end if get_option
}//end else
$output .= "</li>";
}
$output .= "</ul>";
}
$output .= "</div>";çok döngü var sanırım.
Buda wordpress teması:
<div class="BlockContent">
<div class="BlockContent-body">
<ul>
<?php wp_list_categories('show_count=1&title_li='); ?>
</ul>
</div>
</div>