Hi there,
On my website until now i had a "wholesale" shopper group and i add the registered customers that i want to this group to see prices and place online orders. Now i want to add a new price group "Retail" that the price will be available for non registered visitors but if i do that in the page details there is an Add To Cart button. is there a way to hide this button for non registered users and keep the price?
Thanks
detect the shopper group in the template and either don't display or hide with css
find the shopper group with
$userModel = VmModel::getModel('user');
$vmuser = $userModel->getCurrentUser();
$vmgroup = $vmuser->shopper_groups;
//is an array
if(in_array(x, $vmgroup) {
}
Or simply use Joomla user, to check for guest. See all info for a Joomla user https://docs.joomla.org/Accessing_the_current_user_object
sample code :
$user = JFactory::getUser();
if (!$user->guest) {
//any code for logged user
}
You can do an override in your template from components/com_virtuemart/sublayouts/addtocart.php in templates/YOURTEMPLATE/html/com_virtuemart/sublayouts/addtocart.php
for eg. after defined('_JEXEC') or die('Restricted access');
if(JFactory::getUser()->guest) return;
thanks guys,
i would check your suggestions