Removing "add to cart" button from products in category page

Started by johndenver, August 22, 2020, 01:37:49 AM

Previous topic - Next topic

johndenver

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.

GJC Web Design

vm->config->config->shopfront

uncheck  _>  Show product customfields in browse views
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

johndenver

I have that unchecked but the "Add to Cart" button still shows. (attached)
Even if I change to a different template it shows.  (attached)

Jörgen

Then you have to edit the categories.php file in your template. remove the call to addtocart

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

johndenver

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.

jenkinhill

Edit and override components/com_virtuemart/sublayouts/addtocartbar.php

Remove the whole addtocart-bar div.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Jörgen

Jenkins, I think this will remove it from product page to, or am i mistaken?

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

jenkinhill

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.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

pinochico

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.

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Jörgen

Rudolf you are right, products.php is the correct place to change.

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

johndenver

Yes, it worked, thanks for the help Grandmaster Joomla Ninjas.  ;D

Jörgen

Glad it worked out for you, sorry that I mislead you. Kudos to Rudolf.

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

johndenver

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.

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

pinochico

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
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products