protected void Page_Load(object sender, EventArgs e)
        {
            int     _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
            Product _Product   = ProductDataSource.Load(_ProductId);

            if (_Product != null)
            {
                List <AbleCommerce.Code.ProductAssetWrapper> assetList = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, _Product, "javascript:window.close()");
                if (assetList.Count > 0)
                {
                    CaptionText.Text         = this.Caption;
                    AssetLinkList.DataSource = assetList;
                    AssetLinkList.DataBind();
                    ProductAssetsPanel.Visible = true;
                }
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (_BasketItem != null)
            {
                Product product = _BasketItem.Product;
                if (product != null)
                {
                    //OUTPUT THE PRODUCT NAME
                    string productName = product.Name;
                    if (_BasketItem.ProductVariant != null)
                    {
                        productName += string.Format(" ({0})", _BasketItem.ProductVariant.VariantName);
                    }
                    if (this.LinkProducts)
                    {
                        //OUTPUT NAME AS LINK
                        string link = string.Format("<a target=\"_blank\" href=\"{0}\">{1}</a>", Page.ResolveUrl("~/Admin/Products/EditProduct.aspx?ProductId=" + product.Id), productName);
                        phProductName.Controls.Add(new LiteralControl(link));
                    }
                    else
                    {
                        //OUTPUT NAME
                        phProductName.Controls.Add(new LiteralControl(productName));
                    }
                    //SHOW INPUTS
                    IList <BasketItemInput> inputs = GetCustomerInputs();
                    if (inputs.Count > 0)
                    {
                        InputList.DataSource = inputs;
                        InputList.DataBind();
                    }
                    else
                    {
                        InputList.Visible = false;
                    }
                    //SHOW KIT PRODUCTS
                    IList <BasketItem> kitProductList = GetKitProducts(_BasketItem);
                    KitProductPanel.Visible = (kitProductList.Count > 0);
                    if (KitProductPanel.Visible)
                    {
                        KitProductRepeater.DataSource = kitProductList;
                        KitProductRepeater.DataBind();
                    }
                    //SET THE WISHLIST LABEL
                    WishlistLabel.Visible = (_BasketItem.WishlistItem != null);
                    if (WishlistLabel.Visible)
                    {
                        //SET THE WISHLIST NAME
                        WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(_BasketItem.WishlistItem.Wishlist));
                    }
                    //SET THE SHIPS TO PANEL
                    Basket basket = _BasketItem.Basket;

                    //SHOW ASSETS
                    List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, _BasketItem.Product, _BasketItem.OptionList, _BasketItem.KitList, "javascript:window.close()");
                    AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
                    if (AssetsPanel.Visible)
                    {
                        AssetLinkList.DataSource = assets;
                        AssetLinkList.DataBind();
                    }
                    //SHOW SUBSCRIPTIONS
                    SubscriptionPlan sp = _BasketItem.Product.SubscriptionPlan;
                    SubscriptionPanel.Visible = (this.ShowSubscription && sp != null && sp.IsRecurring);
                    if (SubscriptionPanel.Visible)
                    {
                        InitialPayment.Visible = (sp.RecurringChargeSpecified);
                        if (InitialPayment.Visible)
                        {
                            InitialPayment.Text = string.Format(InitialPayment.Text, _BasketItem.Price.LSCurrencyFormat("lc"));
                        }
                        string period;
                        if (sp.PaymentFrequency > 1)
                        {
                            period = sp.PaymentFrequency + " " + sp.PaymentFrequencyUnit.ToString().ToLowerInvariant() + "s";
                        }
                        else
                        {
                            period = sp.PaymentFrequencyUnit.ToString().ToLowerInvariant();
                        }
                        int numPayments = (sp.RecurringChargeSpecified ? sp.NumberOfPayments - 1 : sp.NumberOfPayments);
                        if (sp.NumberOfPayments == 0)
                        {
                            RecurringPayment.Text = string.Format("Recurring Payment: {0}, every {1} until canceled", sp.CalculateRecurringCharge(_BasketItem.Price).LSCurrencyFormat("lc"), period);
                        }
                        else
                        {
                            RecurringPayment.Text = string.Format(RecurringPayment.Text, numPayments, sp.CalculateRecurringCharge(_BasketItem.Price).LSCurrencyFormat("lc"), period);
                        }
                    }
                }
                else
                {
                    //OUTPUT NAME
                    phProductName.Controls.Add(new LiteralControl(_BasketItem.Name));
                    InputList.Visible         = false;
                    KitProductPanel.Visible   = false;
                    WishlistLabel.Visible     = false;
                    AssetsPanel.Visible       = false;
                    SubscriptionPanel.Visible = false;
                }
            }
            else
            {
                //NO ITEM TO DISPLAY
                this.Controls.Clear();
            }
        }
Exemple #3
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (_OrderItem != null)
     {
         Product product = _OrderItem.Product;
         if (product != null)
         {
             string productName = _OrderItem.Name;
             if (!string.IsNullOrEmpty(_OrderItem.VariantName))
             {
                 string variantName = string.Format(" ({0})", _OrderItem.VariantName);
                 if (!productName.EndsWith(variantName))
                 {
                     productName += variantName;
                 }
             }
             if (this.LinkProducts)
             {
                 ProductLink.NavigateUrl = "~/Admin/Products/EditProduct.aspx?ProductId=" + product.Id.ToString();
                 ProductLink.Text        = productName;
                 ProductName.Visible     = false;
             }
             else
             {
                 ProductName.Text    = productName;
                 ProductLink.Visible = false;
             }
             //SHOW INPUTS
             if (_OrderItem.Inputs.Count > 0)
             {
                 InputList.DataSource = _OrderItem.Inputs;
                 InputList.DataBind();
             }
             else
             {
                 InputList.Visible = false;
             }
             //SHOW KIT PRODUCTS IF AVAILABLE, AND THE PRODUCT DOES NOT USE ITEMIZED DISPLAY
             if (!string.IsNullOrEmpty(_OrderItem.KitList) && !_OrderItem.ItemizeChildProducts)
             {
                 IList <OrderItem> kitProductList = GetKitProducts(_OrderItem);
                 if (kitProductList.Count > 0)
                 {
                     KitProductPanel.Visible       = true;
                     KitProductRepeater.DataSource = kitProductList;
                     KitProductRepeater.DataBind();
                 }
             }
             //SET THE KIT MEMBER LABEL
             if (_OrderItem.OrderItemType == OrderItemType.Product && _OrderItem.IsChildItem)
             {
                 OrderItem parentItem = _OrderItem.GetParentItem(true);
                 if (parentItem != null &&
                     (parentItem.ItemizeChildProducts ||
                      _OrderItem.OrderShipmentId != parentItem.OrderShipmentId))
                 {
                     //SET THE WISHLIST NAME
                     KitMemberLabel.Visible = true;
                     KitMemberLabel.Text    = string.Format(KitMemberLabel.Text, parentItem.Name);
                 }
             }
             //SET THE WISHLIST LABEL
             WishlistLabel.Visible = (_OrderItem.WishlistItem != null);
             if (WishlistLabel.Visible)
             {
                 //SET THE WISHLIST NAME
                 WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(_OrderItem.WishlistItem.Wishlist));
             }
             //SET THE SHIPS TO PANEL
             Order         basket   = _OrderItem.Order;
             OrderShipment shipment = _OrderItem.OrderShipment;
             ShipsToPanel.Visible = this.ShowShipTo;
             if (ShipsToPanel.Visible)
             {
                 ShipsTo.Text = shipment.ShipToFullName;
             }
             //SHOW GIFT WRAP
             GiftWrapPanel.Visible = (_OrderItem.WrapStyle != null);
             if (GiftWrapPanel.Visible)
             {
                 GiftWrap.Text         = _OrderItem.WrapStyle.Name;
                 GiftWrapPrice.Visible = (_OrderItem.WrapStyle.Price != 0);
                 GiftWrapPrice.Text    = string.Format("&nbsp;({0})", _OrderItem.WrapStyle.Price);
             }
             //SHOW GIFT MESSAGE
             GiftMessagePanel.Visible = (!string.IsNullOrEmpty(_OrderItem.GiftMessage));
             if (GiftMessagePanel.Visible)
             {
                 GiftMessage.Text = _OrderItem.GiftMessage;
             }
             //SHOW ASSETS
             List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, _OrderItem.Product, _OrderItem.OptionList, _OrderItem.KitList, "~/Members/MyOrder.aspx?OrderNumber=" + _OrderItem.Order.OrderNumber.ToString());
             AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
             if (AssetsPanel.Visible)
             {
                 AssetLinkList.DataSource = assets;
                 AssetLinkList.DataBind();
             }
         }
         else
         {
             ProductLink.Visible      = false;
             ProductName.Text         = _OrderItem.Name;
             InputList.Visible        = false;
             KitProductPanel.Visible  = false;
             WishlistLabel.Visible    = false;
             ShipsToPanel.Visible     = false;
             GiftWrapPanel.Visible    = false;
             GiftMessagePanel.Visible = false;
             AssetsPanel.Visible      = false;
         }
     }
     else
     {
         //NO ITEM TO DISPLAY
         this.Controls.Clear();
     }
 }
Exemple #4
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (_OrderItem != null)
            {
                Product product = _OrderItem.Product;
                if (product != null)
                {
                    string productName = _OrderItem.Name;
                    if (!string.IsNullOrEmpty(_OrderItem.VariantName))
                    {
                        string variantName = string.Format(" ({0})", _OrderItem.VariantName);
                        if (!productName.Contains(variantName))
                        {
                            productName += variantName;
                        }
                    }
                    if (this.LinkProducts)
                    {
                        ProductLink.NavigateUrl = UrlGenerator.GetBrowseUrl(product.Id, CatalogNodeType.Product, productName);
                        if (EnableFriendlyFormat)
                        {
                            ProductLink.Text = string.Format("{0} of {1}(<span class='price'>{2}</span>)", _OrderItem.Quantity, productName, _OrderItem.Price.LSCurrencyFormat("ulc"));
                        }
                        else
                        {
                            ProductLink.Text = productName;
                        }
                        ProductName.Visible = false;
                    }
                    else
                    {
                        if (EnableFriendlyFormat)
                        {
                            ProductName.Text = string.Format("{0} of {1}(<span class='price'>{2}</span>)", _OrderItem.Quantity, productName, _OrderItem.Price.LSCurrencyFormat("ulc"));
                        }
                        else
                        {
                            ProductName.Text = productName;
                        }
                        ProductLink.Visible = false;
                    }
                    //SHOW INPUTS
                    if (_OrderItem.Inputs.Count > 0)
                    {
                        InputList.DataSource = _OrderItem.Inputs;
                        InputList.DataBind();
                    }
                    else
                    {
                        InputList.Visible = false;
                    }
                    //SHOW KIT PRODUCTS IF AVAILABLE, AND THE PRODUCT DOES NOT USE ITEMIZED DISPLAY
                    if (!string.IsNullOrEmpty(_OrderItem.KitList) && !_OrderItem.ItemizeChildProducts)
                    {
                        IList <OrderItem> kitProductList = GetKitProducts(_OrderItem);
                        if (kitProductList.Count > 0)
                        {
                            KitProductPanel.Visible       = true;
                            KitProductRepeater.DataSource = kitProductList;
                            KitProductRepeater.DataBind();
                        }
                    }
                    //SET THE KIT MEMBER LABEL
                    if (_OrderItem.OrderItemType == OrderItemType.Product && _OrderItem.IsChildItem)
                    {
                        OrderItem parentItem = _OrderItem.GetParentItem(true);
                        if (parentItem.ItemizeChildProducts ||
                            _OrderItem.Id != parentItem.Id)
                        {
                            //SET THE WISHLIST NAME
                            KitMemberLabel.Visible = true;
                            KitMemberLabel.Text    = string.Format(KitMemberLabel.Text, parentItem.Name);
                        }
                    }
                    //SET THE WISHLIST LABEL
                    WishlistLabel.Visible = (_OrderItem.WishlistItem != null);
                    if (WishlistLabel.Visible)
                    {
                        //SET THE WISHLIST NAME
                        WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(_OrderItem.WishlistItem.Wishlist));
                    }
                    //SET THE SHIPS TO PANEL
                    Order         basket   = _OrderItem.Order;
                    OrderShipment shipment = _OrderItem.OrderShipment;
                    ShipsToPanel.Visible = this.ShowShipTo;
                    if (ShipsToPanel.Visible)
                    {
                        ShipsTo.Text = shipment.ShipToFullName;
                    }
                    //SHOW GIFT WRAP
                    GiftWrapPanel.Visible = (_OrderItem.WrapStyle != null);
                    if (GiftWrapPanel.Visible)
                    {
                        GiftWrap.Text         = _OrderItem.WrapStyle.Name;
                        GiftWrapPrice.Visible = (_OrderItem.WrapStyle.Price != 0);
                        GiftWrapPrice.Text    = string.Format("&nbsp;({0})", _OrderItem.WrapStyle.Price.LSCurrencyFormat("ulc"));
                    }
                    //SHOW GIFT MESSAGE
                    GiftMessagePanel.Visible = (!string.IsNullOrEmpty(_OrderItem.GiftMessage));
                    if (GiftMessagePanel.Visible)
                    {
                        GiftMessage.Text = _OrderItem.GiftMessage;
                    }
                    //SHOW ASSETS
                    List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, _OrderItem.Product, _OrderItem.OptionList, _OrderItem.KitList, "~/Members/MyOrder.aspx?OrderNumber=" + _OrderItem.Order.OrderNumber.ToString());
                    AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
                    if (AssetsPanel.Visible)
                    {
                        AssetLinkList.DataSource = assets;
                        AssetLinkList.DataBind();
                    }

                    //SHOW SUBSCRIPTIONS
                    if (this.ShowSubscription)
                    {
                        SubscriptionPlan sp = _OrderItem.Product.SubscriptionPlan;
                        if (sp != null && _OrderItem.IsSubscription && _OrderItem.Frequency > 0)
                        {
                            // GET THE RECURRING PAYMENT MESSAGE FOR THIS PRODUCT
                            RecurringPaymentMessage.Text = ProductHelper.GetRecurringPaymentMessage(_OrderItem);
                            SubscriptionPanel.Visible    = true;
                        }
                    }
                }
                else
                {
                    ProductLink.Visible       = false;
                    ProductName.Text          = _OrderItem.Name;
                    InputList.Visible         = false;
                    KitProductPanel.Visible   = false;
                    WishlistLabel.Visible     = false;
                    ShipsToPanel.Visible      = false;
                    GiftWrapPanel.Visible     = false;
                    GiftMessagePanel.Visible  = false;
                    AssetsPanel.Visible       = false;
                    SubscriptionPanel.Visible = false;
                }
            }
            else
            {
                //NO ITEM TO DISPLAY
                this.Controls.Clear();
            }
        }
Exemple #5
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (_OrderItem != null)
            {
                string productName = _OrderItem.Name;
                if (!string.IsNullOrEmpty(_OrderItem.VariantName))
                {
                    string variantName = string.Format(" ({0})", _OrderItem.VariantName);
                    if (!productName.EndsWith(variantName))
                    {
                        productName += variantName;
                    }
                }

                Product product = _OrderItem.Product;
                if (product != null)
                {
                    if (this.LinkProducts)
                    {
                        ProductLink.NavigateUrl = "~/Admin/Products/EditProduct.aspx?ProductId=" + product.Id.ToString();
                        ProductLink.Text        = productName;
                        ProductName.Visible     = false;
                    }
                    else
                    {
                        ProductName.Text    = productName;
                        ProductLink.Visible = false;
                    }
                    //SHOW INPUTS
                    if (_OrderItem.Inputs.Count > 0)
                    {
                        InputList.DataSource = _OrderItem.Inputs;
                        InputList.DataBind();
                    }
                    else
                    {
                        InputList.Visible = false;
                    }
                    //SET THE WISHLIST LABEL
                    WishlistLabel.Visible = (_OrderItem.WishlistItem != null);
                    if (WishlistLabel.Visible)
                    {
                        //SET THE WISHLIST NAME
                        WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(_OrderItem.WishlistItem.Wishlist));
                    }
                    //SET THE SHIPS TO PANEL
                    Order         basket   = _OrderItem.Order;
                    OrderShipment shipment = _OrderItem.OrderShipment;
                    ShipsToPanel.Visible = this.ShowShipTo;
                    if (ShipsToPanel.Visible)
                    {
                        ShipsTo.Text = shipment.ShipToFullName;
                    }
                    //SHOW GIFT WRAP
                    GiftWrapPanel.Visible = (_OrderItem.WrapStyle != null);
                    if (GiftWrapPanel.Visible)
                    {
                        GiftWrap.Text         = _OrderItem.WrapStyle.Name;
                        GiftWrapPrice.Visible = (_OrderItem.WrapStyle.Price != 0);
                        GiftWrapPrice.Text    = string.Format("&nbsp;({0})", _OrderItem.WrapStyle.Price);
                    }
                    //SHOW GIFT MESSAGE
                    GiftMessagePanel.Visible = (!string.IsNullOrEmpty(_OrderItem.GiftMessage));
                    if (GiftMessagePanel.Visible)
                    {
                        GiftMessage.Text = _OrderItem.GiftMessage;
                    }
                    //SHOW ASSETS
                    List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, _OrderItem.Product, _OrderItem.OptionList, _OrderItem.KitList, "~/Members/MyOrder.aspx?OrderNumber=" + _OrderItem.Order.OrderNumber.ToString());
                    AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
                    if (AssetsPanel.Visible)
                    {
                        AssetLinkList.DataSource = assets;
                        AssetLinkList.DataBind();
                    }

                    //SHOW SUBSCRIPTIONS
                    if (this.ShowSubscription)
                    {
                        SubscriptionPlan sp = _OrderItem.Product.SubscriptionPlan;
                        if (sp != null && _OrderItem.IsSubscription && _OrderItem.Frequency > 0)
                        {
                            // GET THE RECURRING PAYMENT MESSAGE FOR THIS PRODUCT
                            RecurringPaymentMessage.Text = ProductHelper.GetRecurringPaymentMessage(_OrderItem);
                            SubscriptionPanel.Visible    = true;
                        }
                    }
                }
                else
                {
                    ProductLink.Visible      = false;
                    ProductName.Text         = productName;
                    InputList.Visible        = false;
                    WishlistLabel.Visible    = false;
                    ShipsToPanel.Visible     = false;
                    GiftWrapPanel.Visible    = false;
                    GiftMessagePanel.Visible = false;
                    AssetsPanel.Visible      = false;
                }
            }
            else
            {
                //NO ITEM TO DISPLAY
                this.Controls.Clear();
            }
        }
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (_BasketItem != null)
     {
         Product product = _BasketItem.Product;
         if (product != null)
         {
             //OUTPUT THE PRODUCT NAME
             string productName = _BasketItem.Name;
             if (_BasketItem.ProductVariant != null)
             {
                 string variantName = string.Format(" ({0})", _BasketItem.ProductVariant.VariantName);
                 if (!productName.EndsWith(variantName))
                 {
                     productName += variantName;
                 }
             }
             if (this.LinkProducts)
             {
                 //OUTPUT NAME AS LINK TO EDIT PRODUCT PAGE
                 string url  = "~/Admin/Products/EditProduct.aspx?ProductId=" + product.Id.ToString();
                 string link = string.Format("<a href=\"{0}\" target=\"_blank\">{1}</a>", Page.ResolveUrl(url), productName);
                 phProductName.Controls.Add(new LiteralControl(link));
             }
             else
             {
                 //OUTPUT NAME
                 phProductName.Controls.Add(new LiteralControl(productName));
             }
             //SHOW INPUTS
             IList <BasketItemInput> inputs = GetCustomerInputs();
             if (inputs.Count > 0)
             {
                 InputList.DataSource = inputs;
                 InputList.DataBind();
             }
             else
             {
                 InputList.Visible = false;
             }
             //SHOW KIT PRODUCTS IF AVAILABLE, AND THE PRODUCT DOES NOT USE ITEMIZED DISPLAY
             if (!string.IsNullOrEmpty(_BasketItem.KitList) && _BasketItem.Product != null && _BasketItem.Product.Kit != null && !_BasketItem.Product.Kit.ItemizeDisplay)
             {
                 IList <BasketItem> kitProductList = GetKitProducts(_BasketItem);
                 if (kitProductList.Count > 0)
                 {
                     KitProductPanel.Visible       = true;
                     KitProductRepeater.DataSource = kitProductList;
                     KitProductRepeater.DataBind();
                 }
             }
             //SET THE KIT MEMBER LABEL
             if (_BasketItem.OrderItemType == OrderItemType.Product && _BasketItem.IsChildItem)
             {
                 BasketItem parentItem = _BasketItem.GetParentItem(true);
                 if (parentItem != null && parentItem.Product != null && parentItem.Product.Kit != null && parentItem.Product.Kit.ItemizeDisplay)
                 {
                     //SET THE WISHLIST NAME
                     KitMemberLabel.Visible = true;
                     KitMemberLabel.Text    = string.Format(KitMemberLabel.Text, parentItem.Name);
                 }
             }
             //SET THE WISHLIST LABEL
             WishlistLabel.Visible = (_BasketItem.WishlistItem != null);
             if (WishlistLabel.Visible)
             {
                 //SET THE WISHLIST NAME
                 WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(_BasketItem.WishlistItem.Wishlist));
             }
             //SET THE SHIPS TO PANEL
             Basket         basket   = _BasketItem.Basket;
             BasketShipment shipment = _BasketItem.Shipment;
             Address        address  = (shipment == null) ? null : shipment.Address;
             ShipsToPanel.Visible = (this.ShowShipTo && (address != null) && (!string.IsNullOrEmpty(address.FullName)));
             if (ShipsToPanel.Visible)
             {
                 ShipsTo.Text = address.FullName;
             }
             //SHOW GIFT WRAP
             GiftWrapPanel.Visible = (_BasketItem.WrapStyle != null);
             if (GiftWrapPanel.Visible)
             {
                 GiftWrap.Text = _BasketItem.WrapStyle.Name;
                 //GiftWrapPrice.Visible = (_BasketItem.WrapStyle.Price != 0);
                 //GiftWrapPrice.Text = string.Format("&nbsp;({0})", _BasketItem.WrapStyle.Price);
             }
             //SHOW GIFT MESSAGE
             GiftMessagePanel.Visible = (!string.IsNullOrEmpty(_BasketItem.GiftMessage));
             if (GiftMessagePanel.Visible)
             {
                 GiftMessage.Text = _BasketItem.GiftMessage;
             }
             //SHOW ASSETS
             List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, _BasketItem.Product, _BasketItem.OptionList, _BasketItem.KitList, "javascript:window.close()");
             AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
             if (AssetsPanel.Visible)
             {
                 AssetLinkList.DataSource = assets;
                 AssetLinkList.DataBind();
             }
             //SHOW SUBSCRIPTIONS
             SubscriptionPlan sp = _BasketItem.Product.SubscriptionPlan;
             if (sp != null && _BasketItem.IsSubscription && _BasketItem.Frequency > 0)
             {
                 // GET THE RECURRING PAYMENT MESSAGE FOR THIS PRODUCT
                 RecuringPaymentMessage.Text = AbleCommerce.Code.ProductHelper.GetRecurringPaymentMessage(_BasketItem);
                 SubscriptionPanel.Visible   = true;
             }
         }
         else
         {
             //OUTPUT NAME
             phProductName.Controls.Add(new LiteralControl(_BasketItem.Name));
             InputList.Visible         = false;
             KitProductPanel.Visible   = false;
             WishlistLabel.Visible     = false;
             ShipsToPanel.Visible      = false;
             GiftWrapPanel.Visible     = false;
             GiftMessagePanel.Visible  = false;
             AssetsPanel.Visible       = false;
             SubscriptionPanel.Visible = false;
         }
     }
     else
     {
         //NO ITEM TO DISPLAY
         this.Controls.Clear();
     }
 }
Exemple #7
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            BasketItem basketItem = BasketItemDataSource.Load(this.BasketItemId);

            if (basketItem != null)
            {
                Product product = basketItem.Product;
                if (product != null)
                {
                    //OUTPUT THE PRODUCT NAME
                    string productName = basketItem.Name;
                    if (basketItem.ProductVariant != null)
                    {
                        string variantName = string.Format(" ({0})", basketItem.ProductVariant.VariantName);
                        if (!productName.EndsWith(variantName))
                        {
                            productName += variantName;
                        }
                    }
                    if (this.LinkProducts && product.Visibility != CatalogVisibility.Private)
                    {
                        //OUTPUT NAME AS LINK
                        string url = UrlGenerator.GetBrowseUrl(product.Id, CatalogNodeType.Product, product.Name);
                        if (!string.IsNullOrEmpty(basketItem.KitList) && !string.IsNullOrEmpty(basketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Kits={2}&Options={3}\">{4}</a>", Page.ResolveUrl(url), basketItem.Id, basketItem.KitList, basketItem.OptionList.Replace(",0", string.Empty), productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else if (!string.IsNullOrEmpty(basketItem.KitList) && string.IsNullOrEmpty(basketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Kits={2}\">{3}</a>", Page.ResolveUrl(url), basketItem.Id, basketItem.KitList, productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else if (string.IsNullOrEmpty(basketItem.KitList) && !string.IsNullOrEmpty(basketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Options={2}\">{3}</a>", Page.ResolveUrl(url), basketItem.Id, basketItem.OptionList.Replace(",0", string.Empty), productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}\">{2}</a>", Page.ResolveUrl(url), basketItem.Id, productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                    }
                    else
                    {
                        //OUTPUT NAME
                        phProductName.Controls.Add(new LiteralControl(productName));
                    }

                    if (EnableFriendlyFormat)
                    {
                        phProductName.Controls.AddAt(0, new LiteralControl(string.Format("{0} of ", basketItem.Quantity)));
                        phProductName.Controls.Add(new LiteralControl(string.Format("<span class='price'>({0})</span>", basketItem.Price.LSCurrencyFormat("ulc"))));
                    }

                    //SHOW INPUTS
                    IList <BasketItemInput> inputs = GetCustomerInputs(basketItem);
                    if (inputs.Count > 0)
                    {
                        InputList.DataSource = inputs;
                        InputList.DataBind();
                    }
                    else
                    {
                        InputList.Visible = false;
                    }
                    //SHOW KIT PRODUCTS IF AVAILABLE, AND THE PRODUCT DOES NOT USE ITEMIZED DISPLAY OR FORCE KIT DISPLAY IS ON
                    if (!string.IsNullOrEmpty(basketItem.KitList) && basketItem.Product != null &&
                        basketItem.Product.Kit != null && (!basketItem.Product.Kit.ItemizeDisplay || this.ForceKitDisplay))
                    {
                        IList <BasketItem> kitProductList = GetKitProducts(basketItem, this.IgnoreKitShipment);
                        if (kitProductList.Count > 0)
                        {
                            KitProductPanel.Visible       = true;
                            KitProductRepeater.DataSource = kitProductList;
                            KitProductRepeater.DataBind();
                        }
                    }
                    //SET THE KIT MEMBER LABEL
                    if (basketItem.OrderItemType == OrderItemType.Product && basketItem.IsChildItem)
                    {
                        BasketItem parentItem = basketItem.GetParentItem(true);
                        if (parentItem != null)
                        {
                            if ((parentItem.Product != null && basketItem.Product.Kit != null && parentItem.Product.Kit.ItemizeDisplay) ||
                                basketItem.ShipmentId != parentItem.ShipmentId)
                            {
                                //SET THE WISHLIST NAME
                                KitMemberLabel.Visible = true;
                                KitMemberLabel.Text    = string.Format(KitMemberLabel.Text, parentItem.Name);
                            }
                        }
                    }
                    //SET THE WISHLIST LABEL
                    WishlistLabel.Visible = (basketItem.WishlistItem != null);
                    if (WishlistLabel.Visible)
                    {
                        //SET THE WISHLIST NAME
                        WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(basketItem.WishlistItem.Wishlist));
                    }
                    //SET THE SHIPS TO PANEL
                    Basket         basket   = basketItem.Basket;
                    BasketShipment shipment = basketItem.Shipment;
                    Address        address  = (shipment == null) ? null : shipment.Address;
                    ShipsToPanel.Visible = (this.ShowShipTo && (address != null) && (!string.IsNullOrEmpty(address.FullName)));
                    if (ShipsToPanel.Visible)
                    {
                        ShipsTo.Text = address.FullName;
                    }
                    //SHOW GIFT WRAP
                    GiftWrapPanel.Visible = (basketItem.WrapStyle != null);
                    if (GiftWrapPanel.Visible)
                    {
                        GiftWrap.Text         = basketItem.WrapStyle.Name;
                        GiftWrapPrice.Visible = (basketItem.WrapStyle.Price != 0);
                        GiftWrapPrice.Text    = string.Format("&nbsp;({0})", basketItem.WrapStyle.Price.LSCurrencyFormat("ulc"));
                    }
                    //SHOW GIFT MESSAGE
                    GiftMessagePanel.Visible = (!string.IsNullOrEmpty(basketItem.GiftMessage));
                    if (GiftMessagePanel.Visible)
                    {
                        GiftMessage.Text = basketItem.GiftMessage;
                    }
                    //SHOW ASSETS
                    List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, basketItem.Product, basketItem.OptionList, basketItem.KitList, "javascript:window.close()");
                    AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
                    if (AssetsPanel.Visible)
                    {
                        AssetLinkList.DataSource = assets;
                        AssetLinkList.DataBind();
                    }
                    //SHOW SUBSCRIPTIONS
                    if (this.ShowSubscription)
                    {
                        SubscriptionPlan sp = basketItem.Product.SubscriptionPlan;
                        if (sp != null && basketItem.IsSubscription && basketItem.Frequency > 0)
                        {
                            // GET THE RECURRING PAYMENT MESSAGE FOR THIS PRODUCT
                            RecurringPaymentMessage.Text = AbleCommerce.Code.ProductHelper.GetRecurringPaymentMessage(basketItem);
                            SubscriptionPanel.Visible    = true;
                        }
                    }
                }
                else
                {
                    //OUTPUT NAME
                    phProductName.Controls.Add(new LiteralControl(basketItem.Name));
                    InputList.Visible         = false;
                    KitProductPanel.Visible   = false;
                    WishlistLabel.Visible     = false;
                    ShipsToPanel.Visible      = false;
                    GiftWrapPanel.Visible     = false;
                    GiftMessagePanel.Visible  = false;
                    AssetsPanel.Visible       = false;
                    SubscriptionPanel.Visible = false;
                }
            }
            else
            {
                //NO ITEM TO DISPLAY
                this.Controls.Clear();
            }
        }
Exemple #8
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            _BasketItem = BasketItemDataSource.Load(BasketItemId);
            if (_BasketItem != null)
            {
                Product product = _BasketItem.Product;
                if (product != null)
                {
                    //OUTPUT THE PRODUCT NAME
                    string productName = product.Name;
                    if (_BasketItem.ProductVariant != null)
                    {
                        productName += string.Format(" ({0})", _BasketItem.ProductVariant.VariantName);
                    }
                    if (this.LinkProducts)
                    {
                        //OUTPUT NAME AS LINK
                        string url = UrlGenerator.GetBrowseUrl(product.Id, CatalogNodeType.Product, product.Name);
                        if (!string.IsNullOrEmpty(_BasketItem.KitList) && !string.IsNullOrEmpty(_BasketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Kits={2}&Options={3} \">{4}</a>", Page.ResolveUrl(url), _BasketItem.Id, _BasketItem.KitList, _BasketItem.OptionList.Replace(",0", string.Empty), productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else if (!string.IsNullOrEmpty(_BasketItem.KitList) && string.IsNullOrEmpty(_BasketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Kits={2}\">{3}</a>", Page.ResolveUrl(url), _BasketItem.Id, _BasketItem.KitList, productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else if (string.IsNullOrEmpty(_BasketItem.KitList) && !string.IsNullOrEmpty(_BasketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Options={2}\">{3}</a>", Page.ResolveUrl(url), _BasketItem.Id, _BasketItem.OptionList.Replace(",0", string.Empty), productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}\">{2}</a>", Page.ResolveUrl(url), _BasketItem.Id, productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                    }
                    else
                    {
                        //OUTPUT NAME
                        phProductName.Controls.Add(new LiteralControl(productName));
                    }
                    //SHOW INPUTS
                    IList <BasketItemInput> inputs = GetCustomerInputs();
                    if (inputs.Count > 0)
                    {
                        InputList.DataSource = inputs;
                        InputList.DataBind();
                    }
                    else
                    {
                        InputList.Visible = false;
                    }
                    //SHOW KIT PRODUCTS
                    IList <BasketItem> kitProductList = GetKitProducts(_BasketItem);
                    KitProductPanel.Visible = (kitProductList.Count > 0 && _BasketItem.Product.Kit != null && !_BasketItem.Product.Kit.ItemizeDisplay);
                    if (KitProductPanel.Visible)
                    {
                        KitProductRepeater.DataSource = kitProductList;
                        KitProductRepeater.DataBind();
                    }
                    //SET THE WISHLIST LABEL
                    WishlistLabel.Visible = (_BasketItem.WishlistItem != null);
                    if (WishlistLabel.Visible)
                    {
                        //SET THE WISHLIST NAME
                        WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(_BasketItem.WishlistItem.Wishlist));
                    }
                    //SET THE SHIPS TO PANEL
                    Basket basket = _BasketItem.Basket;

                    //SHOW ASSETS
                    List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, _BasketItem.Product, _BasketItem.OptionList, _BasketItem.KitList, "javascript:window.close()");
                    AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
                    if (AssetsPanel.Visible)
                    {
                        AssetLinkList.DataSource = assets;
                        AssetLinkList.DataBind();
                    }
                    //SHOW SUBSCRIPTIONS
                    SubscriptionPlan sp = _BasketItem.Product.SubscriptionPlan;
                    SubscriptionPanel.Visible = (this.ShowSubscription && _BasketItem.IsSubscription);
                    if (SubscriptionPanel.Visible)
                    {
                        InitialPayment.Visible = (sp.RecurringChargeSpecified);
                        if (InitialPayment.Visible)
                        {
                            InitialPayment.Text = string.Format(InitialPayment.Text, _BasketItem.Price.LSCurrencyFormat("ulc"));
                        }
                        string period;
                        if (_BasketItem.Frequency > 1)
                        {
                            period = _BasketItem.Frequency + " " + _BasketItem.FrequencyUnit.ToString().ToLowerInvariant() + "s";
                        }
                        else
                        {
                            period = _BasketItem.FrequencyUnit.ToString().ToLowerInvariant();
                        }
                        int numPayments = (sp.RecurringChargeSpecified ? sp.NumberOfPayments - 1 : sp.NumberOfPayments);
                        if (sp.NumberOfPayments == 0)
                        {
                            RecurringPayment.Text = string.Format("Recurring Payment: {0}, every {1} until canceled", sp.CalculateRecurringCharge(_BasketItem.Price).LSCurrencyFormat("ulc"), period);
                        }
                        else
                        {
                            RecurringPayment.Text = string.Format(RecurringPayment.Text, numPayments, sp.CalculateRecurringCharge(_BasketItem.Price).LSCurrencyFormat("ulc"), period);
                        }
                    }
                }
                else
                {
                    //OUTPUT NAME
                    phProductName.Controls.Add(new LiteralControl(_BasketItem.Name));
                    InputList.Visible         = false;
                    KitProductPanel.Visible   = false;
                    WishlistLabel.Visible     = false;
                    AssetsPanel.Visible       = false;
                    SubscriptionPanel.Visible = false;
                }
            }
            else
            {
                //NO ITEM TO DISPLAY
                this.Controls.Clear();
            }
        }