Page 1 of 1

Need 'bullet list' of: Choice name: choice made

Posted: Mon Mar 23, 2009 6:38 am
by William M
ootb, Able lists choices as a run-on sentence. I've got products with up to 10 choices.

ootb: large, blue, button-down, long, etc....

I need - Choice Name: Choice made (like a bullet list):

Size: large
Color: blue
Collar style: button-down
Sleeve type: long

In the cart, on the checkout, emails, etc. Has anyone done this? I'd like to pass any help you can offer on to my developer to ease the workload.

Thanks.

Re: Need 'bullet list' of: Choice name: choice made

Posted: Mon Mar 23, 2009 11:07 am
by dbreyley
I found the run-on sentence very annoying also.
Here is how I fixed the Basket
In /conlib/utility/BasketItemDetail.ascx.cs in the Page_Prender:
Change

Code: Select all

productName += string.Format(" ({0})", _BasketItem.ProductVariant.VariantName);
to

Code: Select all

prodOptions += GetVariantList(_BasketItem.OptionList);
GetVariantList Function:

Code: Select all

    private string GetVariantList(string OptionListIn)
    {
        string RetVal = "";

        string[] SingleOpt = OptionListIn.Split(',');
        for (int LpCnt = 0; LpCnt <= SingleOpt.GetUpperBound(0); LpCnt++)
        {
            if (SingleOpt[LpCnt] != "0")
            {
                if (RetVal != "")
                    RetVal += "<br />";

                OptionChoice CurOptCh = OptionChoiceDataSource.Load(Convert.ToInt32(SingleOpt[LpCnt]));
                Option CurrOpt = OptionDataSource.Load(CurOptCh.OptionId);
                string OptionName = CurrOpt.Name;
                //Strip unnecessary text from the Option Name (as necessary)
                OptionName = OptionName.Replace("Select ", "");
                OptionName = OptionName.Replace("Add a ", "");
                RetVal += OptionName + ": " + CurOptCh.Name;
            }
        }
        return RetVal;
    }

Re: Need 'bullet list' of: Choice name: choice made

Posted: Mon Mar 23, 2009 11:13 am
by William M
Thanks, I'll pass it on.

Re: Need 'bullet list' of: Choice name: choice made

Posted: Mon Mar 23, 2009 12:53 pm
by JimFriend
Thanks for the great start, dbreyley.

I had to add a couple things so I figured I'd post them here as well in case other people were looking for a fix like this.

For the GetVariantList function in BasketItemDetail.ascx.cs, I changed this line:

Code: Select all

string RetVal = "";
to this:

Code: Select all

string RetVal = "<br />";
In BasketItemDetail.ascx.cs, right after this line:

Code: Select all

string productName = product.Name;
I added this line:

Code: Select all

string prodOptions = "";
I also needed to add the output for the prodOptions. To do this I changed this block of code:

Code: Select all

                if (this.LinkProducts)
                {
                    //OUTPUT NAME AS LINK
                    string url = UrlGenerator.GetBrowseUrl(product.ProductId, CatalogNodeType.Product, product.Name);
                    string link = string.Format("<a href=\"{0}\">{1}</a>", Page.ResolveUrl(url), productName);
                    phProductName.Controls.Add(new LiteralControl(link));
                }
                else
                {
                    //OUTPUT NAME
                    phProductName.Controls.Add(new LiteralControl(productName));
                }
to this:

Code: Select all

                if (this.LinkProducts)
                {
                    //OUTPUT NAME AS LINK
                    string url = UrlGenerator.GetBrowseUrl(product.ProductId, CatalogNodeType.Product, product.Name);
                    string link = string.Format("<a href=\"{0}\">{1}</a>", Page.ResolveUrl(url), productName);
                    phProductName.Controls.Add(new LiteralControl(link));
                    phProductName.Controls.Add(new LiteralControl(prodOptions));
                }
                else
                {
                    //OUTPUT NAME
                    phProductName.Controls.Add(new LiteralControl(productName));
                    phProductName.Controls.Add(new LiteralControl(prodOptions));
                }
I believe those were the only changes I made. Thanks again!

Re: Need 'bullet list' of: Choice name: choice made

Posted: Mon Mar 23, 2009 6:09 pm
by William M
Before and after