Remove add-to-cart from category page when custom fields present

Started by capewellmj, July 10, 2015, 18:41:52 PM

Previous topic - Next topic

servlet

I have the same problem...
It will be nice if there is ON/OFF function in config section. In this way all will be happy - someone want to use this option someone no. For some shops it is no good to bypass product view.
CSS hide - it is no good - you have queries I think?!? you will hide them but they will be loaded.
It will be nice if this is a category option - you may decide to use this option for chosen categories.... (may be it will be nice there is both option global ON/OFF and category ON/OFF, this will spend time if you dont want to use this option globally or if you want to use it for specific categories)
Give to user choice... give them way to use brain. ;)

I ask for this option in VM 1.0.... long time ago...
Он-лайн магазин за фототапети http://mishelfoster.com

Milbo

not hiding via css, it is an override of the products.php in the sublayout, and you just need to omit one line, the display of customfields. But they are processed then.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

servlet

I am using override ... I think for other users ... I think for the future... this is needed option...

(this is not template customizing for pink or black add to cart button ;) )
Он-лайн магазин за фототапети http://mishelfoster.com

lindapowers

Another mystery is the layout depending on the position chosen for the custom fields: ontop, normal, addtocart, onbot etc
Some of this render in category view others don't. Some documentation in this aspect would be appreciated.

We already use an override to hide the "chose a variant button" so meanwhile youll have to do the same for this case I guess.

Quote from: Margriet on October 07, 2015, 11:07:54 AM
Maybe this illustrates the problem. Customer can order T-shirt without selecting size.


Exactly thats a case where you require the option, for us would be: customer can order product without selecting "optional" size (fruits) which is good... but yeah could happen the case where we require them to actually select a custom field. I understand the request here but pls understand the way is managed currently is good for some shops like ours so yeah.. option needed.

I don't know how it works with string custom fields but with generic child variants we put 0 stock and no price to the parent and therefore only the childs (dropwdown) are selectable.

Regards

Milbo

Quote from: lindapowers on November 09, 2015, 15:45:36 PM
Another mystery is the layout depending on the position chosen for the custom fields: ontop, normal, addtocart, onbot etc

ontop,addtocart which are "input"
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

websmith

Has there been a fix for this as im having the same issue. Add to Cart displays in category view and when clicked it goes straight to cart bypassing all custom field options.
This is a big problem for my project. Can anyone offer a solution for this? Thank you in advance.

lindapowers

Quote from: websmith on January 08, 2016, 04:46:57 AM
Has there been a fix for this as im having the same issue. Add to Cart displays in category view and when clicked it goes straight to cart bypassing all custom field options.
This is a big problem for my project. Can anyone offer a solution for this? Thank you in advance.

I don't know how you have set custom fields but this statement is not correct.

If you set custom fields of type string in a dropdown list the first option you set will be added to the product so I don't see where the custom fields are being bypassed.

Margriet

@lindapowers: see my screenshots in post #6. This has not changed since!

lindapowers

Quote from: Margriet on January 08, 2016, 10:11:22 AM
@lindapowers: see my screenshots in post #6. This has not changed since!

If you are using generic childs why don't you set the parent with 0 price, that way they are forced to choose one of the variants.

Thats why I didn't notice the issue, cause we use parents with no price and not chooseable.

websmith

Quote from: lindapowers on January 08, 2016, 09:34:42 AM
Quote from: websmith on January 08, 2016, 04:46:57 AM
Has there been a fix for this as im having the same issue. Add to Cart displays in category view and when clicked it goes straight to cart bypassing all custom field options.
This is a big problem for my project. Can anyone offer a solution for this? Thank you in advance.

I don't know how you have set custom fields but this statement is not correct.

If you set custom fields of type string in a dropdown list the first option you set will be added to the product so I don't see where the custom fields are being bypassed.

Ok, for arguments sake, if you have sizes S, M and L, and colors R, W and B, if it simply picks the first line string it will still be wrong 2/3 of the time.  There should be a much easier way to remove the add to cart button from category layout so the customer is forced to choose all the variants or options available from the product details page.


jjk

A simple method to remove the 'Add to Cart' button from the category views is to edit the file yourdomain\components\com_virtuemart\sublayouts\products.php. Comment out the display of the 'Add to Cart' button by adding '//' at the positions shown below (lines 108 and 109 in VM 3.0.12) to look like this:
<div class="vm3pr-<?php// echo $rowsHeight[$row]['customfields'] ?>"> <?php
//echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row])); ?>

Then save the file with a different filename into the same folder, for example 'products_less-cat-cart-btn.php'. Note that the filename has to begin with 'products_' in order to be recognized as a new sublayout. Leave the original file intact! Afterwards you can select that file from the dropdown list in VM 'Configuration' > 'Templates' tab > 'Sublayouts for products in category'.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Arno Millenaar

Quote from: Studio 42 on November 06, 2015, 17:51:52 PM
HI,
Quote from: IJack on November 06, 2015, 16:33:14 PM
If there is an option to show/hide customfields in category view why not to add one more option to show/hide add to cart button in category view?
Some commercial template have this option.
Another  simple way is to manually remove the code calling the addtocart render

Thanks for the provided solution.  Struggled several hours to find a solution.  Your suggestions works perfect !

Tentaurus

Quote from: IJack on November 06, 2015, 16:33:14 PM
If there is an option to show/hide customfields in category view why not to add one more option to show/hide add to cart button in category view?

My opinion, too! To disable the add to cart should be an option in VM.

Studio 42

It"s not only a render problem, but when you have many cart customfields, this can be very slower as VM2, that don't included this option ! This can be some secondes, only for 20 products