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

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
William M
Commander (CMDR)
Commander (CMDR)
Posts: 150
Joined: Sat Feb 14, 2009 9:40 am
Contact:

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

Post by William M » Mon Mar 23, 2009 6:38 am

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.

User avatar
dbreyley
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 22
Joined: Tue Jun 17, 2008 8:06 am

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

Post by dbreyley » Mon Mar 23, 2009 11:07 am

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;
    }

William M
Commander (CMDR)
Commander (CMDR)
Posts: 150
Joined: Sat Feb 14, 2009 9:40 am
Contact:

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

Post by William M » Mon Mar 23, 2009 11:13 am

Thanks, I'll pass it on.

JimFriend
Ensign (ENS)
Ensign (ENS)
Posts: 10
Joined: Thu Jul 05, 2007 1:31 pm
Contact:

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

Post by JimFriend » Mon Mar 23, 2009 12:53 pm

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!
Jim Friend
Web Developer
Image

William M
Commander (CMDR)
Commander (CMDR)
Posts: 150
Joined: Sat Feb 14, 2009 9:40 am
Contact:

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

Post by William M » Mon Mar 23, 2009 6:09 pm

Before and after

Post Reply