protected string GetProductImage(object skuid)
    {
        SKUInfo sku = SKUInfoProvider.GetSKUInfo((int)skuid);

        if (sku != null)
        {
            GeneralConnection cn          = ConnectionHelper.GetConnection();
            string            stringQuery = string.Format("select DISTINCT DispositionImage as Disp from View_CONTENT_Product_Joined where NodeSKUID = " + sku.SKUID);
            DataSet           ds          = cn.ExecuteQuery(stringQuery, null, CMS.SettingsProvider.QueryTypeEnum.SQLQuery, false);
            string            Disp        = Convert.ToString(ds.Tables[0].Rows[0]["Disp"]);
            string            Divclass    = string.Empty;
            string            Image       = string.Empty;
            if (Disp == "1")
            {
                return("<div class=\"produit_vertical\">" + EcommerceFunctions.GetProductImage(sku.SKUImagePath, sku.SKUName) + "</div>");
            }
            else if (Disp == "2")
            {
                return("<div class=\"produit_horizonal\">" + EcommerceFunctions.GetProductImage(sku.SKUImagePath, sku.SKUName) + "</div>");
            }
            else
            {
                return("<div class=\"produit_horizonal\">" + EcommerceFunctions.GetProductImage(sku.SKUImagePath, sku.SKUName) + "</div>");
            }
        }
        return(String.Empty);
    }
    protected void RptCartItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        var drv = (System.Data.DataRowView)e.Item.DataItem;

        if (drv != null)
        {
            int currentSKUID = ValidationHelper.GetInteger(drv["SKUID"], 0);
            if (currentSKUID > 0)
            {
                SKUInfo sku = SKUInfoProvider.GetSKUInfo(currentSKUID);
                if (sku != null)
                {
                    int    subTotal = 0;
                    double remise   = 0;
                    //Display product image
                    var ltlProductImage = e.Item.FindControl("ltlProductImage") as Literal;
                    if (ltlProductImage != null)
                    {
                        //<%--# EcommerceFunctions.GetProductImage(Eval("SKUImagePath"), Eval("SKUName"))--%>
                        ltlProductImage.Text = EcommerceFunctions.GetProductImage(sku.SKUImagePath, sku.SKUName);
                    }

                    var ltlProductName = e.Item.FindControl("ltlProductName") as Literal;
                    if (ltlProductName != null)
                    {
                        ltlProductName.Text = sku.SKUName;
                    }

                    var txtProductCount = e.Item.FindControl("txtProductCount") as TextBox;
                    if (txtProductCount != null)
                    {
                        foreach (ShoppingCartItemInfo shoppingCartItem in ShoppingCart.CartItems)
                        {
                            if (shoppingCartItem.SKUID == sku.SKUID)
                            {
                                remise = shoppingCartItem.UnitTotalDiscount;
                                txtProductCount.Text = shoppingCartItem.CartItemUnits.ToString();
                                subTotal             = shoppingCartItem.CartItemUnits;
                                break;
                            }
                        }
                    }

                    var ltlProductPrice = e.Item.FindControl("ltlProductPrice") as Literal;
                    if (ltlProductPrice != null)
                    {
                        //ltlProductPrice.Text = (sku.SKUPrice * subTotal).ToString();
                        ltlProductPrice.Text = EcommerceFunctions.GetFormatedPrice((sku.SKUPrice - remise) * subTotal, sku.SKUDepartmentID, sku.SKUID);

                        //ltlProductPrice.Text = string.Format("{0} <em>�</em>", CurrencyInfoProvider.GetFormattedValue(sku.SKUPrice * subTotal, ShoppingCart.Currency).ToString());
                        ltlProductPrice.Text = string.Format("{0}<em>{1}</em>", ltlProductPrice.Text.Substring(0, ltlProductPrice.Text.Length - 1).Trim(), ltlProductPrice.Text.Substring(ltlProductPrice.Text.Length - 1, 1).Trim());
                    }
                }
            }
        }
    }
Example #3
0
    /// <summary>
    /// Returns complet HTML code of the specified resized product image, if not such image exists, default image is returned.
    /// </summary>
    /// <param name="parameters">
    /// (Product image url; Image alternate text) OR
    /// (Product image url; Image alternate text; Max side size) OR
    /// (Product image url; Image alternate text; Max side size; Width of image; Height of image)</param>
    public static object GetProductImage(params object[] parameters)
    {
        switch (parameters.Length)
        {
        case 2:
            return(EcommerceFunctions.GetProductImage(parameters[0], parameters[1]));

        case 3:
            return(EcommerceFunctions.GetProductImage(parameters[0], parameters[1], parameters[2]));

        case 5:
            if (ValidationHelper.GetInteger(parameters[2], 0) > 0)
            {
                return(EcommerceFunctions.GetProductImage(parameters[0], parameters[2], parameters[1]));
            }
            else
            {
                return(EcommerceFunctions.GetProductImage(parameters[0], parameters[2], parameters[3], parameters[1]));
            }

        default:
            throw new NotSupportedException();
        }
    }