VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: joozen on September 22, 2024, 17:53:33 PM

Title: Disable Show Children Category in manufacturer view
Post by: joozen on September 22, 2024, 17:53:33 PM
Actually question. I want to display Children categories in Shop front but I don't want them in View all manufacturer's products page. How can I disable it? Thank you. 
Title: Re: Disable Show Children Category in manufacturer view
Post by: joozen on September 26, 2024, 09:20:07 AM
Can enyone advise please at least where to look into it. Probably some code to comment? I tried manufacturers view but no luck.
Title: Re: Disable Show Children Category in manufacturer view
Post by: Ghost on September 26, 2024, 09:26:46 AM
Manufacturer's products page is category view. Files in com_virtuemart/views/category/tmpl/.
Title: Re: Disable Show Children Category in manufacturer view
Post by: joozen on September 26, 2024, 14:00:21 PM
Find solution using Chat GPT o1-preview

On your_template/html/com_virtuemart/category/default.php find the code

// Show child categories
if ($this->showcategory and empty($this->keyword)) {
if (!empty($this->category->haschildren)) {
echo ShopFunctionsF::renderVmSubLayout('categories',array('categories'=>$this->category->children, 'categories_per_row'=>$this->categories_per_row));
}
}

and replace it with

if ($this->showcategory and empty($this->keyword) and !empty($this->category->virtuemart_category_id)) {
    if (!empty($this->category->has_children)) {
        echo ShopFunctionsF::renderVmSubLayout('categories', array(
            'categories' => $this->category->children,
            'categories_per_row' => $this->categories_per_row
        ));
    }
}

It's removing chaild categories from shop front and manufacturer's view but still displaying it if you click on main category.