VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: inco on February 18, 2019, 18:12:08 PM

Title: Joomla article visible only to specific shopper group
Post by: inco on February 18, 2019, 18:12:08 PM
Hello everybody,
I'm using VM 2.6.17 on Joomla 2.5.27. I'd like to show an article (I mean a Joomla article, a page) only to customers belonging to a specific shopper group. This article could be linked on a menu item or inside a module only visible to that specific shopper group. Anyway, I don't know how to hide/show it based on a shopper group, that is a VM object, not a Joomla one.

Can you help me? Thank you


Title: Re: Joomla article visible only to specific shopper group
Post by: GJC Web Design on February 18, 2019, 23:53:24 PM
build your own module ( copy/rename the custom module ) and in the template surround the display by

import VM

if (!class_exists( 'VmConfig' )) require(JPATH_ROOT .'/administrator/components/com_virtuemart/helpers/config.php');
VmConfig::loadConfig();

//detect shopper group

$userModel = VmModel::getModel('user');
$vmuser = $userModel->getCurrentUser();
$vmgroup = $vmuser->shopper_groups;
//is an array - then use in_array() to show or not show

this is VM3 code .. lost interest in VM2.6 as you should...  ;)
Title: Re: Joomla article visible only to specific shopper group
Post by: jenkinhill on February 19, 2019, 00:00:05 AM
See http://forum.virtuemart.net/index.php?topic=118683.0
Title: Re: Joomla article visible only to specific shopper group
Post by: inco on February 19, 2019, 12:13:28 PM
@GJC: your code fits also for VM 2.6, thank you!

I'd like to switch everything to latest version, but I have to convince my customer.



Title: Re: Joomla article visible only to specific shopper group
Post by: GJC Web Design on February 19, 2019, 13:39:39 PM
QuoteI'd like to switch everything to latest version, but I have to convince my customer.

when he gets hacked the first person he will blame will be u..   :(