Support Desk wrote:
Hi,
"Custom Field - Stockable Variant" shouldn't be presented in the category page. This problem has been reported while ago. But there is no patch for it currently. Since the JS lines gets involved, without a core hack, there is no way to make it work properly. On the other hand; touching the Virtuemart core files eventually generate some bigger and critical bugs, so best thing to do in here is to hide the custom fields from category browse page to avoid low user-experience.
Currently these custom fields don't work and should be hidden from the category browse page:
1- Generic Child Variant
2- Stockable Variant
All the other custom fields (the official custom fields come with the Virtuemart by default) are just working fine.
To hide the "Stockable Variant Custom field" from the category browse page;
open this PHP file:
/templates/YOUR_TEMPLATE/html/com_virtuemart/productdetails/default.php
(default.php, defaullist.php, flexv2.php or flexv2list.php which ever layout you are currently using by default)
Then look for this line:
if ($field->field_type !== "A") {?>
and replace it with this:
if (($field->field_type == "E") || ($field->field_type == "A")) { ?>
So, if the custom field type is "Stockable Variant" and "Generic Child Variant", the custom field will be hidden.
FYI:
type A = Generic Child Variant
type E = Stockable Variant
Regards,
Support
Thanks for the info, there is an error in your instructions in case anyone else tries to use this fix, the file is actually located in:
/templates/YOUR_TEMPLATE/html/com_virtuemart/category/default.php or flexv2.php or flexv2list.php (which ever you are using by default) not in productdetails/ directory
The custom fields work fine when viewing product details and need to or when you add to cart the custom field options won't be available making them completely useless.
I applied this fix to the category browse page where the issue occurs, and it does hide all of the custom fields so I thought that the issue was fixed. However, it also means that if a customer adds a product/products from the category list none of the options (custom fields) are available so the order goes through without any options selected.
Is there another fix for this or do I need to ditch this template and find one that works? I am using the default template on another site and it works fine, but would rather use this one on this site as I have already made many changes to it.
Thank you for your assistance and appreciate any help you can offer.