News:

Support the VirtueMart project and become a member

Main Menu

Order child product based on custom field

Started by Kuubs, December 14, 2023, 14:26:27 PM

Previous topic - Next topic

Kuubs

Hello,

I have a very specific problem I need to tackle. My client would like to have a website with a product configurator, which also has a different colors section. At the moment every color is a product child, but this client wants to not browse to another url. I can use AJAX but that doesn't solve my problem.

Now I've thought about this and have come up with a solution that I'd like to implement but I'm not sure if this is possible. I want to create my own custom fields based on the different colors that are available (so the current active childs) and make a radio button for that. Now after that I want to change the order url, so that when the client presses the order button it should add the specific child with all the custom fields selected to the cart.

Is this possible? Maybe do this with the Virtuemart API?



Another solution would be to add a text custom field, and specify the colors available and use that to link it to the database, perhaps with a plugin? So for example i have:

-Product 1
-Child product 1: Blue
-Child product 2: Red

-Product 1 Custom fields:
-Blue
-Red

When the customer specifies the text custom field Red it should link to the actual Child Product to order when it presses "Order" and pays. Is it possible to then change the order so it actually orders the child product Red instead of the Product 1 with a Red custom field?

I hope I'm clear? can someone help me tackle this problem? I basically want to use 1 main page for the product (so the Product 1 page) and then specify colors and use the actual Child Product based on that color to order it, so that the Stock is changed etc.

EDIT: Ok I thought about this for a while, and I think this should be done with a plugin. When the order is confirmed it should change the order to check if the custom field is selected and use that value to change the actual ordered product id to the correspondig child id, and keep all the custom fields that are selected intact. What are your thoughts about it?