Author Topic: If userfield value =  (Read 204 times)

alexanderflr

  • Beginner
  • *
  • Posts: 38
  • VirtueMart Version: 3.2.2
If userfield value =
« on: September 13, 2017, 16:22:14 pm »
Hi,

I created in Shopper Fields a field named 'Test' and I'm trying to do something like:

Code: [Select]
$message = "example message";
if ($this->user->userFields->Test['value']=="30") echo "<script type='text/javascript'>alert('$message');</script>";?>
But it doesn't work  :-\
I want to add this code in shopping cart or somewhere else..

Does anyone know?

Thank you very much.
VM 3.2.4 on Joomla! 3.8.1 Stable, PHP Version 7.0.25

Studio 42

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2333
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: If userfield value =
« Reply #1 on: September 17, 2017, 01:54:12 am »
Hi,
Sorry but your explain are a little short.
When do you want display this alert?
When the user display the form, you can only check for the value by javascript not PHP.
If you want to verify it after, you need to write your own plugin(or modify Vm core)