Exemplo n.º 1
0
        protected string GetVariantImageUrl(IDataItemContainer cont)
        {
            var v = cont.DataItem as Variant;
            var p = _currentProduct;

            return(DiskStorage.ProductVariantImageUrlMedium(HccApp, p.Bvin, p.ImageFileSmall, v.Bvin,
                                                            HccApp.IsCurrentRequestSecure()));
        }
        private void ShowDialog()
        {
            var variant = HccApp.CatalogServices.ProductVariants.Find(EditedVariantId);

            lblVariantDescription.Text = GetVariantDescription(variant);
            txtVariantSku.Text         = string.IsNullOrEmpty(variant.Sku) ? _currentProduct.Sku : variant.Sku;
            txtVariantPrice.Text       = (variant.Price < 0 ? _currentProduct.SitePrice : variant.Price).ToString("c");

            ucVariantImage.ImageUrl = DiskStorage.ProductVariantImageUrlMedium(HccApp, _currentProduct.Bvin,
                                                                               _currentProduct.ImageFileSmall, variant.Bvin, HccApp.IsCurrentRequestSecure());

            pnlEditVariant.Visible = true;
            ClientScript.RegisterStartupScript(Page.GetType(), "hcEditVariantDialog", "hcEditVariantDialog();", true);
        }
Exemplo n.º 3
0
 private void UpdateVariantImage(ProductValidateResponse validateResult, Product product, UserSpecificPrice price)
 {
     if (!string.IsNullOrEmpty(price.VariantId))
     {
         validateResult.MediumImageUrl = DiskStorage.ProductVariantImageUrlMedium(HccApp, product.Bvin,
                                                                                  product.ImageFileMedium, price.VariantId, false);
         validateResult.OriginalImageUrl = DiskStorage.ProductVariantImageUrlOriginal(HccApp, product.Bvin,
                                                                                      product.ImageFileMedium, price.VariantId, false);
     }
     else
     {
         validateResult.MediumImageUrl = DiskStorage.ProductImageUrlMedium(HccApp, product.Bvin,
                                                                           product.ImageFileMedium, false);
         validateResult.OriginalImageUrl = DiskStorage.ProductImageUrlOriginal(HccApp, product.Bvin,
                                                                               product.ImageFileMedium, false);
     }
 }
        private void LoadCart(CartViewModel model)
        {
            model.CurrentOrder = CurrentCart ?? new Order();

            if (CurrentCart == null || CurrentCart.Items == null || CurrentCart.Items.Count == 0)
            {
                model.CartEmpty = true;
                return;
            }
            model.Rates = GetRates();

            for (var i = CurrentCart.Items.Count - 1; i >= 0; i--)
            {
                var lineItem = CurrentCart.Items[i];
                var product  = lineItem.GetAssociatedProduct(HccApp);
                if (product != null)
                {
                    var ci = new CartLineItemViewModel
                    {
                        Item      = lineItem,
                        Product   = product,
                        ShowImage = true,
                        ImageUrl  = DiskStorage.ProductVariantImageUrlMedium(
                            HccApp, lineItem.ProductId,
                            product.ImageFileSmall,
                            lineItem.VariantId, Request.IsSecureConnection),
                        LinkUrl = UrlRewriter.BuildUrlForProduct(product,
                                                                 new { lineItem.OrderBvin, LineItemId = lineItem.Id }),
                        HasDiscounts = lineItem.HasAnyDiscounts
                    };

                    model.LineItems.Add(ci);
                }
                else
                {
                    CurrentCart.Items.RemoveAt(i);
                    HccApp.OrderServices.Orders.Update(CurrentCart);
                }
            }

            UpdateCartCustomerInfo();
        }