VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: marvays on February 02, 2022, 11:39:47 AM

Title: custom fields went crazy?
Post by: marvays on February 02, 2022, 11:39:47 AM
I have an interesting problem. On an e-shop that works a lot of crazy custom fields. Sometimes it happens that the product has 4 color variants. The customer chooses one and buys it. When an order arrives in the email, or I look at it in the administration, instead of the selected color, it lists all the colors I can select.

When I test this product, it doesn't do it again. It's a coincidence. I looked into GA and these orders have no connection. Sometimes it's on the desktop, other times it's on the mobile. Do you have any idea when this might happen?

VirtueMart 3.8.9 10473
Joomla! 3.10.5 Stable
PHP 7.3.30
Title: Re: custom fields went crazy?
Post by: Studio 42 on February 02, 2022, 14:53:37 PM
marvays. The problem is that VIrtuemart do not check if a field is selected or not.
Try to not select a field > add to cart and you see the bug in the cart or order.
Title: Re: custom fields went crazy?
Post by: marvays on February 02, 2022, 15:37:41 PM
I have custom fields as a list and there is always a field selected.
Example (https://www.lukysipy.cz/omotavka-tetivy-flex-evo-15-0-19)

I don't understand why it works 100 times and 1 time not :(
Title: Re: custom fields went crazy?
Post by: Studio 42 on February 02, 2022, 16:14:34 PM
Sorry, it's not the case
in your exemple HTML in product details :


<select name="customProductData[879][9]" class="vm-chzn-select form-control">
<option value="6592">červená - černá </option>
<option value="6593">oranžová - černá </option>
<option value="6594">stříbrná - černá </option>
<option value="6595">zelená - černá </option>
</select>

Nothing is selected by default
DO the test. Simply go to the product and add it to the cart and check your order
It's why i wrote product shortcode plugin, because my customers had same problem
The virtuemart standard cart fields are not verified by javascript and not verified using PHP
Title: Re: custom fields went crazy?
Post by: marvays on February 02, 2022, 17:27:17 PM
Quote from: Studio 42 on February 02, 2022, 16:14:34 PM
It's why i wrote product shortcode plugin, because my customers had same problem
Can I request a link to a plugin that I can buy and use?
Title: Re: custom fields went crazy?
Post by: Jörgen on February 02, 2022, 22:57:43 PM
I guess You find it here:
https://shop.st42.fr/en/products/shortcodes.htm (https://shop.st42.fr/en/products/shortcodes.htm)

Jörgen @ Kreativ Fotografi
Title: Re: custom fields went crazy?
Post by: marvays on February 03, 2022, 07:01:30 AM
Quote from: Jörgen on February 02, 2022, 22:57:43 PM
I guess You find it here:
https://shop.st42.fr/en/products/shortcodes.htm (https://shop.st42.fr/en/products/shortcodes.htm)

Jörgen @ Kreativ Fotografi
Hello. I was looking at this plugin. But I guess I translated it wrong, because I don't see this function anywhere. or I misunderstand.
Title: Re: custom fields went crazy?
Post by: Jörgen on February 03, 2022, 11:26:36 AM
Talk to Patrick @ Studio42, I think he can help you explain how to use it, it has a lot of funtionality, shortcodes beeing one of them.

I use some of his extensions already, multi upload of images is my favourite :)

I may look at this also.

Jörgen @ Kreativ Fotografi


Title: Re: custom fields went crazy?
Post by: Studio 42 on February 03, 2022, 13:51:00 PM
You can find the setting here : https://shop.st42.fr/en/shorcodes-english-doc#cart_list
The screenshot are in french, but you have a setting "required" if you need to be sure the option is selected.
This mean that you can force or not the option in the basket.
Demo https://pro.st42.fr/en/shortcodes/test-product-no4-in-engb.html
Or using checkboxes see https://pro.st42.fr/en/shortcodes/checkboxes-insurances.html
Title: Re: custom fields went crazy?
Post by: marvays on February 03, 2022, 14:17:49 PM
Thx.
Do I understand correctly that I have to redesign all custom fields for all products?
Title: Re: custom fields went crazy?
Post by: Studio 42 on February 03, 2022, 15:14:43 PM
Yes, you have to redo all customfields.
If you do not want then add a script to force to select first option or modify it in your sublayout override.
But javascript does not prevent a user from adding an invalid product to cart
Title: Re: custom fields went crazy?
Post by: balai on February 03, 2022, 15:43:16 PM
Probably Patrick's plugin does the trick.

Alternatively you can try Custom Fields For All (https://breakdesigns.net/extensions/joomla/custom-fields-for-all) as well.
There is a functionality for required custom fields there as well.
Title: Re: custom fields went crazy?
Post by: sirius on February 04, 2022, 14:32:40 PM
Hi Patrick,
what happen when we use your "buy together" plugin ?
Because at this time, it adds all the options at once, if a product is involved in the "buy together" has options
Will it popup a warning like on the demo ?

Quote from: Studio 42 on February 03, 2022, 13:51:00 PM
You can find the setting here : https://shop.st42.fr/en/shorcodes-english-doc#cart_list
The screenshot are in french, but you have a setting "required" if you need to be sure the option is selected.
This mean that you can force or not the option in the basket.
Demo https://pro.st42.fr/en/shortcodes/test-product-no4-in-engb.html
Or using checkboxes see https://pro.st42.fr/en/shortcodes/checkboxes-insurances.html
Title: Re: custom fields went crazy?
Post by: Studio 42 on February 05, 2022, 10:26:51 AM
Buy to gether plugin is to have similar option as amazon, so i never checked if it work with optional fields, but in all case you have a second check in shortcode cart list and the product with invalid options is not added to the cart because the PHP check again the values
Title: Re: custom fields went crazy?
Post by: marvays on February 07, 2022, 05:50:54 AM
thank you for offering plugins. I will definitely think about them, but not on this site. This site has been running for several years and suddenly makes this mistake. I have to find out the reason. I can't redesign all products and replace custom fields :( An error must be detected.
Title: Re: custom fields went crazy?
Post by: sirius on February 07, 2022, 16:35:56 PM
Quote from: Studio 42 on February 05, 2022, 10:26:51 AM
Buy to gether plugin is to have similar option as amazon, so i never checked if it work with optional fields, but in all case you have a second check in shortcode cart list and the product with invalid options is not added to the cart because the PHP check again the values

Hi
it works, but if there's several standard customfields options on a dropdown on a product of the buy together, all options are added at once in the basket.
Title: Re: custom fields went crazy?
Post by: Studio 42 on February 08, 2022, 12:54:47 PM
sirius, the buy together is to add standard products. Not with options. VM internal code do not provide a way to force something
Title: Re: custom fields went crazy?
Post by: sirius on February 08, 2022, 15:22:09 PM
ok
no problem
I was hoping there was a way to bypass the options when adding  :( ;)
Title: Re: custom fields went crazy?
Post by: hazael on February 12, 2022, 14:14:01 PM
You may not have locked the value (color) of the parent's product in child products. Then child products will display both values. This is the age-old problem of Virtuemart.

The "custom fields for all" plugin by BreakDesign works very well in this case. Email notifications come along with the selected color and other options.