Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ProductId == 0)
        {
            Error404();
            return;
        }

        //if not have category
        if (ProductService.GetCountOfCategoriesByProductId(ProductId) == 0)
        {
            Error404();
            return;
        }


        // --- Check product exist ------------------------
        CurrentProduct = ProductService.GetProduct(ProductId);
        if (CurrentProduct == null || CurrentProduct.Enabled == false || CurrentProduct.HirecalEnabled == false)//CategoryService.IsEnabledParentCategories(_product.CategoryID) == false)
        {
            Error404();
            return;
        }

        if (CurrentProduct.Amount == 0 || CurrentProduct.Price == 0)
        {
            divAmount.Visible = false;
        }

        rating.ProductId  = CurrentProduct.ID;
        rating.Rating     = CurrentProduct.Ratio;
        rating.ShowRating = SettingsCatalog.EnableProductRating;
        rating.ReadOnly   = RatingService.DoesUserVote(ProductId, CustomerSession.CustomerId);


        pnlSize.Visible = !string.IsNullOrEmpty(CurrentProduct.Size) && (CurrentProduct.Size != "0|0|0");
        //lblSize.Text = !string.IsNullOrEmpty(_product.Size) ? _product.Size.Replace("|", "x") : string.Empty;
        pnlWeight.Visible = CurrentProduct.Weight != 0;
        //lblWeight.Text = _product.Weight.ToString();
        pnlBrand.Visible = CurrentProduct.Brand != null;

        productPropertiesView.ProductId = ProductId;
        productPhotoView.Product        = CurrentProduct;
        ProductVideoView.ProductID      = ProductId;
        relatedProducts.ProductIds.Add(ProductId);
        alternativeProducts.ProductIds.Add(ProductId);
        breadCrumbs.Items = CategoryService.GetParentCategories(CurrentProduct.CategoryID).Reverse().Select(cat => new BreadCrumbs()
        {
            Name = cat.Name,
            Url  = "social/catalogsocial.aspx?categoryid=" + cat.CategoryId
        }).ToList();
        breadCrumbs.Items.Insert(0, new BreadCrumbs()
        {
            Name = Resource.Client_MasterPage_MainPage,
            Url  = UrlService.GetAbsoluteLink("social/catalogsocial.aspx")
        });

        breadCrumbs.Items.Add(new BreadCrumbs {
            Name = CurrentProduct.Name, Url = null
        });

        RecentlyViewService.SetRecentlyView(CustomerSession.CustomerId, ProductId);

        if ((!IsPostBack) && (IsEditItem))
        {
            if (!IsCorrectItemType)
            {
                Redirect(UrlService.GetLink(ParamType.Product, CurrentProduct.UrlPath, ProductId));
                return;
            }

            switch (ItemType)
            {
            case ShoppingCartType.ShoppingCart:
                //txtAmount.Text = ShoppingCartService.CurrentShoppingCart[ItemIndex].Amount.ToString();
                break;

            case ShoppingCartType.Wishlist:
                //txtAmount.Text = "1";
                break;
            }
        }

        SetMeta(CurrentProduct.Meta, CurrentProduct.Name);

        productReviews.EntityType = EntityType.Product;
        productReviews.EntityId   = ProductId;
        //Master.CurrencyChanged += (OnCurrencyChanged);
        int reviewsCount = ReviewService.GetReviewsCount(ProductId, EntityType.Product);

        if (reviewsCount > 0)
        {
            lReviewsCount.Text = string.Format("({0})", reviewsCount);
        }
        GetOffer();
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ProductId == 0)
        {
            Error404();
            return;
        }

        //if not have category
        if (ProductService.GetCountOfCategoriesByProductId(ProductId) == 0)
        {
            Error404();
            return;
        }


        // --- Check product exist ------------------------
        CurrentProduct = ProductService.GetProduct(ProductId);
        if (CurrentProduct == null || CurrentProduct.Enabled == false || CurrentProduct.HirecalEnabled == false)//CategoryService.IsEnabledParentCategories(_product.CategoryID) == false)
        {
            Error404();
            return;
        }

        BuyInOneClick.Visible         = SettingsOrderConfirmation.BuyInOneClick;
        BuyInOneClick.ProductId       = CurrentProduct.ProductId;
        BuyInOneClick.SelectedOptions = productCustomOptions.SelectedOptions;
        BuyInOneClick.CustomOptions   = productCustomOptions.CustomOptions;

        if (CurrentProduct.Amount <= 0 || CurrentProduct.Price == 0)
        {
            divAmount.Visible = false;
        }

        CompareControl.Visible    = SettingsCatalog.EnableCompareProducts;
        CompareControl.ProductId  = ProductId;
        CompareControl.IsSelected = ShoppingCartService.CurrentCompare.Any(p => p.EntityId == ProductId);

        divUnit.Visible = CurrentProduct.Offers[0].Unit.IsNotEmpty();

        sbShareButtons.Visible = SettingsDesign.EnableSocialShareButtons;

        rating.ProductId  = CurrentProduct.ID;
        rating.Rating     = CurrentProduct.Ratio;
        rating.ShowRating = SettingsCatalog.EnableProductRating;
        rating.ReadOnly   = RatingService.DoesUserVote(ProductId, CustomerSession.CustomerId);

        pnlWishlist.Visible = SettingsDesign.WishListVisibility;

        pnlSize.Visible = !string.IsNullOrEmpty(CurrentProduct.Size) && (CurrentProduct.Size != "0|0|0");
        //lblSize.Text = !string.IsNullOrEmpty(_product.Size) ? _product.Size.Replace("|", "x") : string.Empty;
        pnlWeight.Visible = CurrentProduct.Weight != 0;
        //lblWeight.Text = _product.Weight.ToString();
        pnlBrand.Visible = CurrentProduct.Brand != null;

        //Commented by Evgeni
        //productPropertiesView.ProductId = ProductId;
        //productPropertiesSetView.ProductId = ProductId;
        //productPropertiesAddedValueView.ProductId = ProductId;
        //ProductVideoView.ProductID = ProductId;

        //Need to pass to user control List of all product properties and in each set to divide this list into categories
        List <PropertyValue> productProperties = PropertyService.GetPropertyValuesByProductId(ProductId);

        productPropertiesView.ProductProperties    = productProperties;
        productPropertiesSetView.ProductProperties = productProperties;
        productPropertiesSetView.ProductId         = ProductId;
        productPropertiesSetView.ManufacteruArtNo  = CurrentProduct.ManufactureArtNo;
        if (productProperties == null)
        {
            productPropertiesAddedValueView.ProductProperties = new List <PropertyValue>();
        }
        else
        {
            productPropertiesAddedValueView.ProductProperties = productProperties;
        }
        //Added by Evgeni for Stihl Viking
        if (CurrentProduct.Brand == null)
        {
        }
        else if ((CurrentProduct.Brand.Name.ToLower() == "stihl") || (CurrentProduct.Brand.Name.ToLower() == "viking"))
        {
            productPropertiesAddedValueView.ProductId = ProductId;
        }
        else
        {
            productPropertiesAddedValueView.ProductId = 0;
        }
        ProductVideoView.ProductID = ProductId;

        //Added By Evgeni to change long description into user friendly mode
        if ((CustomerSession.CurrentCustomer.CustomerGroup.GroupName == "Оптовик") || CustomerSession.CurrentCustomer.IsAdmin)
        {
            if (CurrentProduct.Offers.Where(t => t.OfferListId == 16).ToList().Count > 0 && CurrentProduct.Offers.Where(t => t.OfferListId == 16).FirstOrDefault().Price > 0)
            {
                lblSinglePriceTextForOptUser.Text = @"<font size='3'>  Розничная цена:  </font> <br />";
                lblOptPrice.Text = string.Format("<font size='3'>  Минимальная оптовая цена в евро:  </font> <br /> <div class='price'> {0} € </div>", CurrentProduct.Offers.Where(t => t.OfferListId == 16).FirstOrDefault().Price.ToString("F2"));
            }
        }
        DescriptionModificator();
        //////////////////////////////////////////////////////////

        productPhotoView.Product = CurrentProduct;
        relatedProducts.ProductIds.Add(ProductId);
        alternativeProducts.ProductIds.Add(ProductId);
        //Added By Evgeni for Bosch Related Products
        relatedBoschProducts.ProductIds.Add(ProductId);
        //

        breadCrumbs.Items = CategoryService.GetParentCategories(CurrentProduct.CategoryID).Reverse().Select(cat => new BreadCrumbs()
        {
            Name = cat.Name,
            Url  = UrlService.GetLink(ParamType.Category, cat.UrlPath, cat.ID)
        }).ToList();
        breadCrumbs.Items.Insert(0, new BreadCrumbs()
        {
            Name = Resource.Client_MasterPage_MainPage,
            Url  = UrlService.GetAbsoluteLink("/")
        });

        breadCrumbs.Items.Add(new BreadCrumbs {
            Name = CurrentProduct.Name, Url = null
        });

        RecentlyViewService.SetRecentlyView(CustomerSession.CustomerId, ProductId);

        if ((!IsPostBack) && (IsEditItem))
        {
            if (!IsCorrectItemType)
            {
                Redirect(UrlService.GetLink(ParamType.Product, CurrentProduct.UrlPath, ProductId));
                return;
            }

            switch (ItemType)
            {
            case ShoppingCartType.ShoppingCart:
                //txtAmount.Text = ShoppingCartService.CurrentShoppingCart[ItemIndex].Amount.ToString();
                break;

            case ShoppingCartType.Wishlist:
                //txtAmount.Text = "1";
                break;
            }
        }

        SetMeta(CurrentProduct.Meta, CurrentProduct.Name);

        productReviews.EntityType = EntityType.Product;
        productReviews.EntityId   = ProductId;

        ltrlRightColumnModules.Text = ModulesRenderer.RenderDetailsModulesToRightColumn();

        int reviewsCount = SettingsCatalog.ModerateReviews ? ReviewService.GetCheckedReviewsCount(ProductId, EntityType.Product) : ReviewService.GetReviewsCount(ProductId, EntityType.Product);

        if (reviewsCount > 0)
        {
            lReviewsCount.Text = string.Format("({0})", reviewsCount);
        }
    }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ProductId == 0)
            {
                Error404();
                return;
            }

            //if not have category
            if (ProductService.GetCountOfCategoriesByProductId(ProductId) == 0)
            {
                Error404();
                return;
            }

            // --- Check product exist ------------------------
            CurrentProduct = ProductService.GetProduct(ProductId);

            if (CurrentProduct == null || CurrentProduct.Enabled == false || CurrentProduct.CategoryEnabled == false)
            {
                Error404();
                return;
            }

            btnAdd.Text            = SettingsCatalog.BuyButtonText;
            btnOrderByRequest.Text = SettingsCatalog.PreOrderButtonText;

            if (CurrentProduct.TotalAmount <= 0 || CurrentProduct.MainPrice == 0)
            {
                divAmount.Visible = false;
            }


            //CompareControl.ProductId = ProductId;

            CurrentOffer = OfferService.GetMainOffer(CurrentProduct.Offers, CurrentProduct.AllowPreOrder, Request["color"].TryParseInt(true), Request["size"].TryParseInt(true));

            if (CurrentOffer != null)
            {
                BuyInOneClick.OfferID = CurrentOffer.OfferId;

                sizeColorPicker.SelectedOfferId = CurrentOffer.OfferId;

                //CompareControl.Visible = divCompare.Visible = SettingsCatalog.EnableCompareProducts;
                //CompareControl.OfferId = CurrentOffer.OfferId;
                //CompareControl.IsSelected =
                //    ShoppingCartService.CurrentCompare.Any(p => p.Offer.OfferId == CurrentOffer.OfferId);

                //WishlistControl.OfferId = CurrentOffer.OfferId;
                //divWishlist.Visible = SettingsDesign.WishListVisibility;
            }
            else
            {
                //CompareControl.Visible = divCompare.Visible = false;
                //divWishlist.Visible = false;
                pnlPrice.Visible = false;
            }

            BuyInOneClick.ProductId       = CurrentProduct.ProductId;
            BuyInOneClick.SelectedOptions = productCustomOptions.SelectedOptions;
            BuyInOneClick.CustomOptions   = productCustomOptions.CustomOptions;

            sizeColorPicker.ProductId = ProductId;

            divUnit.Visible = (CustomerContext.CurrentCustomer.IsAdmin || AdvantShop.Trial.TrialService.IsTrialEnabled) && SettingsMain.EnableInplace ? true : CurrentProduct.Unit.IsNotEmpty();

            rating.ProductId  = CurrentProduct.ID;
            rating.Rating     = CurrentProduct.Ratio;
            rating.ShowRating = SettingsCatalog.EnableProductRating;
            rating.ReadOnly   = RatingService.DoesUserVote(ProductId, CustomerContext.CustomerId);

            pnlSize.Visible   = !string.IsNullOrEmpty(CurrentProduct.Size) && (CurrentProduct.Size != "0|0|0") && SettingsCatalog.DisplayDimensions;
            pnlWeight.Visible = CurrentProduct.Weight != 0 && SettingsCatalog.DisplayWeight;

            CurrentBrand     = CurrentProduct.Brand;
            pnlBrand.Visible = CurrentBrand != null && CurrentBrand.Enabled;
            //pnlBrnadLogo.Visible = CurrentBrand != null && CurrentBrand.Enabled && CurrentBrand.BrandLogo != null;

            productPropertiesView.ProductId      = ProductId;
            productBriefPropertiesView.ProductId = ProductId;

            productPhotoView.Product = CurrentProduct;

            ProductVideoView.ProductID = ProductId;
            relatedProducts.ProductIds.Add(ProductId);
            alternativeProducts.ProductIds.Add(ProductId);
            breadCrumbs.Items =
                CategoryService.GetParentCategories(CurrentProduct.CategoryId).Reverse().Select(cat => new BreadCrumbs
            {
                Name = cat.Name,
                Url  = UrlService.GetLink(ParamType.Category, cat.UrlPath, cat.ID)
            }).ToList();
            breadCrumbs.Items.Insert(0, new BreadCrumbs
            {
                Name = Resource.Client_MasterPage_MainPage,
                Url  = UrlService.GetAbsoluteLink("/")
            });

            breadCrumbs.Items.Add(new BreadCrumbs {
                Name = CurrentProduct.Name, Url = null
            });

            RecentlyViewService.SetRecentlyView(CustomerContext.CustomerId, ProductId);

            productReviews.EntityType = EntityType.Product;
            productReviews.EntityId   = ProductId;

            int reviewsCount = SettingsCatalog.ModerateReviews
                                   ? ReviewService.GetCheckedReviewsCount(ProductId, EntityType.Product)
                                   : ReviewService.GetReviewsCount(ProductId, EntityType.Product);

            if (reviewsCount > 0)
            {
                lReviewsCount.Text = string.Format("({0})", reviewsCount);
            }

            //Добавим новые meta
            MetaInfo newMetaInfo = new MetaInfo();

            newMetaInfo                 = CurrentProduct.Meta;
            newMetaInfo.Title           = CurrentProduct.Name + " купить в интернет-магазине Корпорация Игрушек";
            newMetaInfo.MetaDescription = "Интернет-магазин Корпорация Игрушек представляет: " + CurrentProduct.Name + " и еще более 5,5 тысяч видов товаров по оптовым ценам. Порадуйте своего ребенка!";
            newMetaInfo.MetaKeywords    = CurrentProduct.Name;

            metaInfo = SetMeta(newMetaInfo, CurrentProduct.Name);

            //metaInfo = SetMeta(CurrentProduct.Meta, CurrentProduct.Name,
            //    CategoryService.GetCategory(CurrentProduct.CategoryId).Name,
            //    CurrentProduct.Brand != null ? CurrentProduct.Brand.Name : string.Empty,
            //    CatalogService.GetStringPrice(CurrentProduct.MainPrice -
            //                                  CurrentProduct.MainPrice * CurrentProduct.Discount / 100));

            if (SettingsSEO.ProductAdditionalDescription.IsNotEmpty())
            {
                liAdditionalDescription.Text =
                    GlobalStringVariableService.TranslateExpression(
                        SettingsSEO.ProductAdditionalDescription, MetaType.Product, CurrentProduct.Name,
                        CategoryService.GetCategory(CurrentProduct.CategoryId).Name,
                        CurrentProduct.Brand != null ? CurrentProduct.Brand.Name : string.Empty,
                        CatalogService.GetStringPrice(CurrentProduct.MainPrice -
                                                      CurrentProduct.MainPrice * CurrentProduct.Discount / 100));
            }

            LoadModules();

            if (GoogleTagManager.Enabled)
            {
                var tagManager = ((AdvantShopMasterPage)Master).TagManager;
                tagManager.PageType       = GoogleTagManager.ePageType.product;
                tagManager.ProdId         = CurrentOffer != null ? CurrentOffer.ArtNo : CurrentProduct.ArtNo;
                tagManager.ProdName       = CurrentProduct.Name;
                tagManager.ProdValue      = CurrentOffer != null ? CurrentOffer.Price : 0;
                tagManager.CatCurrentId   = CurrentProduct.MainCategory.ID;
                tagManager.CatCurrentName = CurrentProduct.MainCategory.Name;
            }
        }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ProductId == 0)
        {
            Error404();
            return;
        }

        //if not have category
        if (ProductService.GetCountOfCategoriesByProductId(ProductId) == 0)
        {
            Error404();
            return;
        }


        // --- Check product exist ------------------------
        CurrentProduct = ProductService.GetProduct(ProductId);
        if (CurrentProduct == null || CurrentProduct.Enabled == false || CurrentProduct.CategoryEnabled == false)
        {
            Error404();
            return;
        }

        //var firstOrffer = CurrentProduct.Offers.FirstOrDefault();
        //if (firstOrffer != null && (firstOrffer.Amount <= 0 || firstOrffer.Price == 0))
        {
            divAmount.Visible = false;
        }

        CurrentOffer = CurrentProduct.Offers.FirstOrDefault(o => o.Main) ?? CurrentProduct.Offers.FirstOrDefault();

        if (CurrentOffer != null)
        {
            //
        }
        else
        {
            pnlPrice.Visible = false;
        }


        rating.ProductId  = CurrentProduct.ID;
        rating.Rating     = CurrentProduct.Ratio;
        rating.ShowRating = SettingsCatalog.EnableProductRating;
        rating.ReadOnly   = RatingService.DoesUserVote(ProductId, CustomerContext.CustomerId);


        sizeColorPicker.ProductId = ProductId;

        pnlSize.Visible   = !string.IsNullOrEmpty(CurrentProduct.Size) && (CurrentProduct.Size != "0|0|0");
        pnlWeight.Visible = CurrentProduct.Weight != 0;
        pnlBrand.Visible  = CurrentProduct.Brand != null;

        productPropertiesView.ProductId = ProductId;
        productPhotoView.Product        = CurrentProduct;
        ProductVideoView.ProductID      = ProductId;
        relatedProducts.ProductIds.Add(ProductId);
        alternativeProducts.ProductIds.Add(ProductId);
        breadCrumbs.Items = CategoryService.GetParentCategories(CurrentProduct.CategoryId).Reverse().Select(cat => new BreadCrumbs
        {
            Name = cat.Name,
            Url  = "social/catalogsocial.aspx?categoryid=" + cat.CategoryId
        }).ToList();
        breadCrumbs.Items.Insert(0, new BreadCrumbs
        {
            Name = Resource.Client_MasterPage_MainPage,
            Url  = UrlService.GetAbsoluteLink("social/catalogsocial.aspx")
        });

        breadCrumbs.Items.Add(new BreadCrumbs {
            Name = CurrentProduct.Name, Url = null
        });

        RecentlyViewService.SetRecentlyView(CustomerContext.CustomerId, ProductId);

        SetMeta(CurrentProduct.Meta, CurrentProduct.Name);

        productReviews.EntityType = EntityType.Product;
        productReviews.EntityId   = ProductId;

        int reviewsCount = SettingsCatalog.ModerateReviews ? ReviewService.GetCheckedReviewsCount(ProductId, EntityType.Product) : ReviewService.GetReviewsCount(ProductId, EntityType.Product);

        if (reviewsCount > 0)
        {
            lReviewsCount.Text = string.Format("({0})", reviewsCount);
        }

        GetOffer();
    }