This article is regarding how the virtuemart
displayscategories, if acategory is quite long.
I used version 1.0.6 of virtuemart. You need to change file
ps_product_category.php. It's placed in:
administrator\components\com_virtuemart\classes
Find the function get_category_tree:
- these word spaces are used to pick out categories.
So, if the name of a category is long it's displayed as a line
folding with spaces in the begging of the category. Like this:
Let's make categories tree more readable:
$catname = shopMakeHtmlSafe($category_tmp[$row_list[$n]]["category_name"]);
$margin_left=$depth_list[$n]*10;
/*this will be the indents for a category. We use the
variable $margin_left to put value of the indent of sub-category into
the html code. Each sub-category will be displaced by the 10px amount
relative to it’s parent category.*/$html .= '
<a title="'.$catname.'" style="display:block;margin-left:'.$margin_left.
'px;'.$style.'" class="'. $css_class .'"
href="'.$sess->url(URL."index.php?page=shop.browse&category_id=".
$category_tmp[$row_list[$n]]["category_child_id"]) .'" '.$append.'>'//.str_repeat(" ",$depth_list[$n]).$catname
.$catname.ps_product_category::products_in_category($category_tmp[$row_list[$n]]["category_child_id"])
.'</a>';
Here will be the indents for a category. We use variable
$margin_left to put value of the indent of sub-category into the
html out-put.
Each sub-category will be displaced by the 10px amount
relative
to it's parent category. As you can see, we commented out string
with spaces: " ",
it's no
more needed.
This is how category looks after changing:
download
file ps_product.php in zip. (Don't forget to make back-up)