Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Marc Love (uSkinned.net) 445 posts 1787 karma points
    Dec 21, 2012 @ 15:55
    Marc Love (uSkinned.net)
    0

    Dealing with products with Multiple Variants

    I have a store that has products with multiple variants for each product. I am currently looking into different ways of managing these products as I am seeing that creating each variant for each product is a bit of an admin nightmare. There are 24 variations for each product in total however only 2 of the variations result in a price change to the product.

    My latest idea is to create the 2 variations and accomodate for the other 22 with product property dropdowns that have not been checked as a variant property.

    I can then use dynamic orderline properties to add details of the specific variation to the order.

    My question therefore, is how do I pull the product properties through to the product detaill page. I have razor code for getting the variant options but not sure how to get the product properties that have not been marked as a variant.

    The following code is from the razor demo store, I need similar code to get product properties that are not variants:

    var uniqueVariants = from v in product.Variants.SelectMany(p => p.ProductProperties)
                             where v.ProductDefinitionField.DisplayOnSite
                             group v by v.ProductDefinitionField into g
                             select g;

     @if (uniqueVariants.Any())
                        {
                         <fieldset class="options">
                         @foreach (var prop in uniqueVariants)
                         {
                             var controlName = string.Format("variation-{0}", prop.Key.Name.ToLower());
                            <div class="general">
                                <label for="@controlName">@prop.Key.GetDisplayName()</label>
                                <span class="wrap">
                                     <select name="@controlName" id="@controlName" class="variant">
                                        <option>Please select ...</option>
                                        @foreach (var value in prop.Select(p => p.Value).Distinct())
             {
                                            <option value="@value">@value</option>
             }
                                    </select>
                                </span>
                            </div>
                         }
                        </fieldset>
                        }

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jan 02, 2013 @ 14:02
    Søren Spelling Lund
    0

    You can get at the product family properties with:

    Product productFamily = variant.ParentProduct;
    var productFamilyProperties = productFamiliy.ProductProperties;

    Hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft