Author Topic: Virtuemart Dropdown Custom Field - Static Text Default  (Read 9670 times)

brentonking

  • Jr. Member
  • **
  • Posts: 74
    • Brenton King Graphic Design, Web Design and Joomla! Site Development
Virtuemart Dropdown Custom Field - Static Text Default
« 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!

brentonking

  • Jr. Member
  • **
  • Posts: 74
    • Brenton King Graphic Design, Web Design and Joomla! Site Development
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #1 on: November 22, 2012, 04:21:52 am »
Hoping someone can help. Even a little.

Marcus Hjortsberg

  • Beginner
  • *
  • Posts: 9
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #2 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!


alvinwang21

  • Beginner
  • *
  • Posts: 19
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #4 on: August 20, 2013, 08:13:20 am »
I have the same issue.  :(

Maxim Pishnyak

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2657
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #5 on: August 20, 2013, 12:14:58 pm »
I have the same issue.  :(
I don't know what is your specific issue :(

alvinwang21

  • Beginner
  • *
  • Posts: 19
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #6 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

Maxim Pishnyak

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2657
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #7 on: August 23, 2013, 12:04:28 pm »
You could use parent(product)-child(sizes) relation.

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1390
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #8 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.


alvinwang21

  • Beginner
  • *
  • Posts: 19
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #9 on: August 27, 2013, 01:37:04 am »
Can you please give a detail explaination?  :)

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1390
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #10 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

tuki

  • Beginner
  • *
  • Posts: 21
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #11 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.

MikeUK

  • Global Moderator
  • Full Member
  • *
  • Posts: 1344
Re: Virtuemart Dropdown Custom Field - Static Text Default (FIX)
« Reply #12 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:
Code: [Select]
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:
Code: [Select]
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
}
Get answers faster:

I can build your online shop, setup or customize Virtuemart or help your existing shop maximize its potential. Email / PM for info

Nocturnaloner

  • Beginner
  • *
  • Posts: 18
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #13 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.

Darkheart

  • Beginner
  • *
  • Posts: 12
Re: Virtuemart Dropdown Custom Field - Static Text Default
« Reply #14 on: February 09, 2014, 12:36:18 pm »
Yes, this is very annoying...

MikeUK - thanks fo your mod - it works! I have changed 
Code: [Select]
$adapted_text = "-Please Select-";to
Code: [Select]
$adapted_text = JText::_ ('COM_VIRTUEMART_LIST_EMPTY_OPTION');This is better for multilingual sites.