Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: Kit products ... don't want [Price: $0.00] for options without a price delta

  1. #1
    lmrazek is offline Member
    Join Date
    Oct 2004
    Posts
    34

    Default Kit products ... don't want [Price: $0.00] for options without a price delta

    Hi:

    We didn't have this issue in version 8.

    Anyone successfully modified dropdownlistitems.ascx.cs? I have populatedropdown2, which works, except when trying to select an item less than 6 characters ... i.e. "red", "Blue" ... those fail, while "Purple", Magenta work.

    See example below:
    Code:
    private void PopulateDropDown()
            {
                cboKitItems.Items.Clear();
                foreach (var kitItem in KitGroup.SelectableItems)
                {
                    ListItem lItem = new ListItem();
    
                    // truncate after 75 chars to maintain a proper width for the dropdown
                    lItem.Text = KitItemDisplayText(kitItem, 60);
                    lItem.Value = kitItem.Id.ToString();
                    lItem.Selected = kitItem.IsSelected;
    
                    cboKitItems.Items.Add(lItem);
                }
            }
    
            private void PopulateDropDown2()
            {
                cboKitItems.Items.Clear();
     int strLen =0;            
    foreach (var kitItem in KitGroup.SelectableItems)
                {
                    ListItem lItem = new ListItem();
    		//string KitItemText =
                    // truncate after 75 chars to maintain a proper width for the dropdown
                  //  lItem.Text = KitItemDisplayText(kitItem, 60).Split('[')[0]; ;
     //lItem.Text = KitItemDisplayText(kitItem, 60);
    
                    // truncate after 75 chars to maintain a proper width for the dropdown
                    strLen = (KitItemDisplayText(kitItem, 60)).Length ;
                    if (KitItemDisplayText(kitItem, 60).Substring(strLen - 6).Equals("$0.00]"))
                    {
                       	int index = KitItemDisplayText(kitItem, 60).IndexOf("[");
    			lItem.Text = KitItemDisplayText(kitItem, 60).Substring(0, index) ;
    
    			// lItem.Text = KitItemDisplayText(kitItem, 60).Split('[')[0]; 
                    }
                    else
                    {
                        lItem.Text = KitItemDisplayText(kitItem, 60) ;
                    }
                    lItem.Value = kitItem.Id.ToString();
                    lItem.Selected = kitItem.IsSelected;
    
                    cboKitItems.Items.Add(lItem);
                }
            }

  2. #2
    lmrazek is offline Member
    Join Date
    Oct 2004
    Posts
    34

    Default

    Anyone? Given that this was NOT an issue with version 8, wouldn't this be classified as a bug?

  3. #3
    lmrazek is offline Member
    Join Date
    Oct 2004
    Posts
    34

    Default

    Wow, this place is dead.

    In any case, the solution is:
    Open the DropDownListItems.ascx.cs file in the "Controls\Kit" folder:

    Replace the PopulateDropDown() function with: the following code (use at your own risk):
    Code:
     private void PopulateDropDown()
     {
         cboKitItems.Items.Clear();
         foreach (var kitItem in KitGroup.SelectableItems)
         {
             ListItem lItem = new ListItem();
    
    
             lItem.Text = KitItemDisplayText(kitItem, 60).Replace(" [PRICE: $0.00]", String.Empty);
             lItem.Value = kitItem.Id.ToString();
             lItem.Selected = kitItem.IsSelected;
    
             cboKitItems.Items.Add(lItem);
         }
     }
    Not too terrible once I ditched the previous developer's code. You probably could also use a Regex.Replace to do the same thing.

    Hope this helps someone.

    I still say this is a bug.