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());
                    }
                }
            }
        }
    }
    /// <summary>
    /// Returns the public SKU status display name.
    /// </summary>
    /// <param name="parameters">Status ID</param>
    public static object GetPublicStatusName(params object[] parameters)
    {
        switch (parameters.Length)
        {
        case 1:
            return(EcommerceFunctions.GetPublicStatus(parameters[0], "SKUPublicStatusID"));

        default:
            throw new NotSupportedException();
        }
    }
Example #4
0
    /// <summary>
    /// Returns URL to the wish list.
    /// </summary>
    /// <param name="parameters">Site name</param>
    public static object WishlistURL(params object[] parameters)
    {
        switch (parameters.Length)
        {
        case 1:
            return(EcommerceFunctions.WishlistURL(ValidationHelper.GetString(parameters[0], "")));

        default:
            throw new NotSupportedException();
        }
    }
Example #5
0
    /// <summary>
    /// Returns link to remove specified product from the user's wishlist.
    /// </summary>
    /// <param name="parameters">Product ID</param>
    public static object GetRemoveFromWishListLink(params object[] parameters)
    {
        switch (parameters.Length)
        {
        case 1:
            return(EcommerceFunctions.GetRemoveFromWishListLink(parameters[0]));

        default:
            throw new NotSupportedException();
        }
    }
Example #6
0
    /// <summary>
    /// Returns user friendly URL of the specified SKU and site name.
    /// </summary>
    /// <param name="parameters">SKU ID</param>
    public static object GetProductUrl(params object[] parameters)
    {
        switch (parameters.Length)
        {
        case 1:
            return(EcommerceFunctions.GetProductUrl(parameters[0]));

        default:
            throw new NotSupportedException();
        }
    }
Example #7
0
    /// <summary>
    /// Gets object from the specified column of the public status with specific ID.
    /// </summary>
    /// <param name="parameters">Public status ID; Column name</param>
    public static object GetPublicStatus(params object[] parameters)
    {
        switch (parameters.Length)
        {
        case 2:
            return(EcommerceFunctions.GetPublicStatus(parameters[0], ValidationHelper.GetString(parameters[1], "")));

        default:
            throw new NotSupportedException();
        }
    }
Example #8
0
    /// <summary>
    /// Gets document name of specified nodeid.
    /// </summary>
    /// <param name="parameters">Document node ID</param>
    public static string GetDocumentName(params object[] parameters)
    {
        switch (parameters.Length)
        {
        case 1:
            return(EcommerceFunctions.GetDocumentName(parameters[0]));

        default:
            throw new NotSupportedException();
        }
    }
Example #9
0
    /// <summary>
    /// Returns link to "add to shoppingcart".
    /// </summary>
    /// <param name="parameters">Product ID; Indicates whether product is enabled or not</param>
    public static object GetAddToShoppingCartLink(params object[] parameters)
    {
        switch (parameters.Length)
        {
        case 1:
            return(EcommerceFunctions.GetAddToShoppingCartLink(parameters[0]));

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

        default:
            throw new NotSupportedException();
        }
    }
    protected double GetFormatedPrice(object skuid, object price)
    {
        SKUInfo sku    = SKUInfoProvider.GetSKUInfo((int)skuid);
        string  res    = string.Empty;
        double  result = 0;

        if (sku != null)
        {
            res    = EcommerceFunctions.GetFormatedPrice(GetPriceWithDiscount(skuid, price), sku.SKUDepartmentID, sku.SKUID);
            res    = res.Substring(0, res.Length - 1);
            result = double.Parse(res);
        }
        return(System.Math.Round(result, 2));
    }
    /// <summary>
    /// Returns complete 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; Width of image; Height of image)</param>
    public static object GetProductImage(params object[] parameters)
    {
        string img = "<img src=\"{0}\" alt=\"{1}\" />";

        switch (parameters.Length)
        {
        case 2:
            return(string.Format(img, EcommerceFunctions.GetSKUImageUrl(parameters[0], 0, 0, 0, 0), parameters[1]));

        case 3:
            return(string.Format(img, EcommerceFunctions.GetSKUImageUrl(parameters[0], 0, 0, parameters[2], 0), parameters[1]));

        case 4:
            return(string.Format(img, EcommerceFunctions.GetSKUImageUrl(parameters[0], parameters[2], parameters[3], 0, 0), parameters[1]));

        default:
            throw new NotSupportedException();
        }
    }
Example #12
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();
        }
    }
 /// <summary>
 /// Returns amount of saved money based on the difference between product seller price and product list price.
 /// </summary>
 /// <param name="discounts">Indicates if discounts should be applied to the seller price before the saved amount is calculated</param>
 /// <param name="taxes">Indicates if taxes should be applied to both list price and seller price before the saved amount is calculated</param>
 /// <param name="column1">Name of the column from which the seller price is retrieved, if empty SKUPrice column is used</param>
 /// <param name="column2">Name of the column from which the list price is retrieved, if empty SKURetailPrice column is used</param>
 /// <param name="percentage">True - result is percentage, False - result is in the current currency</param>
 public double GetSKUPriceSaving(bool discounts, bool taxes, string column1, string column2, bool percentage)
 {
     return(EcommerceFunctions.GetSKUPriceSaving(SKU, discounts, taxes, column1, column2, percentage));
 }
 /// <summary>
 /// Returns value of the specified product public status column.
 /// If the product is evaluated as a new product in the store, public status set by 'CMSStoreNewProductStatus' setting is used, otherwise product public status is used.
 /// </summary>
 /// <param name="column">Name of the product public status column the value should be retrieved from</param>
 public object GetSKUIndicatorProperty(string column)
 {
     return(EcommerceFunctions.GetSKUIndicatorProperty(SKU, column));
 }
 /// <summary>
 /// Returns SKU permanent URL.
 /// </summary>
 public string GetSKUUrl()
 {
     return(EcommerceFunctions.GetProductUrl(Eval("SKUGuid"), EvalText("SKUName", true)));
 }
 /// <summary>
 /// Returns SKU image URL including dimension's modifiers (width, height) and site name parameter if product is from different site than current.
 /// If image URL is not specified, SKU default image URL is used.
 /// </summary>
 /// <param name="width">Image requested width</param>
 /// <param name="height">Image requested height</param>
 public string GetSKUImageUrl(int width, int height)
 {
     return(EcommerceFunctions.GetSKUImageUrl(Eval("SKUImagePath"), width, height, 0, Eval("SKUSiteID")));
 }
 /// <summary>
 /// Returns SKU image URL including dimension's modifiers (width, height) and site name parameter if product is from different site than current.
 /// If image URL is not specified, SKU default image URL is used.
 /// </summary>
 /// <param name="maxsidesize">Image requested maximum side size</param>
 public string GetSKUImageUrl(int maxSideSize)
 {
     return(EcommerceFunctions.GetSKUImageUrl(Eval("SKUImagePath"), 0, 0, maxSideSize, Eval("SKUSiteID")));
 }