News:

Looking for documentation? Take a look on our wiki

Main Menu

Custom Field types - which one to use when

Started by annpaul, January 13, 2023, 09:02:41 AM

Previous topic - Next topic

annpaul

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?


jenkinhill

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

annpaul

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.

annpaul

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.

balai

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. This plugin will also give you more features like additional display types.


annpaul

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.

annpaul

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.


Studio 42

#8
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




jenkinhill

You can use template overrides to remove your problems with the Category list page
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

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

annpaul


annpaul

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.

balai

Here is how you add price to a custom field value, into the product


The custom field should have the "Cart Attribute" and "Cart Input" settings enabled

annpaul

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.