News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

All categories at the top when category id=0

Started by balai, June 23, 2012, 11:12:32 AM

Previous topic - Next topic

balai

Hi

I m loading the category layout in my Custom Filters extennsion for displaying the filtering results.

The problem is that when there is no category id in the URL's query it displays all the categories at the top.
For example if you try option=com_virtuemart&view=category&virtuemart_category_id=0 , all the categories are displayed.

Can we fix/improve that, to display the children categories only when there is a parent selected?

Milbo

The parent of all categories is the 0,

But when you mean the products, then you must use the categories view, which is only displaying categories, but no products.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

balai

It wouldn't be more correct to display categories there only when there is a category selected with an id higher to zero?

Otherwise what's the point of having all the categories displayed there?

Milbo

To have all categories displayed there?

What should else happen when you enter category_id=0 ?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

balai

Category id = 0 means that no category is selected. So children categories cannot be displayed when there is nothing selected.

Replacing the code in the line 60 of the  components\com_virtuemart\views\category\tmpl\default.php, with the following, it does the trick:
if ( VmConfig::get('showCategory',1) and empty($this->keyword) and  $this->category->virtuemart_category_id>0)

Milbo

no, this is just wrong

category_id 0 means, get all categories beyond 0. No category selected would be !isset or ===null. Not 0. I hope you know that in php null != 0 != "0" != ""
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/