News:

Looking for documentation? Take a look on our wiki

Main Menu

Joomla article visible only to specific shopper group

Started by inco, February 18, 2019, 18:12:08 PM

Previous topic - Next topic

inco

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



GJC Web Design

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...  ;)
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

inco

@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.




GJC Web Design

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..   :(
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation