VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: annpaul on January 13, 2023, 09:02:41 AM

Title: Custom Field types - which one to use when
Post by: annpaul on January 13, 2023, 09:02:41 AM
I am using VM 4 and I need to create a few products where each product has the same three customization possibilities - EBOOK, PRINTED BOOK, and BOTH. The customer must select exactly one of these three options and the price needs to be updated according to their selection.

From what I read, I understand that I need to create a Custom Field with three possible values to achieve this but while creating a custom field, I see 16 possible custom field types and I am totally lost as to which type do I really need. I tried to find documentation that explains which custom field type is meant for what purpose but I could not find any. All I found was this page: http://dev.virtuemart.net/projects/virtuemart/wiki/Hints_for_the_use_of_the_product_customfields

Can someone please provide some pointers?

Title: Re: Custom Field types - which one to use when
Post by: jenkinhill on January 13, 2023, 11:49:03 AM
These may help:

http://docs.virtuemart.net/manual/general-concepts/212-customfields.html

http://docs.virtuemart.net/manual/general-concepts/186-derived-products-product-pattern-child-products.html

http://docs.virtuemart.net/tutorials/product-creation.html
Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 13, 2023, 12:02:16 PM
Thanks for responding. I checked out the links but none of them is applicable in the situation that I described.

I just need the same 3 options for all products and the price adjustments for each option is the same for all products.

Further, the Generic Child variant demo page at http://demo.virtuemart.net/product-variants/generic-child-cart-variant-detail doesn't work. When a variant is selected, the page shows the loading icon and never loads.
Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 13, 2023, 12:11:14 PM
I tried the String type :
With this, I have to configure each product individually. I have to add three options with prices to each product. Further, it lets me add the product to the cart even without any option being selected.

Then I tried String, is a list type:
With this, the benefit is that I don't have to create the options for each product. But then there is no way to specify a price for each of those options.


I am stuck. Please help.
Title: Re: Custom Field types - which one to use when
Post by: balai on January 13, 2023, 12:36:24 PM
You can set a price beside each value to update the price but yes you need to assign the custom fields to every product.
Also the native/built-in custom fields cannot be set to be required. In other words the field can be left empty or with the default selection.

If you want to have a required/mandatory check, you can use a 3rd party plugin like Custom Fields For All (https://breakdesigns.net/extensions/joomla/custom-fields-for-all). This plugin will also give you more features like additional display types.
Title: Re: Custom Field types - which one to use when
Post by: Studio 42 on January 13, 2023, 12:37:20 PM
See my product plugin demo
https://pro.st42.fr/en/shortcodes/dog-leash.html (https://pro.st42.fr/en/shortcodes/dog-leash.html)
Can be buy here https://shop.st42.fr/en/products/shortcodes.htm (https://shop.st42.fr/en/products/shortcodes.htm)
And the doc https://shop.st42.fr/en/shorcodes-english-doc (https://shop.st42.fr/en/shorcodes-english-doc)
Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 13, 2023, 12:52:36 PM
Quote from: balai on January 13, 2023, 12:36:24 PM
You can set a price beside each value to update the price but yes you need to assign the custom fields to every product.

Thanks for responding. I am not sure I understood you correctly. Are you talking about custom field type of String ?

If I select YES for the "Is a list" option for a custom field of type String, I am able to specify the list of values separated with semicolon, such as: EBOOK;PRINTED BOOK;BOTH. This goes in the Default Value field, right? Where can I specify the price for each option? I don't see any place to put prices.

Quote from: balai on January 13, 2023, 12:36:24 PM
Also the native/built-in custom fields cannot be set to be required. In other words the field can be left empty or with the default selection.
I created a new custom field of type String with name Book Type. How can I enforce that that a selection for this field is made?

I will check out the plugin your mentioned.
Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 13, 2023, 13:16:57 PM
I created a custom field type of String, named BOOK TYPE with Cart Attribute set to NoCart Input set to Yes, and Is a list? set to No.

Now, I go to the product config page and add multiple custom fields of type "BOOK TYPE" with different values, each with a different price EBook, Printed, Both. All these values show up in the product page in a drop down named BOOK TYPE and prices are shown as +5, +5, +10 for each option. This is good. This is exactly what I want.

But it has two issues:

1. I have to create these options in every product, which is too tedious and a management hassle (in case, an option needs some change).

2. These options are not shown for the products on Category list page (where all products are listed). Moreover, the Add to cart button on this page adds the product to the cart with the base price. Further, when I view the cart, it shows the product with all the options (instead of just one). This is totally messed up.

Title: Re: Custom Field types - which one to use when
Post by: Studio 42 on January 13, 2023, 23:58:38 PM
If you want use standard string, then use the cloning system after you created your main product
Another solution is to use a parent product, so all children inherit from parent



Title: Re: Custom Field types - which one to use when
Post by: jenkinhill on January 14, 2023, 11:12:54 AM
You can use template overrides to remove your problems with the Category list page
Title: Re: Custom Field types - which one to use when
Post by: GJC Web Design on January 14, 2023, 11:52:15 AM
QuoteI am using VM 4
version exactly?
Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 17, 2023, 11:37:04 AM
VirtueMart 4.0.12 10777
Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 17, 2023, 12:00:18 PM
I think I may have to give up on virtuemart at together.
It may handle several complicated things but the whole thing is so freaking complicate that I don't know how people use it specially when there is no documentation. On top of that, there doesn't seem to be any way to achieve a simple thing.  I have spent so much time on it trying to figure out how it works but, honestly, I think it sucks.
Title: Re: Custom Field types - which one to use when
Post by: balai on January 17, 2023, 13:02:24 PM
Here is how you add price to a custom field value, into the product
(https://i.ibb.co/pxwpJtY/string-cf.png)

The custom field should have the "Cart Attribute" and "Cart Input" settings enabled
Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 17, 2023, 15:00:39 PM
Yes, I understand that and I did that already. It worked but has two issues that I highlighted above. I am not finding a way around those issues.
Quote
I created a custom field type of String, named BOOK TYPE with Cart Attribute set to No,  Cart Input set to Yes, and Is a list? set to No.

Now, I go to the product config page and add multiple custom fields of type "BOOK TYPE" with different values, each with a different price EBook, Printed, Both. All these values show up in the product page in a drop down named BOOK TYPE and prices are shown as +5, +5, +10 for each option. This is good. This is exactly what I want.

But it has two issues:

1. I have to create these options in every product, which is too tedious and a management hassle (in case, an option needs some change).

2. These options are not shown for the products on Category list page (where all products are listed). Moreover, the Add to cart button on this page adds the product to the cart with the base price. Further, when I view the cart, it shows the product with all the options (instead of just one). This is totally messed up.

Title: Re: Custom Field types - which one to use when
Post by: balai on January 17, 2023, 15:20:09 PM
1. Check out a solution like RO CSVI for massive import/export of products.
2. Sounds like a template issue.
Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 18, 2023, 12:22:08 PM
It is not working even in Virtuemart demo at : https://demo.virtuemart.net/product-variants
On this page, the "Generic child variant" product is what I need. But when you select a variant from the drop down, nothing happens! The price doesn't change and the Add to cart button doesn't appear. Is it happening just for me?

Also, please see the tooltip in the attached image. It is showing raw html. Is this also a template issue?

Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 18, 2023, 12:36:27 PM
The second product in the demo is also fine but there doesn't seem to be any way to force the user to select a value for String, is input field before they can put it in cart.
Title: Re: Custom Field types - which one to use when
Post by: balai on January 18, 2023, 13:03:23 PM
Not sure i can help with the VM issues.

If you want to have stockable variants, i suggest trying the Stockable Custom Fields plugin.
You can combine that with Custom Fields For All, to get mandatory/required fields.
https://breakdesigns.net/extensions/joomla/custom-fields-for-all
Title: Re: Custom Field types - which one to use when
Post by: jenkinhill on January 18, 2023, 16:31:27 PM
For some reason the VM demo is still using VirtueMart 4.0.4 10688 - an old version where the child variants are buggy.

If you load the sample products in a VM 4.0.12 10777 installation then you will see that selecting a variant in the product takes you directly to the product detail page with that variant selected.
Title: Re: Custom Field types - which one to use when
Post by: annpaul on January 19, 2023, 14:33:57 PM
I am willing to pay a reasonable fee to someone who can show me how to achieve this. I have posted a project on Freelancer for this. I am not sure if I am allowed to post the link to the project here but in case anyone is interested, they may dm me. Here is the project description:

Quote
I have a Joomla 4 site with VirtueMart 4 installed. I need some help in configuring products in the following manner:

I have multiple products and all the products have the exact same three options out of which the customer must select 1 option. Depending on which option the customer selects, the price will be updated.

For example, there are multiple books for sale (each book is a product and each book has a different base price). While purchasing a book, the customer must select one of the three options - KINDLE, PDF, BOTH. If the customer selects the EBOOK option, the price increases by $0, if the customer selects the PDF option, the price increases by $0, but if the customer selects the BOTH option, the price increases by $5.

Customer must select 1 out of the three options otherwise product cannot be purchased. The options and their increments are the same for all products.

I need someone who is an expert at Virtuemart and knows how to configure products in this way. I want you to configure a couple of products on your own demo site in this manner so that I can understand how it is supposed to be done. I will reproduce the same on my site by looking at your configuration.

Essentially, I am paying for your knowledge of virtuemart. No other work is needed. Just show me how it is done correctly.

I am not even sure what level of effort this entails and would appreciate any feedback. Someone bid $600 for it and I think that is nuts.
Title: Re: Custom Field types - which one to use when
Post by: balai on January 19, 2023, 15:49:54 PM
You just need the 2 extensions i mentioned (1 of which is free) and some basic knowledge of VM.
If you need any support Breakdesigns has both well documentation and a dedicated support system.
Title: Re: Custom Field types - which one to use when
Post by: jenkinhill on January 19, 2023, 17:29:36 PM
@annpaul  balai's extensions will make your required setup easy to achieve so I suggest you take him up on his offer rather than spend cash on some "developer" who most likely has never heard of VirtueMart before. And yes, $600 is way to much for this, €23 for the Custom Fields For All plugin is a lot cheaper!