Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStore"Add to Cart" and the "Buy now" Image buttons localization"Add to Cart" and the "Buy now" Image buttons localization
Previous
 
Next
New Post
8/28/2007 4:21 AM
 

Hi to all,

while trying to localize the Store module, i have noticed that the "Add to Cart" and the "Buy now" Image buttons need some work to be localized.

The files are located under DotNetNuke_2\Website\DesktopModules\WWStore\Templates\Images ('addtocartimg.gif' and 'purchaseimg.gif').

In order to localize it, first of all, i create 2 .gif image files for each language ('addtocartimg<languageID>.gif ' and <purchaseimg<languageID>.gif), and add them to the project (under the same ..\Images folder).

After that, i add a new string resource 'AddToCartImage.Text' inside each 'ProductDetail.ascx.<languageID>.resx' language resource file. The 'AddToCartImage.Text', contains the image file name that should be used for each language selected (('addtocartimg<languageID>.gif ' and <purchaseimg<languageID>.gif)).


Inside the 'ProductDetail.ascx.cs' code behind file, i modify the code, in order for the ImageButtons.ImageUrl path, to be retrieved from the local resources file instead of the hard coded 'addtocartimg.gif' or 'purchaseimg.gif' values.

The result is that the .gif image files that i have created are not loaded correctly and as a result, are not displayed on the control. When setting the ImageButtons.ImageUrl path to an existing image file inside the Images folder, the image file is displayed correctly and this is the proof that the code works as expected.But, when using .gif files that I have created, or some other .gif files from external resources they are not displayed either.

Any thoughts?

thanx in advance

 
New Post
8/28/2007 9:09 AM
 

Hi Dimitris,

Stttoooooooppppppp!!!!!

You'r right, the templating system is not completely finished, but your need had been envisaged! I missed just a little of time to finish certain parts. Follow this steps:

  1. Open ProductDetail.ascx.cs
  2. Add the line below at line 64:
    • private string currentCulture = CultureInfo.CurrentCulture.Name;
  3. Replace the line 548 by the line below:
    • btnPurchaseImg.ImageUrl = imagesPath + "purchaseimg_" + currentCulture + ".gif";
  4. Replace the line 565 by the line below:
    • btnAddToCartImg.ImageUrl = imagesPath + "addtocartimg_" + currentCulture + ".gif";
  5. Save, then rebuild, that's all!

Note the underscore before the culture name (en-US, fr-FR, ...)! Now, you just have to rename your image files.

Gilles

P.S.: Those corrections work ONLY with WWStore 02.00.08!


We (team members) are Humans offering their knowledge, their work and their spare time FOR FREE to benefit the community. It would be so particularly appreciated that your messages begin with "Hello" and end with "Thank you" or any other form of politeness. Ask yourself what your reaction would be, if you were approached by me (a total stranger) on the street to ask you something without saying "Hello" nor "Thank you"? After several years of services dedicated to the community, I begin to be tired to read requests without any form of politeness.
 
New Post
8/28/2007 10:37 AM
 

I forgot the modification for the token: LINKDETAILIMG, sorry.

Replace the line 453 by: btnLinkDetailImg.ImageUrl = imagesPath + "linkdetailimg_" + currentCulture + ".gif";

Gilles


We (team members) are Humans offering their knowledge, their work and their spare time FOR FREE to benefit the community. It would be so particularly appreciated that your messages begin with "Hello" and end with "Thank you" or any other form of politeness. Ask yourself what your reaction would be, if you were approached by me (a total stranger) on the street to ask you something without saying "Hello" nor "Thank you"? After several years of services dedicated to the community, I begin to be tired to read requests without any form of politeness.
 
New Post
8/29/2007 3:35 AM
 

Hi Gilles,

thanx again for your quick and accurate response.

Indeed, your code approach is better than mine, so i followed it.

But, my actual problem was that the image files were not displayed on the controls.

The mistake was the fact, that i placed the image files inside the "\DotNetNuke_2\Website\DesktopModules\WWStore\Templates\Images" folder, while the program was searching the files inside the "\DotNetNuke_2\Website\Portals\0\WWStore\Templates\Images" folder.

So, after adding your code and the image files inside the correct path, everything works as expected.

Does the link Detail Image need localization. There is no text inside the image, so, maybe it is not necessary.

I can send you the 2 greek image files if you are interested, though they are in poor quality.

regards

Dimitris

 

 
New Post
8/29/2007 5:56 AM
 

Hi again,

here is the code for loading images not only for the selected language, but also for the selected portal skin (blue, gray and orange for the moment).

Note also that you will have to create a number of new image files, one for each skin and language selected. So, each image file should have the following format:

"<File Name>_<Skin Color (Blue-Gray-Orange)>_<curentculture>.gif" (for example: "addtocartimg_Gray_en-US.gif").

Code Changes:

File: ProductDetail.ascx.cs

Member Function: processToken()

Code Implementation: added lines have blue color, commented lines have red color and unchanged code has black color

        private Control processToken(string tokenName)
        {
                //object variable added for getting info concerning active portal skin
                UI.Skins.SkinInfo skinInfo = null;

                switch (tokenName)
                {               
                    ...

                    ...

                    case "PURCHASEIMG":
                            ImageButton btnPurchaseImg = new ImageButton();

                            //code for showing image files based on language and portal skin selected                  
                            skinInfo = UI.Skins.SkinController.GetSkin(UI.Skins.SkinInfo.RootSkin, PortalSettings.PortalId, DotNetNuke.UI.Skins.SkinType.Portal);
                            if (skinInfo == null)
                            {
                                //no portal skin has been selected, so use the default (blue)
                                btnPurchaseImg.ImageUrl = string.Format("{0}purchaseimg_{1}_{2}.gif", imagesPath, System.Drawing.Color.Blue.Name, currentCulture);
                            }
                            else
                            {
                                //portal skin has been selected
                                if (skinInfo.SkinSrc.Contains(System.Drawing.Color.Blue.Name) == true)
                                {
                                    //blue portal skin has been selected
                                    btnPurchaseImg.ImageUrl = string.Format("{0}purchaseimg_{1}_{2}.gif", imagesPath, System.Drawing.Color.Blue.Name, currentCulture);
                                }
                                else if (skinInfo.SkinSrc.Contains(System.Drawing.Color.Gray.Name) == true)
                                {
                                    //gray portal skin has been selected
                                    btnPurchaseImg.ImageUrl = string.Format("{0}purchaseimg_{1}_{2}.gif", imagesPath, System.Drawing.Color.Gray.Name, currentCulture);
                                }
                                else if (skinInfo.SkinSrc.Contains(System.Drawing.Color.Orange.Name) == true)
                                {
                                    //orange portal skin has been selected
                                    btnPurchaseImg.ImageUrl = string.Format("{0}purchaseimg_{1}_{2}.gif", imagesPath, System.Drawing.Color.Orange.Name, currentCulture);
                                }
                            }
                            //clear skinInfo object for next use
                            skinInfo = null;


                            //btnPurchaseImg.ImageUrl = imagesPath + "purchaseimg.gif";               
                            btnPurchaseImg.ToolTip = Localization.GetString("Purchase", this.LocalResourceFile);
                            btnPurchaseImg.CommandArgument = productInfo.ProductID.ToString();
                            btnPurchaseImg.Click += new ImageClickEventHandler(btnPurchaseImg_Click);
                            btnPurchaseImg.Attributes.Add("ProductID", productInfo.ProductID.ToString());
                            return btnPurchaseImg;

                            ...

                            ...

                    case "ADDTOCARTIMG":
                            ImageButton btnAddToCartImg = new ImageButton();

                            //code for showing image files based on language and portal skin selected
                            skinInfo = UI.Skins.SkinController.GetSkin(UI.Skins.SkinInfo.RootSkin, PortalSettings.PortalId, DotNetNuke.UI.Skins.SkinType.Portal);
                            if (skinInfo == null)
                            {
                                //no portal skin has been selected, so use the default (blue)
                                btnAddToCartImg.ImageUrl = string.Format("{0}addtocartimg_{1}_{2}.gif", imagesPath, System.Drawing.Color.Blue.Name, currentCulture);
                            }
                            else
                            {
                                //portal skin has been selected
                                if (skinInfo.SkinSrc.Contains(System.Drawing.Color.Blue.Name) == true)
                                {
                                    //blue portal skin has been selected
                                    btnAddToCartImg.ImageUrl = string.Format("{0}addtocartimg_{1}_{2}.gif", imagesPath, System.Drawing.Color.Blue.Name, currentCulture);
                                }
                                else if (skinInfo.SkinSrc.Contains(System.Drawing.Color.Gray.Name) == true)
                                {
                                    //gray portal skin has been selected
                                    btnAddToCartImg.ImageUrl = string.Format("{0}addtocartimg_{1}_{2}.gif", imagesPath, System.Drawing.Color.Gray.Name, currentCulture);
                                }
                                else if (skinInfo.SkinSrc.Contains(System.Drawing.Color.Orange.Name) == true)
                                {
                                    //orange portal skin has been selected
                                    btnAddToCartImg.ImageUrl = string.Format("{0}addtocartimg_{1}_{2}.gif", imagesPath, System.Drawing.Color.Orange.Name, currentCulture);
                                }
                            }
                            //clear skinInfo object for next use
                            skinInfo = null;


                           //btnAddToCartImg.ImageUrl = imagesPath + "addtocartimg.gif";
                            btnAddToCartImg.ToolTip = Localization.GetString("AddToCart", this.LocalResourceFile);
                            btnAddToCartImg.CommandArgument = productInfo.ProductID.ToString();
                            btnAddToCartImg.Click += new ImageClickEventHandler(btnAddToCartImg_Click);
                            btnAddToCartImg.Attributes.Add("ProductID", productInfo.ProductID.ToString());
                            return btnAddToCartImg;

                            ...

                            ...           

                }

       }

Any comments are welcomed?

regards,

Dimitris

 

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStore"Add to Cart" and the "Buy now" Image buttons localization"Add to Cart" and the "Buy now" Image buttons localization


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out