News:

Looking for documentation? Take a look on our wiki

Main Menu

Show empty option value for custom field in cart

Started by julash, February 13, 2018, 07:11:14 AM

Previous topic - Next topic

julash

Hi,

Some of our product has a custom field with cart attribute and input enable for "Adding Frame". Its optional for customer to have framing. This custom field also "Automatically add an empty option" and "as radiolist" set to yes. So when admin add a product he/she will just include price for "Yes" value and virtuemart will add "No" value automatically. Please check first attached screenshot.

Now the problem is with cart page custom field value showing. Even when customer don't touch "Adding Framing" adding framing show as yes, but which should be "No' or should not show at all. To test please open this link and add to cart without doing anything to "Add Framing" https://www.goldmarkart.com/collections/school-prints/punch-and-judy-2. Then on cart page you will see add framing as Yes.

How to solve this? Should not add framing not show on cart page when not selected and or show only "no". Please help.

Bytheway, I did some styling so there just one button which is yes and no button is hidden. It dynamically change value when click. Please let me know if there any question.

Thanks
Julash

Jörgen

You have chosen YES as default.

regards

Jörgen  @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

julash

Quote from: Jörgen on February 13, 2018, 08:25:22 AM
You have chosen YES as default.

regards

Jörgen  @ Kreativ Fotografi

I removed YES from field default value, but no luck. Also tried resaving product after re-adding that custom field. On cart page Add Framing Yes still showing, https://www.goldmarkart.com/art-for-sale/punch-and-judy-2

I also tried by disabling "Automatically add an empty option", then add another add framing with "NO" for 0 price. Result, both Add Framing Yes and Add Framing No is showing in cart page even when I did not touch add framing. I wonder if it something to do with our website. I will test with a fresh install.

Studio 42


Jörgen

As Patrick suggests

And set default as:
First Option;secondoption

and empty option NO

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

julash

Thank you both for your reply, I appreciate that.

But sorry, its not working. Please check this link http://project.amjulash.com/vmtest/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=164&virtuemart_category_id=12&Itemid=101 and attached image for custom field settings.

I installed fresh vm site and setup the custom field. Now adding frame price is 500 for "Yes" and get auto included after adding to cart. Which is logical since adding frame is showing Yes on the product page, but will be a price shock and confusing when customer see cart page. Because sale price is showing without the adding frame price on product page and adding frame price not showing when "Is a list" set Yes.

Any suggestion?

Regards

Jörgen

Hello
I have been messing with this and can not get it to work. What have You done here ?
https://www.goldmarkart.com/collections/school-prints/punch-and-judy-2

It seems to work now or have I missed something ?

Regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

julash

Hello Jörgen,

No, its not working. Without doing anything to adding frame, when you add this product to cart, on cart page you will see adding frame as yes. Which should not be Yes, but no or don't show at all. Check attachment.

I tried as Patrick suggested, but no luck. When "is a list" is yes, then product price don't show and frame price auto get included with product price. But that will be a price shock or confusing because sale price is same on product page when you click add to cart. Check here, http://project.amjulash.com/vmtest/index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=164&virtuemart_category_id=12&Itemid=101

I starting to wonder if "as radiolist" has some bug. Please let me know if you have any question.

Regards

Studio 42

This is my setting and is working(see attached image)

See http://pro.st42.fr/en/teste-image.html, i added it to this test product

julash

I am really grateful for your kind help. I know that select-list works fine like you are showing. I used it like you are showing on other virtuemart websites I have built.

But as you can see on this product page https://www.goldmarkart.com/collections/school-prints/punch-and-judy-2 we are looking forward to use "radiolist", not select-list. So its look nice and user friendly for customer to check framing price without need to click on the list.

When you enable "as radiolist" framing attribute info don't work properly with cart.

Anyway, I wonder if there any way to make select-list appear like radio list or some kind of button type. There is a third party plugin that can help us, but it will be my last resort. Just don't want to add extra weight.


Regards

Studio 42

I have set it to ratio lst, it work too.
Verify if you have set it exactly as me.
In the product, add only the option and not the empty option
In my case, i have only set "EXTRA"
If it not work then update Virtuemart.

julash

Please check the attachment. If you buy the product without "Extra" and/or don't do anything either of the fields, "Extra" value still get added to the cart. On the attached screenshot you will see that "Option with empty value Extra" is showing after product title and total price is 58,00 €. If "Extra" was actually added then price should be 70,00 €. Please test yourself.

Studio 42

The problem is that empty option is not pre selected.
If you click "empty value"
If you need to preselect it, then you have to select it with a javascript
It's why i have done my own plugin for cart options. Vm code do not force values to be set.
See for eg this plugin demo http://pro.st42.fr/en/test-product-no4-in-engb.html

julash

#13
I have a solution. Instead of radiolist I am now using selectlist and made selectlist appear like radio button using CSS. Check result here https://www.goldmarkart.com/collections/school-prints/punch-and-judy-2, I have attached custom field settings.

Why I have not thought about this simple solution earlier :-[ Now "add frame" only show in cart when selected and frame price always show on product page.