VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: AntonioS28 on September 16, 2015, 16:50:00 PM

Title: Hide button "add to cart" for guests
Post by: AntonioS28 on September 16, 2015, 16:50:00 PM
Hi,
sorry for my english! I've to hide the button "add to cart" from the category page and the detail product page for who is not registered!
So: who is registered can add to cart the product, while the guest can only see the product...
I'm using Vm 3.0.9
Thanks
Title: Re: Hide button "add to cart" for guests
Post by: AntonioS28 on September 16, 2015, 17:25:28 PM
HI to all, i solved my problem :)
you can go to  components/com_virtuemart/sublayouts/addtocart.php and in line 49
add


if (!VmConfig::get('use_as_catalog', 0)  ) {
   //here you control the user access, if the user is a guest tell him to log in         
$user = JFactory::getUser(); 
$status = $user->guest;
if($status == 1){
echo "Login to see the price";
}
else //else show him the button to add to cart
{
// Add To Cart Button
            echo shopFunctionsF::renderVmSubLayout('addtocartbar',array('product'=>$product));
}

         } ?>
Title: Re: Hide button "add to cart" for guests
Post by: servlet on November 06, 2015, 19:58:31 PM
You will lose customers!!!
do it to add to cart and register on checkout - you will have customer and registered customer...