Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change product image by product variant (for ex: Color/Size) #2298

rashedhumayun2k3 opened this issue Nov 7, 2019 · 0 comments


Copy link

@rashedhumayun2k3 rashedhumayun2k3 commented Nov 7, 2019

I have create product variant attribute (Color) for my product. I can see those color in dropdownlist for my product.
I want to change the images when change the product color from that dropdownlist. But how can I access the product variant methods from Javascript. Please look some code:

To show the Dropdownlist of product variant color the code is like:

` var choices = option.Choices.OrderBy(x => x.SortOrder).Select(choice => new System.Web.Mvc.SelectListItem { Value = choice.Key.ToString(), Text = choice.Name, Selected = choice.IsDefaultChoice }).ToList();

@Html.DropDownListFor(x => x.OptionChoices[index], choices, new { name = option.Name.ToLower().Replace(" ", "-"), @Class = "form-control", @onchange = "callChangefunc(this.value)" })`

So you can see I have to get the images with callChangefunc() javascript method. How I can access the ProductVariants from MerchelloHelper() library ?

Is there any way to do this from admin side ? Please help.. I am new in umbraco.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.