News:

Looking for documentation? Take a look on our wiki

Main Menu

Event triggered when changing dropbox in productdetails/add-to-cart?

Started by vigier, September 15, 2012, 16:34:23 PM

Previous topic - Next topic

vigier

Hi,

I want to write some code that changes the product-image when changing the dropboxes for the product attributes.
Let's say I have a dropbox for color and one for size. When I select Red and Size L, I want to show the picture of the red shirt and the text "L" in it...

I can see that at least "calculateModificators" in calculationh.php is triggered, but I can't trace back to the original event.
Who knows?

Kind regards, Vigier

vigier

Some additional information: using VM2.0.10 and Joomla 2.5. The "highest" event/function I found is "recalculate" in productdetails.php.
Is this the right place? As in adding another function that is being called in function recalculate?

bytelord

Hello,

If you use child products / variants i think you can accomplish that.
btw, You can find here a good custom field plugin made by PRO. http://forum.virtuemart.net/index.php?topic=99678.0
May be is helpful for making easier custom field variants. After that you can change the images in your child products.

For the size you could use some CSS to place an "L" or "M" image over the product image as you which, you should use some PHP also.
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!

vigier

Hi bytelord,

thnx for your reply. The characters on the image were just an example, I want to reload the image itself.
Downloading PRO's plugin is a good suggestion, maybe looking at his code makes the model more clear to me!

Kind regards, Vigier

bytelord

Hello,

You could use some javascript to fire the event for image changing but there will be an issue with the images itself (where will be stored, filenames, etc). For that reason i suggest you to use child products, for size or colors. You can search the forum to find similar issues with yours (mostly for products with size-color variants) and then try to fix up the images. I have seen some vm users have made color boxes for selecting color for example, without using child products.
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!