Author Topic: Show empty option value for custom field in cart  (Read 737 times)

julash

  • Beginner
  • *
  • Posts: 31
Show empty option value for custom field in cart
« on: February 13, 2018, 07:11:14 am »
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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1608
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Show empty option value for custom field in cart
« Reply #1 on: February 13, 2018, 08:25:22 am »
You have chosen YES as default.

regards

Jörgen  @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

julash

  • Beginner
  • *
  • Posts: 31
Re: Show empty option value for custom field in cart
« Reply #2 on: February 13, 2018, 08:41:20 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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3244
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Show empty option value for custom field in cart
« Reply #3 on: February 13, 2018, 17:34:32 pm »
Try to set the option "is a list" YES

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1608
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Show empty option value for custom field in cart
« Reply #4 on: February 13, 2018, 22:46:09 pm »
As Patrick suggests

And set default as:
First Option;secondoption

and empty option NO

Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

julash

  • Beginner
  • *
  • Posts: 31
Re: Show empty option value for custom field in cart
« Reply #5 on: February 14, 2018, 11:31:14 am »
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

  • Global Moderator
  • Full Member
  • *
  • Posts: 1608
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Show empty option value for custom field in cart
« Reply #6 on: February 14, 2018, 12:33:36 pm »
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.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

julash

  • Beginner
  • *
  • Posts: 31
Re: Show empty option value for custom field in cart
« Reply #7 on: February 14, 2018, 13:15:54 pm »
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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3244
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Show empty option value for custom field in cart
« Reply #8 on: February 14, 2018, 15:40:25 pm »
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

  • Beginner
  • *
  • Posts: 31
Re: Show empty option value for custom field in cart
« Reply #9 on: February 14, 2018, 16:04:56 pm »
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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3244
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Show empty option value for custom field in cart
« Reply #10 on: February 14, 2018, 16:15:35 pm »
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

  • Beginner
  • *
  • Posts: 31
Re: Show empty option value for custom field in cart
« Reply #11 on: February 14, 2018, 16:31:40 pm »
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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3244
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Show empty option value for custom field in cart
« Reply #12 on: February 14, 2018, 17:40:06 pm »
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

  • Beginner
  • *
  • Posts: 31
Re: Show empty option value for custom field in cart
« Reply #13 on: February 15, 2018, 07:23:58 am »
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.