News:

Support the VirtueMart project and become a member

Main Menu

Disable Show Children Category in manufacturer view

Started by joozen, September 22, 2024, 17:53:33 PM

Previous topic - Next topic

joozen

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. 
Joomla! 4.3.4
4.2.12 11012
PHP: 8.1.26

joozen

Can enyone advise please at least where to look into it. Probably some code to comment? I tried manufacturers view but no luck.
Joomla! 4.3.4
4.2.12 11012
PHP: 8.1.26

Ghost

Manufacturer's products page is category view. Files in com_virtuemart/views/category/tmpl/.

joozen

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.
Joomla! 4.3.4
4.2.12 11012
PHP: 8.1.26