Article Index

Assign a specific view to one specific category

Ok, i like the standard category view template that i've just made and i'll use it for other categories i'll create in the future for my e-shop. But i'd like to have something different into my Power Tools category, so i'm going to make a news called powertools.php by copying the deafult.php one and renaming it. So in my \templates\ja_purity\html\com_virtuemart\category folder i have now this situation

templatepath2

Now I edit the powertools.php and use a different line, so i'm going to substitute this lines

?>
<h1> Yo brother, this is an html line!</h1>
<?php

with the following ones

?>
<h1> Yo brother, this is an html line for powertools only!</h1>
<?php


After that, i'm going to VirtueMart administration -> Categories -> List Categories and pick up the Power Tools one. Then i choose  the "powertools"  view i've just created as the Category Browse Page for this category, just a click away:

 

cateogryinside

You 'll notice that in the dropdown menu two "default" are listed: the first is the default.php file located into components\com_virtuemart\views\category\tmpl while the other is the one located at \templates\ja_purity\html\com_virtuemart\category.  This happens because the dropdown reads the filename of the view and i have named "default.php" the view located at templates\ja_purity\html\com_virtuemart\category . Please note also that this bug has already been removed at the time this article got written so the next beta release won't act in this way.

Save this modification and here it is how the category looks:

categorypage3

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.