Dependent Dropdowns and a price value dependent on those dropdowns

Sumanth N asked on September 26, 2014 08:41

We are developing a eCommerce site in trail version to show our clients its almost done but we are struck at a issue. When creating a Product it is asking for price as mandatory but in our case, when we click on a product the redirected page should contain two dropdowns like category and sub-category which are dependent. After selecting the both dropdowns, price should appear depending on the selected values in dropdowns. How can we get dependent dropdowns and a price value after selecting those dropdowns? Please help us.

Recent Answers


Josef Dvorak answered on December 1, 2014 08:53

Hi Sumanth,

The Product Variants can serve this purpose. While the drop downs will not cascade, the Variants allow you to define which Product Option combinations are available for given product. Other combinations will not be available for selecting or purchase. Using this setting:

Store settings -> General -> Keep the advertised price of the products according to their cheapest product variant

You can select if the base SKU price should be shown in the Product listing, or if the cheapest Variant price should be used instead. You can disable this setting and set the SKU price to 0.

If it is not sufficient for you to only disable the unavailable product option combination, and you need to render the logic as part of cascading drop down, you can extend method SetDisabledProductOptions in control ShoppingCartItemSelector with custom logic. This way you can look up an OptionSelector that represents each drop down based on its Product option category name:

ProductOptionSelector optionSelector = OptionSelectors.Where(t => t.OptionCategory.CategoryName == "<YourCategoryName>").FirstOrDefault();

And set its Visible property according to your needs.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.