News:

Looking for documentation? Take a look on our wiki

Main Menu

How do I get the values of a dropdown list?

Started by nullachtfuffzehn, December 11, 2012, 16:34:28 PM

Previous topic - Next topic

nullachtfuffzehn

I'm running a shop with items where you can order different colors for each item. The colors are all the same for the items.

I created an override where I put colored symbols for the items. When you click on the the symbol I want to switch the dropdown to the according color.

To reach the goal I created a jquery script which worked fine for one item. It was based on the values of the dropdown.

But now, each new item has completely different values in the dropdown and I want to know how to get those values into my list of color symbols. The symbols are placed into the default.php for product details.

I know how to get an array of the values from the component and put them in there, but with the next update of VM the function would be overridden.

Any hints for that task?

bytelord

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

nullachtfuffzehn

Ok, I'm using VM 2.0.14 and Joomla 2.5.8, PHP is 5.4.9. I'm also using SEF, but I guess that's not important for this task.

bytelord

Hello,

You just describe something, without code or sample site is difficult someone to help you.

On the other hand you could create a plugin, as i see your are familiar with php/javascript and make that "overrides" on the compo.

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

nullachtfuffzehn

Thanks for your quick reply.

I didn't post any code since I can code things by myself as you already mentioned. I only wanted to get an idea on how to do it, so further updates won't overwrite my changes. I tried to get familiar with VM2 but the documentation atm is pretty poor. I admit that I could read through the whole code of VM2 and then I would find a solution for my problem. But it would take a couple of days. So I decided to ask if someone has a hint for me to get the task done.

You mentioned that I could write a plugin. Seems to me like a plan, even though I never did it before. Maybe you can give me some hints on how to do it. The only plugins I know in VM2 are the ones within the custom fields. Right now I don't see how they could help me to achieve the goal. Maybe I'm just kinda blind....

nullachtfuffzehn

Btw, what I want should look like the attachment. If I click on a color symbol at the bottom, the dropdown 'Farbe' should change to the according value. Don't care about the missing text in the dropdown, that was just a test. Usually it contains all the colors.

[attachment cleanup by admin]

nullachtfuffzehn

Since no one had an idea on how to solve the task I thought about using th jquery method .map() to catch the values of the select box after loading the page and insert them into the <img id=> tags. As soon as it works, I'll post the code here. Maybe it would help someone.