Hi,
I am using joomla 3.4.5 and virtuemart 3.0.12.
I have searched and feel like I've tried every conceivable help on this thread but I can't figure out how to rid my site of the add to cart button for registered guests and have it showing only for my shopper group 'Wholesale Clients'. I did have a database query working for a while but it since stopped with the latest update that I did..
I found the below in a thread and this seems to be exactly what I need! Could someone please tell me if this will happen in the near future??
Quote from: Milbo on December 28, 2011, 22:22:10 PM
This feature is at the moment missing, but it is relativly easy to add, we just need to extend the catalogue mode per shoppergroups.
Many thanks :)
this is always done afaik by detecting the shopper group and displaying or not the add to cart section in the template
something like
<?php
$userModel = VmModel::getModel('user');
$vmuser = $userModel->getCurrentUser();
$vmgroup = $vmuser->shopper_groups;
$seecarts = array(3,4,6,7); //allowed to see add to cart
function isAllowed($vmgroup, $alloweds) {
$isAllowed = false;
foreach ($alloweds as $allowed){
if(in_array($allowed, $vmgroup)) {
$isAllowed = true;
break;
}
}
return $isAllowed;
}
$allowcart = isAllowed($vmgroup, $seecarts); // $allowcart will be true if in array
if($allowcart) { ?>
<!-- cart stuuf-->
<?php } ?>
This is also what i need... I want to only show the add to cart button to logged in users. I have managed to turn off the pricing by following these threads but I'm confused as to how to turn off the add to cart button. I am using Joomla 3.4.5 with Virtuemart 3.0.12 and the template I am using is Protostar. Are you able to please help me know where and what code I need to change to only have the add to cart show up for my default shopper group (logged in) and not my annonymous shopper group (not logged in). Any help you can give would be greatly appreciated.
<?php if($allowcart) { ?>
<!-- add to cart stuff-->
<?php } ?>
put your add to cart code between the if
thankyou. on what file/folder do i do this on? exactly where in the code? sorry for the questions :)
on the product details page default.php
adjust for the category page
I still use this to hide elements from unregistered viewers.
$user =& JFactory::getUser();
if($user->id != 0) {
## code to hide from non-registered ##
}
For category page the sublayout/products.php should be edited and overidden.
Hi,
Why removing the add to cart and display the price?
The safe way is to set price by shopper groups, and set price for anonymous user to 0 then add to cart is removed and price hide.
Another way is to disallow checkout for guest, this need no core changes but display add to cart.