
A lot of people may know the famous virtuemart. Even it is a good cart system for Joomla, but the lack of css and the menu is just very poor indeed. Not enough of div and span, so in this article I am going to add a span in the product categories menu, upon the link list style. The reason we put this is because virtuemart had put in 3 space & nbsp; in the child cateogry. If you want to control the style by css, first you will need to delete the & nbsp; and replace it with the span tag
php code to change
Go to the following folder and open the file.
administrator/components/com_virtuemart/classes/ and open the file name called ps_product_category.php. Do a search and find the following code
<a title="'.$catname.'" style="display:block;'.$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
. ps_product_category::products_in_category( $category_tmp[$row_list[$n]]["category_child_id"] )
.'</a>';
replace it with
<a title="'.$catname.'" style="display:block;'.$style.'" class="'. $css_class .'" href="'. $sess->url(URL."index.php?page=shop.browse&category_id=".$category_tmp[$row_list[$n]]["category_child_id"]) .'" '.$append.'><span>'
. str_repeat("<div class=\"space\">",$depth_list[$n]) . $catname
. ps_product_category::products_in_category( $category_tmp[$row_list[$n]]["category_child_id"] )
. str_repeat("</div>",$depth_list[$n]) .'</span></a>';
So in this we have added a span and a div, the span is the create the style for your wording. The div are there to give spacing to your sub cat and sub sub cat, and so on.
There just so many ways to complete this, you can also hard code the padding-left into your code like below.
<a title="'.$catname.'" style="display:block;'.$style.'" class="'. $css_class .'" href="'. $sess->url(URL."index.php?page=shop.browse&category_id=".$category_tmp[$row_list[$n]]["category_child_id"]) .'" '.$append.'><span style="padding-left: '.(10 * $depth_list[$n]).'px">'
. $catname
. ps_product_category::products_in_category( $category_tmp[$row_list[$n]]["category_child_id"] )
.'</span></a>';
Adding css
Adding the necessary css code to make the proper spacing and block needed for the padding.
a.sublevel span{
display:block;
border-bottom:#CCC dotted 1px;
}
a.sublevel .space{
padding-left:10px;
}
After

Be a link sponsor for this page now
[sponsorbox]
I hope you have enjoyed this post, be sure to subscribe to my rss feed by click the subscribe button at the top.
Good Luck!

thank you , it's really usefull
Thank you very much!
Helped a lot!!!
Thank you so much! You are appreciated more than you know!