VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: brentonking on November 20, 2012, 08:43:24 AM

Title: Virtuemart Dropdown Custom Field - Static Text Default
Post by: brentonking on November 20, 2012, 08:43:24 AM
Apologies if this has been asked and answered, I couldn't find it.

I want to have the words "Please Select" as the default option for all of my Drop Down Custom Fields. I need it to be static and DOESN'T act as a value. If the customer doesn't change to a value/option then they can't proceed with "Add to Cart".

Obviously adding the value "Please Select" as an option in each custom field isn't going to work. I just need it as the set default globally for custom field drop downs.

Probably best to also have a fail message popup reminding them to select an option.

Using VM 2.0.10 currently (I assume this hasn't been added yet for 2.0.14 anyway)
J 2.5.8

Please help!
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: brentonking on November 22, 2012, 04:21:52 AM
Hoping someone can help. Even a little.
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: Marcus Hjortsberg on January 02, 2013, 01:05:51 AM
I don't even know how to make a dropdown in virtuemart at all...
I would like this as well...

Thanx!
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: TTom911 on January 10, 2013, 11:27:13 AM
check here:

http://knowledgebase.inzinc.com/joomla-issues-and-fixes/creating-a-custom-field-in-virtumart-2.html
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: alvinwang21 on August 20, 2013, 08:13:20 AM
I have the same issue.  :(
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: Maxim Pishnyak on August 20, 2013, 12:14:58 PM
Quote from: alvinwang21 on August 20, 2013, 08:13:20 AM
I have the same issue.  :(
I don't know what is your specific issue :(
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: alvinwang21 on August 23, 2013, 01:41:03 AM
We want to set up the default value of dropdown box is select size. If customer click "add on" or "buy now" button, we can pop up a form said "please select the size of product". So, we don't have any chance that customer may accidently click on the wrong product size and get wrong product.  :)#

EDIT BY MODERATOR: This is not the issue raised by the OP
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: Maxim Pishnyak on August 23, 2013, 12:04:28 PM
You could use parent(product)-child(sizes) relation.
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: balai on August 23, 2013, 18:19:12 PM

You can create the drop-down using the cart variant custom field and set the values you like but you should create on your own the validation rule and alert.

Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: alvinwang21 on August 27, 2013, 01:37:04 AM
Can you please give a detail explaination?  :)
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: balai on August 27, 2013, 10:29:28 AM
Hi

here is the explanation for the cf:
http://www.ostraining.com/blog/joomla/custom-field-virtuemart/

As type select "cart variant"
As for the validation rule you should find a lot of stuff if you google it.

I think that you should get the selected value and if its the value of the default option "select something" to alert a message

"select something" should be set as option too, to your products
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: tuki on October 10, 2013, 19:32:35 PM
Check this tutorial http://awebsupport.com/vm2-set-up-child-product-with-stock-control
And the demo site: http://awebsupport.com/virtuemart-child-product-with-stock-control/productdetails/5
Did you mean this?

Some other useful information: We made +1 custom child called "Please Choose" ,and made a little modification in the default addtocart layour (not show add to cart button for this child product), and this works fine.
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default (FIX)
Post by: MikeUK on November 22, 2013, 23:25:26 PM
To bring this back on track after alvinwang21 almost derailed the thread..........  (@alvinwang21, see your first post. Changing the issue of a thread does not help. So make sure you understand the issue before posting)

I noticed this issue with the drop down (where there is no default 'please select' in the drop down list). I think I've got a fix. It needs more testing though.

To clarify, this fix changes the parent product name in the drop down to "-Please Select-".

This  works only if the custom field in the parent product has the 'Display parent as option' checked, and should only be used if the 'Parent orderable' option is unchecked.

In file administrator\components\com_virtuemart\models\customfields.php, change this:
foreach ($uncatChildren as $child) {
$options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id'],FALSE), 'text' => $child['product_name']);


to this:

foreach ($uncatChildren as $child) {
// -- Dropdown modification start (MikeUK)
if ($child['product_name'] != $product->product_name) {
$adapted_text = $child['product_name'];
}
else {
$adapted_text = "-Please Select-";
}
$options[] = array('value' => JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_category_id=' . $virtuemart_category_id . '&virtuemart_product_id=' . $child['virtuemart_product_id'],FALSE), 'text' => $adapted_text);
// -- Dropdown modification end
}
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: Nocturnaloner on December 18, 2013, 22:23:55 PM
Developers, thank you for this wonderful free software.  That said, this is basic functionality that is still broken, even after all this time.  If I have 2 child items, and the parent is not orderable, I can't add the first selected child to the cart.  I actually have to chose the second child item, then select the first again for it to be enabled to be added to the cart.  This is a bug that needs to be fixed.
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: Darkheart on February 09, 2014, 12:36:18 PM
Yes, this is very annoying...

MikeUK - thanks fo your mod - it works! I have changed 
$adapted_text = "-Please Select-";
to
$adapted_text = JText::_ ('COM_VIRTUEMART_LIST_EMPTY_OPTION');
This is better for multilingual sites.
Title: Re: Virtuemart Dropdown Custom Field - Static Text Default
Post by: davicod on September 09, 2014, 23:05:15 PM
This was very useful, thank you very much MikeUK and Darkheart.

The only problem is that when on a child product page that "--Please Select--" is selectable again and leads back to the parent product.
Is there any way to make it unselectable?