VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: hotrod on January 26, 2020, 03:35:13 AM

Title: Remove Add To Cart In Catagory View
Post by: hotrod on January 26, 2020, 03:35:13 AM
VirtueMart 3.6.10 Default Theme.
Joomla! 3.9.14

I know this was in the earlier versions, but I can't seem to find it,  also can't find it searching the forums..
I want customers to be forced to hit product details then have the ability to add to cart..
Title: Re: Remove Add To Cart In Catagory View
Post by: GJC Web Design on January 26, 2020, 11:20:57 AM
uncheck -> vm admin -> shopfront- > Show product customfields in browse views
Title: Re: Remove Add To Cart In Catagory View
Post by: hotrod on January 26, 2020, 11:49:46 AM
 Hum.. that didn't do it...
Title: Re: Remove Add To Cart In Catagory View
Post by: phil147 on January 26, 2020, 12:16:09 PM
There is a way to do this in your over rides if you are able to edit the php file, it be in a path such as html/com_virtuemart/sublayouts/products.php

There is a part in products.php that shows the add to cart button for category view something like following...

<div class="vm-addtocart-button vm3pr-<?php echo $rowsHeight[$row]['customfields'] ?>">
                     <?php echo shopFunctionsF::renderVmSubLayout('addtocartcats',array('product'=>$product,'rowHeights'=>$rowsHeight[$row])); ?>
                  </div>



Title: Re: Remove Add To Cart In Catagory View
Post by: jenkinhill on January 26, 2020, 12:57:50 PM
@hotrod, GJC's solution seems not to work in current versions - and does require that you use custom fields for each product. The simplest way to remove addtocart from browse views is to edit and override components/com_virtuemart/sublayouts/products.php (assuming you don't already use overrides), as intimated by Phil.
Simply remove the following div:

<div class="vm3pr-<?php echo $rowsHeight[$row]['customfields'?>"> <?php
echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop''addtocart'))); ?>

</div>


Save the edited file as  templates/[your Joomla template]/html/com_virtuemart/sublayouts/products.php  so it does not get overwritten by subsequent VM updates
Title: Re: Remove Add To Cart In Catagory View
Post by: hotrod on January 26, 2020, 13:37:19 PM
Thank You, That worked.
Just a little confused on where to put that file. I'm not showing those folders in my template file.
Title: Re: Remove Add To Cart In Catagory View
Post by: jenkinhill on January 26, 2020, 13:41:45 PM
Quote from: hotrod on January 26, 2020, 13:37:19 PM
I'm not showing those folders in my template file.

Then add them! Use FTP or cPanel to do that.
Title: Re: Remove Add To Cart In Catagory View
Post by: hotrod on January 26, 2020, 13:57:15 PM
That's what I was thinking, Its ok to leave the file in the folder it was? or just move it over to the new folder ..
Title: Re: Remove Add To Cart In Catagory View
Post by: hotrod on January 26, 2020, 14:03:09 PM
I answered my own question.  I renamed the old one and I'm assuming it's now pulling from the other location as a template override..

Thank You!!
Title: Re: Remove Add To Cart In Catagory View
Post by: Jörgen on January 26, 2020, 14:06:13 PM
You should NOT rename the old file, in some cases the extension checks if the original file exists and stops there if not found :)
Not sure about what VM does in this case. The normal order is check template, if there is an override use it, but as I said I have seen bad behaviour before. Simply leave the original in place and make a copy to override. This is normal Joomla behaviour.

Jörgen @ Kreativ Fotografi
Title: Re: Remove Add To Cart In Catagory View
Post by: hotrod on January 26, 2020, 14:07:54 PM
Ok  thanks Jörgen