News:

Looking for documentation? Take a look on our wiki

Main Menu

Hide button "add to cart" for guests

Started by AntonioS28, September 16, 2015, 16:50:00 PM

Previous topic - Next topic

AntonioS28

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

AntonioS28

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));
}

         } ?>

servlet

You will lose customers!!!
do it to add to cart and register on checkout - you will have customer and registered customer...
Он-лайн магазин за фототапети http://mishelfoster.com