Author Topic: Removing "add to cart" button from products in category page  (Read 2494 times)

johndenver

  • Beginner
  • *
  • Posts: 21
  • A beginner
Removing "add to cart" button from products in category page
« 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.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10878
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: Removing "add to cart" button from products in category page
« Reply #1 on: August 22, 2020, 10:47:43 AM »
vm->config->config->shopfront

uncheck  _>  Show product customfields in browse views
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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

  • Beginner
  • *
  • Posts: 21
  • A beginner
Re: Removing "add to cart" button from products in category page
« Reply #2 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)

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3944
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Removing "add to cart" button from products in category page
« Reply #3 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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

johndenver

  • Beginner
  • *
  • Posts: 21
  • A beginner
Re: Removing "add to cart" button from products in category page
« Reply #4 on: August 22, 2020, 12:05:40 PM »
components/com_virtuemart/views/category/tmpl/categories.php

Code: [Select]
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

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28695
  • Always on vacation
    • Jenkin Hill Internet
Re: Removing "add to cart" button from products in category page
« Reply #5 on: August 22, 2020, 13:05:53 PM »
Edit and override components/com_virtuemart/sublayouts/addtocartbar.php

Remove the whole addtocart-bar div.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VirtueMart 4.0.22 10858  J 3.10.11 PHP 8.0.27

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3944
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Removing "add to cart" button from products in category page
« Reply #6 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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28695
  • Always on vacation
    • Jenkin Hill Internet
Re: Removing "add to cart" button from products in category page
« Reply #7 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.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VirtueMart 4.0.22 10858  J 3.10.11 PHP 8.0.27

pinochico

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1707
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Removing "add to cart" button from products in category page
« Reply #8 on: August 22, 2020, 14:55:00 PM »
No,

you must comment this code:

Code: [Select]
<?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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3944
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Removing "add to cart" button from products in category page
« Reply #9 on: August 22, 2020, 20:14:51 PM »
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

  • Beginner
  • *
  • Posts: 21
  • A beginner
Re: Removing "add to cart" button from products in category page
« Reply #10 on: August 22, 2020, 20:40:29 PM »
Yes, it worked, thanks for the help Grandmaster Joomla Ninjas.  ;D

Jörgen

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3944
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: Removing "add to cart" button from products in category page
« Reply #11 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
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

johndenver

  • Beginner
  • *
  • Posts: 21
  • A beginner
Re: Removing "add to cart" button from products in category page
« Reply #12 on: August 27, 2020, 11:36:37 AM »
No,

you must comment this code:

Code: [Select]
<?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

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10878
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: Removing "add to cart" button from products in category page
« Reply #13 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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1707
    • MiniJoomla
  • Skype Name: support-easysoftware
  • VirtueMart Version: 3
Re: Removing "add to cart" button from products in category page
« Reply #14 on: August 27, 2020, 12:34:36 PM »
Quote
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.

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