News:

Support the VirtueMart project and become a member

Main Menu

Turn off or Disable Add to Cart Button BY SHOPPER GROUP

Started by saviB, June 07, 2012, 22:20:30 PM

Previous topic - Next topic

saviB

Anyone - is there a way to do this? All I want to do is disable or turn off the add to cart button for shopper group anonymous.

I found one thread https://forum.virtuemart.net/index.php?topic=95568.15 but this doesn't seem to work for me. On reason may be that in Configuration, I can't set Default Product Details Page to default or anything else - it just reverts to No Override.

PLEASE, help.

saviB

ANYONE? Look, if its something stupidly simple - just tell me. If its a VM oversight - we need to know that too. This used to be easy in VM1.

John2400

saviB,

really what you want to do I guess is to say that only registered users can purchase.

So the public can look at your products but they must register to buy?

Firstly you do not have to add a group to any product - just leave that section blank  on all products. The customers can look at your shop see everything but cannot buy unless they register - as you will write on the front page of your shop.

That setting is in configuration >>checkout.

If you then want a specific group to have different prices then you can determine a different price for different groups as they register.

If If - you are looking for a site with a catalogue and a buy site ? them maybe not yet -  I am playing with version 2.0.7 E and there have been a few changes to showing different costs to different groups set up in this version.

saviB

Hi John, I GREATLY appreciate your reply. I have used VM for three years now and I'm amazed at its growth. The new version is great - but has lost some of the things that made the old one great too. Regardless, a very big THANK YOU to all of you who make VM happen for us. It feeds my family.

In the old VM (unless I am mistaken), when prices were disabled for non registered folks, the add to cart functions (quantity and add button) went away with the prices - no price, no add to cart. Thats exactly what I would like to have in the new VM. The site operates as a catalog only for non members - to entice them to become members. And a full blown store for members.

Since it seems that I didn't miss anything in the set up to make this happen, is there a way to simply hide the cart parts until the user logs in? I'm no programmer, but it seems that it would be an easy enough hack.

Also - since I have you on the string, would you please tell me which files make up the Sort By block in browse view? I see where the JS calls the files in the views/category/tmpl/default - but I can't figure out the include path. I want to get Sort By and Results in the same "row" instead of stacking them.


John2400



Hi saviB,

this discussion is in this post : Milbo is the designer of VM http://forum.virtuemart.net/index.php?topic=91361.0

The suggestion he makes to set different prices for  different groups would mean -?? That your default group would not show a price on the front page and all others. So when you logged in for members then they would see a new set of prices.  I think this is a lot of setting up - if you have already started a store.

I think you need to push this option for a simple - set up through this area or add your request to the featured section.

* the second question ? sort by - That depends on how you have set up Configuration>>templates>> and hacking is not my speciality.

saviB

Setting prices and turning them completely off for user groups is not a big deal - and a great improvement in VM2 over VM1. But - as far as I and the other forum user are concerned, we can't find where to turn off the add to cart functions when no prices are shown. Milbo - did I miss something?

For sort by - no, it doesn't. Using VM default for product details view the file adds the sort by block using JS. All I need to know is where the sort by block files are. In the old VM, all files like this were in an Includes folder.

saviB

Anyone? Need to disable add to cart until users login. Am I the only one who needs this? Any wholesalers out there?

Don Gould NZ

I have this same requirement.

My customer is running a wholesale site. 

I've managed to get rid of the prices from being displayed but still have the quantity and add to cart buttons which I want gone.

servlet

Он-лайн магазин за фототапети http://mishelfoster.com

Kans

I run a wholesale site and finally I found this solution:

/templates/xxx/html/com_virtuemart/productdetails/default.php around line 200

Replace the add to cart piece with this code

      <?php
// check if user is logged in/registered.
// $user =& JFactory::getUser(); if( $user->id ){  
$user JFactory::getUser();  
$status $user->guest
if(
$status == 1){
echo 
"Login for price";
}
else
{
// Add To Cart Button
if (!VmConfig::get('use_as_catalog'0) and !empty($this->product->prices)) {
    echo 
$this->loadTemplate('addtocart');
}  
// Add To Cart Button END
}
?>



That will disable the add to cart button if not logged in, and instead they see "login for price".



Now, can anyone help me further. I have managed to add the add to cart button on the category page, but how can I make it go away when not logged in???


I used this code to add the cart button (/templates/xxx/html/com_virtuemart/category/default.php )
<?php
// Display the quantity box ?>

<!-- <label for="quantity<?php echo $this->product->virtuemart_product_id;?>" class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
<span class="quantity-box">
<input  type="text" class="quantity-input" name="quantity[]" value="1" />
</span>
<span class="quantity-controls">
<input type="button" class="quantity-controls quantity-plus" />
<input type="button" class="quantity-controls quantity-minus" />
</span>
<?php // Display the quantity box END ?>

<?php // Add the button
$button_lbl JText::_('COM_VIRTUEMART_CART_ADD_TO');
$button_cls ''//$button_cls = 'addtocart_button';
if (VmConfig::get('check_stock') == '1' && !$this->product->product_in_stock) {
$button_lbl JText::_('COM_VIRTUEMART_CART_NOTIFY');
$button_cls 'notify-button';
?>


<?php // Display the add to cart button ?>
<span class="addtocart-button">
<input type="submit" name="addtocart"  class="addtocart-button" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
</span>

<div class="clear"></div>
</div>

<?php // Display the add to cart button END ?>
<input type="hidden" class="pname" value="<?php echo $product->product_name ?>">
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
<?php /** @todo Handle the manufacturer view */ ?>
<input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
<br>
</form>

servlet

Goood, but I think it will be better if not logged in user are redirected to login/register form after they press add to cart button or popup modal box with button for registration and text "Register to buy this product".
If there is no price this is not user friendly. If customers dont see the price they will find other e-shop and will buy from there. They dont want to lose time for registration only to see the price. They will register and buy product if the price is lowest.

Hidden price is only if your site is for dealers/resellers.

Sorry for may bad English
Он-лайн магазин за фототапети http://mishelfoster.com

cesarezzi

Hi there,

does anyone knows how to create a link in the "Login for price"?

I'm not very good in programming, so it would be great if someone could help creating a link there to the registry page!


a special thanks to Kans for his post,

cheers,


mat.sen

Hi, Sorry for my english,

I need help to customize layout to disable add to cart and check out function only for a specific shop per group..

In details
I have 3 group of shoppers

Anonymous (only able to view the catalague)
Register ( only able to view catalague and prices , but they can't buy)
Agent (they must able to view catalague, prices and create orders )

How can i configure it?

Thanks for your help

Maxim Pishnyak

You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart