Author Topic: Virtumart Custom fields with sub level  (Read 949 times)

techrahul87

  • Beginner
  • *
  • Posts: 23
Virtumart Custom fields with sub level
« on: November 27, 2012, 10:22:46 am »
Hi,

I am using virtuemart 2.0.14 and I am stuck with a problem.
I have a custom field "COLOR".

Now the problem is when we select  any color say red from drop down color, there will be another dropdown say "SUB COLOR" which will have sub color codes for red.
if user select blue then it will have sub color codes for blue and so on.

Can we achieve this functionality by using virtuemart custom fields or I have to code it.  :)





balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1375
Re: Virtumart Custom fields with sub level
« Reply #1 on: November 27, 2012, 17:34:49 pm »
I think that you can create a javascript object with all the color names and the color codes. e.g. myColors={red:'#ff0000', black:#000000, etc};
Then assign a function on the change of the drop down that fills an input text with a color code using the myColors object.

You can do that either by hacking an existing custom field or creating a new one