Virtuemart Product Categories Module Hack (extra span PLEASE!)

StumbleuponDelicious

introduction

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&amp;category_id=".$category_tmp[$row_list[$n]]["category_child_id"]) .'" '.$append.'>'
	. str_repeat("&nbsp;&nbsp;&nbsp;",$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&amp;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&amp;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;
}
Before
before

After
after

Be a link sponsor for this page now



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!

Be Sure to Subscribe to our feed or follow us on twitter to get the latest updates/patches
End of Article, Thanks for reading.
You can leave a response, or trackback from your own site.
StumbleuponDelicious

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

2 Responses to “Virtuemart Product Categories Module Hack (extra span PLEASE!)”

  1. Fadi Yousef says:

    thank you , it's really usefull

  2. arty says:

    Thank you very much!
    Helped a lot!!!

Leave a Reply