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

capewellmj

Hello

I have mentioned this before as a suggestion but i'd like to report it now as a bug. When a product has custom fields that the customer must choose on the product page. It is causing us problems with VM3 because it continues to show the add-to-cart on the category pages and allows the customer to bypass choosing any options.

I feel this is a bug if they can purchase products without choosing parameters.

A simple fix would be to disable the add-to-cart button on category pages when custom fields are present. This is how VM2 handled custom fields.

Great work btw, a lot more versatility for programmers (so they tell me) and for users with custom fields on VM3.

Thank you.

Martin

jenkinhill

VM3 does show customs on the category view page as well as the product details page when using the default template system. eg see http://demo.virtuemart.net/wear

If you do not use the default VM templates then it is possible that your overrides need updating to show the customs.
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

capewellmj

Hi Jenkinhill

I do not want the custom fields to show on the category pages. I deliberately disabled" Show product customfields in browse views".

I guess a better way of making my request is to say that when "Show product customfields in browse views" is disabled, the add-to-cart should also be disabled from the category pages.

Thank you,

Martin


AH

IMHO -  A "disable add to cart and cart customfields" in category browse  - would be beneficial - as there is no point in displaying add to cart customfields if you do not also display the add to cart button.

Maybe someone can enlighten you as to whether the "display customfields in caetgory browse" only affects cart customfields
Regards
A

Joomla 4.4.5
php 8.1

Studio 42

Hi,
I have the same problem, with the default "add to cart" in category view.

It's a pain to fith in the cart customfields and have a nice render.
I forced in the plugin to not render the customfields, because this can have 10 line.
But the other problem is when you display product modules in your product details page.
The plugin trigger is the same then you cannot disable the customfield in the modules, or you have to do a hock with javascript to hide this fields and cha,ge the add to cart to choose a variant

The only solution i know is to add multiple function, or adding a boolean to know the render zone.

for eg. trigger in plugin

plgVmOnDisplayProductFEVM3
plgVmOnDisplayModuleFEVM3
plgVmOnDisplayProductInCategoryFEVM3

The simpliest is to add a context value as Joomla do:

public function onContentPrepare($context, &$row, $params, $page = 0)
{
$allowed_contexts = array('com_content.category', 'com_content.article', 'com_content.featured');

if (!in_array($context, $allowed_contexts))
{
return true;
}
........

Milbo

Quote from: Hutson on July 11, 2015, 10:20:55 AM
IMHO -  A "disable add to cart and cart customfields" in category browse  - would be beneficial - as there is no point in displaying add to cart customfields if you do not also display the add to cart button.

Maybe someone can enlighten you as to whether the "display customfields in caetgory browse" only affects cart customfields

Do you sell only product variants? There are a lot shops they dont use any variants.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Margriet

Maybe this illustrates the problem. Customer can order T-shirt without selecting size.

Milbo

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

Margriet

Hi Max,
Unfortunately not. To make sure, just installed a fresh Joomla 3.4.5 with fresh VM 3.0.11.4 with only demo data and this is the result:
http://yndidev.tk/vm3/wear

Studio 42

Problem is same in product page. If you manipulate the HTML form and js, you can add to cart without any variants/options.
This is stupid most of case, but can be a problem in some case.

Milbo

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


Now I got the problem with it, when the customfields are disabled,.... ahhh. Hmm you should not disable em that way, then. When you disable them by config, the customfields are not processed.

In this case you must use a template override, for the sublayout products
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Margriet

Then maybe I don't understand why this option is available in configuration. In my opinion it should then be enabled by default and leave it to website developer to make an override (or simply hide custom fields with css).
And when option is available it should work in a way that if custom fields are present but not shown the add to cart button is not available but Product Details button is.

Milbo

The option is there to prevent the load of it. It changes the way to load the data. It is an option for shops having performance issues. Not a GUI thing, actually.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

IJack

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?

Studio 42

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