/// <summary> /// Returns catalogue price of the given product based on the SKU data and shopping cart data. /// By default price is loaded from the SKUPrice field. /// </summary> /// <param name="sku">SKU dta</param> /// <param name="cart">Shopping cart data</param> protected override double GetSKUPriceInternal(SKUInfo sku, ShoppingCartInfo cart) { double price = 0; // 1) Get base SKU price according to the shopping cart data (current culture) if (cart != null) { switch (cart.ShoppingCartCulture.ToLower()) { case "en-us": // Get price form SKUEnUsPrice field price = ValidationHelper.GetDouble(sku.GetValue("SKUEnUsPrice"), 0); break; case "cs-cz": // Get price form SKUCsCzPrice field price = ValidationHelper.GetDouble(sku.GetValue("SKUCsCzPrice"), 0); break; } } //// 2) Get base SKU price according to the product properties (product status) //PublicStatusInfo status = PublicStatusInfoProvider.GetPublicStatusInfo(sku.SKUPublicStatusID); //if ((status != null) && (status.PublicStatusName.ToLower() == "discounted")) //{ // // Get price form SKUDiscountedPrice field // price = ValidationHelper.GetDouble(sku.GetValue("SKUDiscountedPrice"), 0); //} if (price == 0) { // Get price from the SKUPrice field by default return base.GetSKUPriceInternal(sku, cart); } else { // Return custom price return price; } }
/// <summary> /// Returns catalogue price of the given product based on the SKU data and shopping cart data. /// By default price is loaded from the SKUPrice field. /// </summary> /// <param name="sku">SKU dta</param> /// <param name="cart">Shopping cart data</param> protected override double GetSKUPriceInternal(SKUInfo sku, ShoppingCartInfo cart) { double price = 0; // 1) Get base SKU price according to the shopping cart data (current culture) if (cart != null) { switch (cart.ShoppingCartCulture.ToLower()) { case "en-us": // Get price form SKUEnUsPrice field price = ValidationHelper.GetDouble(sku.GetValue("SKUEnUsPrice"), 0); break; case "cs-cz": // Get price form SKUCsCzPrice field price = ValidationHelper.GetDouble(sku.GetValue("SKUCsCzPrice"), 0); break; } } //// 2) Get base SKU price according to the product properties (product status) //PublicStatusInfo status = PublicStatusInfoProvider.GetPublicStatusInfo(sku.SKUPublicStatusID); //if ((status != null) && (status.PublicStatusName.ToLower() == "discounted")) //{ // // Get price form SKUDiscountedPrice field // price = ValidationHelper.GetDouble(sku.GetValue("SKUDiscountedPrice"), 0); //} if (price == 0) { // Get price from the SKUPrice field by default return(base.GetSKUPriceInternal(sku, cart)); } else { // Return custom price return(price); } }
private void BindData() { if (ECommerceContext.CurrentShoppingCart != null) { // ECommerceContext.CurrentShoppingCart.Update(); var panier = ECommerceContext.CurrentShoppingCart; if (panier != null) { List <ProductItem> items = new List <ProductItem>(); foreach (DataRow row in panier.ContentTable.Rows) { var item = new ProductItem { ID = (int)row["SKUID"], Nom = (string)row["SKUName"], Qte = int.Parse(row["Units"].ToString()), }; // item.SetPrixTotal(); SKUInfo sku = SKUInfoProvider.GetSKUInfo(item.ID); var type = sku.GetValue("SKUType"); if (type == null) { item.Qte = item.Qte; } else if (type != null && !String.IsNullOrEmpty(type.ToString()) && Convert.ToInt32(type) == 1) { item.Qte = item.Qte; } items.Add(item); } List <NombreItem> data = new List <NombreItem>(); data.Add(new NombreItem { NumberOfItem = ECommerceContext.CurrentShoppingCart.CartItems.Count }); rptNombre.DataSource = data; rptNombre.DataBind(); } } }
protected int GetProductQuantity(object skuid, object quantity) { SKUInfo sku = SKUInfoProvider.GetSKUInfo((int)skuid); var type = sku.GetValue("SKUType"); var qte = Convert.ToInt32(quantity); if (type == null) { return(qte); } if (Convert.ToInt32(type) == 1) { return(qte); } return(qte); }
/// <summary> /// Set the field with the record which user wants to edit /// </summary> /// <param name="productid">The id of the product which user wants to edit</param> private void SetFeild(int productID) { try { if (productID != 0) { CampaignsProduct product = CampaignsProductProvider.GetCampaignsProducts() .WhereEquals("NodeSiteID", CurrentSite.SiteID) .WhereEquals("CampaignsProductID", productID) .FirstOrDefault(); if (product != null) { SKUInfo skuDetails = SKUInfoProvider.GetSKUs() .WhereEquals("SKUID", product.NodeSKUID) .FirstObject; if (skuDetails != null) { string folderName = libraryFolderName; folderName = !string.IsNullOrEmpty(folderName) ? folderName.Replace(" ", "") : "InventoryProducts"; txtLongDes.Text = skuDetails.SKUDescription; txtEstPrice.Text = ValidationHelper.GetString(product.EstimatedPrice, string.Empty); ddlPosNo.Items.Add(new ListItem(ValidationHelper.GetString(skuDetails.GetValue("SKUProductCustomerReferenceNumber", string.Empty), string.Empty), ValidationHelper.GetString(skuDetails.GetValue("SKUProductCustomerReferenceNumber", string.Empty), string.Empty))); ddlPosNo.Enabled = false; txtShortDes.Text = skuDetails.SKUName; txtActualPrice.Text = ValidationHelper.GetString(skuDetails.SKUPrice, string.Empty); ddlStatus.SelectedValue = skuDetails.SKUEnabled == true ? "1" : "0"; imgProduct.ImageUrl = ValidationHelper.GetString(skuDetails.SKUImagePath, string.Empty); imgProduct.Visible = imgProduct.ImageUrl != string.Empty ? true : false; if (skuDetails.SKUValidUntil != DateTime.MinValue) { txtExpDate.Text = ValidationHelper.GetString(skuDetails.SKUValidUntil.ToShortDateString(), string.Empty); } txtQuantity.Text = ValidationHelper.GetString(skuDetails.SKUAvailableItems, string.Empty); txtWeight.Text = ValidationHelper.GetString(skuDetails.SKUWeight, string.Empty); } txtBundleQnt.Text = ValidationHelper.GetString(product.QtyPerPack, string.Empty); ddlBrand.SelectedValue = ValidationHelper.GetString(product.BrandID, string.Empty); ddlState.SelectedValue = ValidationHelper.GetString(product.State, string.Empty); ddlProdCategory.SelectedValue = ValidationHelper.GetString(product.CategoryID, string.Empty); BindEditProduct(ValidationHelper.GetInteger(product.CampaignsProductID, 0)); } } } catch (Exception ex) { EventLogProvider.LogException("GetProductFromButtonClick", "EXCEPTION", ex); } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (!this.StopProcessing) { try { if (!IsPostBack) { BindPrograms(); BindCategories(); BindResorceStrings(); BindPOS(); GetStateGroup(); GetBrandName(); BindItemSpecsDropdown(); int productID = ValidationHelper.GetInteger(Request.QueryString["id"], 0); if (productID != 0) { CampaignsProduct product = CampaignsProductProvider .GetCampaignsProducts() .WhereEquals("NodeSiteID", CurrentSite.SiteID) .WhereEquals("CampaignsProductID", productID) .FirstOrDefault(); if (product != null) { SKUInfo skuDetails = SKUInfoProvider .GetSKUs() .WhereEquals("SKUID", product.NodeSKUID) .FirstObject; if (skuDetails != null) { string folderName = SettingsKeyInfoProvider.GetValue(CurrentSite.SiteName + ".KDA_ImagesFolderName"); folderName = !string.IsNullOrEmpty(folderName) ? folderName.Replace(" ", "") : "CampaignProducts"; txtLongDescription.Text = skuDetails.SKUDescription; ddlPos.SelectedValue = ValidationHelper.GetString(skuDetails.GetValue("SKUProductCustomerReferenceNumber", string.Empty), string.Empty); ddlPos.Enabled = false; txtProductName.Text = skuDetails.SKUName; txtActualPrice.Text = ValidationHelper.GetString(skuDetails.SKUPrice, string.Empty); ddlStatus.SelectedValue = skuDetails.SKUEnabled == true ? "1" : "0"; imgProduct.ImageUrl = ValidationHelper.GetString(skuDetails.SKUImagePath, string.Empty); imgProduct.Visible = imgProduct.ImageUrl != string.Empty ? true : false; if (skuDetails.SKUValidUntil != DateTime.MinValue) { txtExpireDate.Text = ValidationHelper.GetString(skuDetails.SKUValidUntil.ToShortDateString(), string.Empty); } } ddlProgram.SelectedValue = ValidationHelper.GetString(product.ProgramID, string.Empty); ddlProgram.Enabled = false; ddlState.SelectedValue = ValidationHelper.GetString(product.State, string.Empty); ddlBrand.SelectedValue = product.BrandID.ToString(); txtEstimatedprice.Text = ValidationHelper.GetString(product.EstimatedPrice, string.Empty); ddlProductcategory.SelectedValue = product.CategoryID.ToString(); txtQty.Text = ValidationHelper.GetString(product.QtyPerPack, string.Empty); if (!string.IsNullOrEmpty(product.CustomItemSpecs)) { txtItemSpec.Text = ValidationHelper.GetString(product.CustomItemSpecs, string.Empty); ddlItemSpecs.SelectedValue = ValidationHelper.GetString(ResHelper.GetString("Kadena.CampaignProduct.ItemSpecsOtherText"), string.Empty); divItemSpecs.Visible = true; } else { ddlItemSpecs.SelectedValue = ValidationHelper.GetString(product.ItemSpecs, string.Empty); } ViewState["ProgramID"] = product.ProgramID; ViewState["ProductNodeID"] = product.NodeID; btnSave.Visible = false; btnUpdate.Visible = true; } } else { btnSave.Visible = true; btnUpdate.Visible = false; } string currentDate = DateTime.Today.ToShortDateString(); compareDate.ValueToCompare = currentDate; } } catch (Exception ex) { EventLogProvider.LogException("CMSWebParts_Kadena_Campaign_Web_Form_AddCampaignProducts", "SetupControl", ex, CurrentSite.SiteID, ex.Message); } } }