News:

Looking for documentation? Take a look on our wiki

Main Menu

Need Text Input Custom Field to be Required

Started by catondesigngroup, January 24, 2016, 08:16:14 AM

Previous topic - Next topic

catondesigngroup

I've searched all over, and bought a couple plugins (rather not badmouth them) but I have yet to find a plugin that works which will make a text input field required.  Radio buttons, select list, yes I am able to make them required with Custom Fields For All.  But not text input.  Help?  There's got to be a (working) plugin out there for this, right?
Seth W. Caton
Vice President
Caton Design Group

Studio 42

When you use the plugin provided by the core team, you can add this function

// this not permit to change value !
public function plgVmOnAddToCartFilter($product, $customfield, $customProductData, $customFiltered){
if ($customfield->custom_element !==$this->_name) return ;
if(empty($customProductData[$customfield->virtuemart_custom_id])) {
echo json_encode(array('stat' =>1, 'msg' => "You removed  the text input option")); jexit();
} else if(empty($customProductData[$customfield->virtuemart_custom_id][$customfield->virtuemart_customfield_id])) return ;
$selected = $customProductData[$customfield->virtuemart_custom_id][$customfield->virtuemart_customfield_id];
if( !$selected['comment'] ) {
echo json_encode(array('stat' =>1, 'msg' => "Please fell the text-input !"));
jexit();
}
}

If you dont use the modal popup, then this not work perfectly,you need to add a Joomla redirect.

hisslink

Thank you very much! Works perfectly for the textinput. I'm also using Custom Fields for All for all the other (required) custom fields. Also bought a plugin to make the textinput fields required, but this didn't work.

servlet

Он-лайн магазин за фототапети http://mishelfoster.com

Studio 42

@servlet : In the virtuemart text input plugin class
file : YOURJOOMLASITE\plugins\vmcustom\textinput\textinput.php
inside class plgVmCustomTextinput extends vmCustomPlugin {
Best at end before } closing tag

servlet

Он-лайн магазин за фототапети http://mishelfoster.com

doc_denis

Merci monsieur ;)
ça fonctionne très bien, super pratique le petit message en pop-up.
reste à ajouter une liaison avec le fichier le langue pour le multilingue.
Merci
c'est un truc à ajouter dans un autre lieu, non?

aftertaf

#7
i need this too for selling gift certificates that are sent by mail.

1- is there a safe way to use this as an override in the template ? In case VM updaes I wouldn't want to lose it.
2- Can the text be replaced by language overrides (i'd be needing it for multilingual site), like i see in other php files ? e.g. <?php echo vmText::_ ('COM_VIRTUEMART_NEED_MAIL_ADDRESS')?>


I confirm that the change works fine, as long as you paste it in the right part of the .php file :)

mhuebler

Is there someone can help to make this work with template override ?

Studio 42

You have all explains here. For Joomla overrides, Google is your friend ;)
If you need a developer, contact me or any other developer in the forum for a custom work.

servlet

It works, but fancy box is so small. It is different from other like add to cart and ask a question
Please give mi a hint how to change this fancy box, which file.
Он-лайн магазин за фототапети http://mishelfoster.com

Studio 42

If you modify the text and adding a <DIV> or add inline style.
I think it can be solved with some CSS rules

servlet

Он-лайн магазин за фототапети http://mishelfoster.com

aftertaf

Hi,

I haven't made any changes that I remember on this setup. It was working before.
Now I get the ajax popup 'you removed the text input option' but like i said, i dont think i modified this custom field since it was setup and tested working (with mandatory typing of data in it)
Any Idea what could be amiss?
this is obviously being triggered but i cant figure out why...


if(empty($customProductData[$customfield->virtuemart_custom_id])) {
echo json_encode(array('stat' =>1, 'msg' => "You removed  the text input option")); jexit();

T.A. Garrison, LLC

This thread is old, but the text input field (VM Custom - Customer text Input) STILL has problems.

I have spent all day today trying variations to get it to work, but no luck.

The field by itself works.
But if you "Require" a specific number of characters (Minimum required letters), then the "Add to Cart" will not appear. It's hidden.

After trying all sorts of variations, I get it to work ONLY if it's a Parent product. If it's a Child product, then it will not work.

BUT...it does not work 100% no matter what I do.
I can get the "Add to Cart" to display if it's a Parent product with the Minimum required letters set, but the Quantity does NOT display to the left of "Add to Cart". So there is no way for the customer to select more than 1 quantity until they get to the cart.
My client "must" have this working because he sells massive quantities of individual products. Expecting the user to "know" they need to go to the cart to increase the quantity is not good. And, the Quantity Discounts do not work when the text input field has a Minimum required letters.

I cannot get anybody to respond where we are now "supposed" to post tickets, so I'm back in the forum in this 8 year old thread!

I'm using Joomla 4.3.1 with VM 4.0.20
I really hope someone can help on this.
This is the third issue I currently have with VM and I'm unable to get anybody to respond - for more than a month now.
T.A. Garrison, LLC
3150 Orleans St. # 28261
Bellingham, WA 98228