VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: johndenver on August 22, 2020, 01:37:49 AM

Title: Removing "add to cart" button from products in category page
Post by: johndenver on August 22, 2020, 01:37:49 AM
Joomla 3.9.15
PHP 7.2.33
Virtuemart 3.6.10

On the products in a category the "Add to Cart" button is showing how do I remove this from being visible in the products in the categories, I just want it to display on the product page.
Title: Re: Removing "add to cart" button from products in category page
Post by: GJC Web Design on August 22, 2020, 10:47:43 AM
vm->config->config->shopfront

uncheck  _>  Show product customfields in browse views
Title: Re: Removing "add to cart" button from products in category page
Post by: johndenver on August 22, 2020, 11:06:49 AM
I have that unchecked but the "Add to Cart" button still shows. (attached)
Even if I change to a different template it shows.  (attached)
Title: Re: Removing "add to cart" button from products in category page
Post by: Jörgen on August 22, 2020, 11:30:53 AM
Then you have to edit the categories.php file in your template. remove the call to addtocart

Jörgen
Title: Re: Removing "add to cart" button from products in category page
Post by: johndenver on August 22, 2020, 12:05:40 PM
components/com_virtuemart/views/category/tmpl/categories.php

defined('_JEXEC') or die('Restricted access');

if (!empty($this->category->haschildren)) {
echo ShopFunctionsF::renderVmSubLayout('categories',array('categories'=>$this->category->children, 'categories_per_row'=>$this->categories_per_row));
} ?>


....only that is inside the categories.php
Maybe this is found somewhere else? I think it might load from components/com_virtuemart/views/category/view.html.php but I am not seeing where in there though. I don't see anything related to a "cart" I could edit out that would remove the button.
Title: Re: Removing "add to cart" button from products in category page
Post by: jenkinhill on August 22, 2020, 13:05:53 PM
Edit and override components/com_virtuemart/sublayouts/addtocartbar.php

Remove the whole addtocart-bar div.
Title: Re: Removing "add to cart" button from products in category page
Post by: Jörgen on August 22, 2020, 13:40:25 PM
Jenkins, I think this will remove it from product page to, or am i mistaken?

Jörgen @ Kreativ Fotografi
Title: Re: Removing "add to cart" button from products in category page
Post by: jenkinhill on August 22, 2020, 14:37:21 PM
AARGH yes Jörgen you are right. On the site I'm thinking of I used multiple sublayout overrides. I do remember getting in a mess with them initially.
Title: Re: Removing "add to cart" button from products in category page
Post by: pinochico on August 22, 2020, 14:55:00 PM
No,

you must comment this code:


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

</div>


inside:

components/com_virtuemart/sublayouts/products.php

or as override

templates/TEMPLATE/html/com_virtuemart/sublayouts/products.php

(Don't forget on sublayouts - products_horizon.php and products_slim.php if you need).

P.S.
But we use in our eshop another code, because this sublayout we loaded inside own modules or popup Add to cart or megamenu.

Title: Re: Removing "add to cart" button from products in category page
Post by: Jörgen on August 22, 2020, 20:14:51 PM
Rudolf you are right, products.php is the correct place to change.

Jörgen
Title: Re: Removing "add to cart" button from products in category page
Post by: johndenver on August 22, 2020, 20:40:29 PM
Yes, it worked, thanks for the help Grandmaster Joomla Ninjas.  ;D
Title: Re: Removing "add to cart" button from products in category page
Post by: Jörgen on August 23, 2020, 09:27:59 AM
Glad it worked out for you, sorry that I mislead you. Kudos to Rudolf.

Jörgen @ Kreativ Fotografi
Title: Re: Removing "add to cart" button from products in category page
Post by: johndenver on August 27, 2020, 11:36:37 AM
Quote from: pinochico on August 22, 2020, 14:55:00 PM
No,

you must comment this code:


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

</div>


inside:

components/com_virtuemart/sublayouts/products.php

or as override

templates/TEMPLATE/html/com_virtuemart/sublayouts/products.php

(Don't forget on sublayouts - products_horizon.php and products_slim.php if you need).

P.S.
But we use in our eshop another code, because this sublayout we loaded inside own modules or popup Add to cart or megamenu.

Another question for you, on that same page is the category header, is the line of code to remove this in products.php as well?  (attached what I am referring to) I am looking at all of the PHP above the add to cart button that I removed on that page but I don't see a reference to this header so I can remove it.
Title: Re: Removing "add to cart" button from products in category page
Post by: GJC Web Design on August 27, 2020, 12:07:49 PM
all these things are template dependent but probably in the over ride for components\com_virtuemart\views\category\tmpl\default.php

templates\xxxxxx\html\com_virtuemart\category\default.php
Title: Re: Removing "add to cart" button from products in category page
Post by: pinochico on August 27, 2020, 12:34:36 PM
QuoteAnother question for you, on that same page is the category header, is the line of code to remove this in products.php as well?  (attached what I am referring to) I am looking at all of the PHP above the add to cart button that I removed on that page but I don't see a reference to this header so I can remove it.

Is not sample answer without URL eshop and analyze and definitely the first option is not tmpl default.php for the category.

Maybe is Title for Category or maybe a title for hidden menu or maybe another option