Search
Other Advanced Module Manager questions
Forum

Virtuemart J4 Available?

Sarah Musselman's Avatar Sarah Musselman
Is the J4 version compatible with Virtuemart?

I used Advanced Module manager to create category headers.

After upgrade to J4, they're showing on every page.

There are no virtuemart options under conditions.

I wasn't sure if this was an issue with my setup or if Advanced Module Manager didn't have the virtuemart compatibility yet.

Thanks for your help on this!
Peter van Westen's Avatar Peter van Westen ADMIN
There are no conditions specifically for VirtueMart in the Joomla 4 version. And there are no plans to add that.
You can probably do what you want with either the URL or PHP condition rules.
Please post a rating at the Joomla! Extensions Directory
Sarah Musselman's Avatar Sarah Musselman
Bummer. Taking your suggestion, I wrote some PHP code that seems to work for my needs. I'm not a great programmer (self-taught), so if someone has a more elegant solution, I'm open to suggestions. However, I thought it might be of help to someone else in a similar predicament.
//The Category ID it should appear on
$category_id = 37;

//Get Category ID of the current page
$jinput = JFactory::getApplication()->input; 
$cat_id= $jinput->getInt('virtuemart_category_id', 0);

//Get Parent Category ID of the current page
if($cat_id){
$cattest = VmModel::getModel('category');
$cat=$cattest->getCategory($cat_id);
$parentid = $cat->category_parent_id;
}
else {$parentid=0;}

//Return true if the Category ID matches the Current Page's Category ID or that of its Parent Category
return($category_id == $cat_id or $category_id == $parentid);
Peter van Westen's Avatar Peter van Westen ADMIN
The PHP condition already prepares the $input variable. So you can directly use that:
// The Category ID it should appear on
$category_id = 37;

// Get Category ID of the current page
$current_category_id = $input->getInt('virtuemart_category_id', 0);

// Return false if no VM category ID is found
if ( ! $current_category_id)
{
    return false;
}

// Return true if the Category ID matches the Current Page's Category ID
if ($category_id == $current_category_id)
{
    return true;
}

// Get Parent Category ID of the current page
$vm_category        = VmModel::getModel('category')->getCategory($current_category_id);
$parent_category_id = $vm_category->category_parent_id;

// Return true if the Category ID matches the Current Page's Parent Category ID
return $category_id == $parent_category_id;
Please post a rating at the Joomla! Extensions Directory
Sarah Musselman's Avatar Sarah Musselman
Thank you! That's much better. 🙂 Performance matters.
Sarah Musselman's Avatar Sarah Musselman
FYI...
My test site didn't recognize the $input variable. I got a 0 error about a null variable. I just added and modified these lines:
$jinput = JFactory::getApplication()->input; 
$current_category_id = $jinput->getInt('virtuemart_category_id', 0);

Not great, but no errors for now.
Peter van Westen's Avatar Peter van Westen ADMIN
Ah, sorry, my bad. The $input is not there, indeed. $app is though.
So you should be able to do:
$current_category_id = $app->input->getInt('virtuemart_category_id', 0);
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
For reference, these are available:
$app / $mainframe
$doc / $document
$db / $database
$user
$Itemid
Please post a rating at the Joomla! Extensions Directory
Gianluca Pantaleo's Avatar Gianluca Pantaleo
Hello,
I would like to know why there are no conditions specifically for VirtueMart in the Joomla 4 version and there are no plans to add that, please?

I find this integration with virtuemart extremely necessary, as it was in Advanced Module Manager for Joomla3.

In the meantime, I'm asking you how can I display a module only in the virtuemart product view?
Thanks
Peter van Westen's Avatar Peter van Westen ADMIN
Virtuemart has given me a lot of headaches on the Joomla 3 version. It seems to change the way it does things pretty frequently. Also I had to make a lot of exceptions in my code specifically for VM because of the non-Joomla standard way it does things.
I am not a fan of VM and won't be adding specific support for it in any of my extensions.

You will have to do what you need via the PHP condition.
It is beyond my support to write your custom PHP conditions.
Best to ask the VM support if they can give you a PHP snippet that checks whatever you want to do.

Also see: docs4.regularlabs.com/advancedmodulemana...ustom-php-conditions
Please post a rating at the Joomla! Extensions Directory
Gianluca Pantaleo's Avatar Gianluca Pantaleo
Which is a valid alternative to Virtuemart that is integrated in your extensions, please? Thanks
Peter van Westen's Avatar Peter van Westen ADMIN
I don't use any shop extensions myself, so I am not the best to advise you on this.
But I think HikaShop would be a good bet.

Probably best to ask about this on the Joomla forum:
forum.joomla.org
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription