public ActionResult AddToBasket(AddItemModel model)
        {
            // This is an example of using the ExtendedDataCollection to add some custom functionality.
            // In this case, we are creating a direct reference to the content (Product Detail Page) so
            // that we can provide a link, thumbnail and description in the cart per this design.  In other
            // designs, there may not be thumbnails or descriptions and the link could be to a completely
            // different website.
            var extendedData = new ExtendedDataCollection();
            extendedData.SetValue("umbracoContentId", model.ContentId.ToString(CultureInfo.InvariantCulture));

            var product = _merchelloContext.Services.ProductService.GetByKey(model.ProductKey);

            // In the event the product has options we want to add the "variant" to the basket.
            // -- If a product that has variants is defined, the FIRST variant will be added to the cart.
            // -- This was done so that we did not have to throw an error since the Master variant is no
            // -- longer valid for sale.
            if (model.OptionChoices != null && model.OptionChoices.Any())
            {

                var variant = _merchelloContext.Services.ProductVariantService.GetProductVariantWithAttributes(product, model.OptionChoices);

                // TODO : This is an error in the back office ... name should already include the variant info
                // Begin fix -------------------------------------------------------------------------------------------
                // We need to save the variant name (T-Shirt - blue, large) instead of (T-Shirt).  This is done in the
                // ProductVariantService CreateProductVariantWithKey ... but obviously we're not using that method
                // and must be doing it himself in the Back Office before he sends it to the server - likely just
                // calling save.  http://issues.merchello.com/youtrack/issue/M-153
                var name = product.Name;
                foreach (var att in variant.Attributes)
                {
                    if (name == product.Name) name += " - ";
                    else
                        name += ", ";
                    name += " " + att.Name;
                }
                // end fix ----------------------------------------------------------------------------------------------

                _basket.AddItem(variant, name, 1, extendedData);
            }
            else
            {

                _basket.AddItem(product, product.Name, 1, extendedData);
            }
            _basket.Save();

            // redirect to the cart page - this is a quick and dirty and should be done differently in
            // practice
            return RedirectToUmbracoPage(BasketContentId);
        }
        public ActionResult RenderAddToCart(ProductDisplay product)
        {
            var contentId = UmbracoContext.PageId != null ? UmbracoContext.PageId.Value : 0;

            var model = new AddItemModel()
                {
                    ProductKey = product.Key,
                    ContentId = contentId
                };

            return PartialView("merchAddToCart", model);
        }