Manufacturer drop down list

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
webbspot
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Sat Nov 09, 2013 7:42 am

Manufacturer drop down list

Post by webbspot » Thu Dec 19, 2013 8:28 am

Good morning,

I have looked around and found a little about shopping by manufacturer on the old Able platform, but nothing pertaining to Gold. Is this something anyone has done and if so could you explain the steps to make it happen. Any help would be greatly appreciated.

Thanks!

David

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Manufacturer drop down list

Post by AbleMods » Fri Dec 20, 2013 7:49 am

David, the default Able Gold search page has a sidebar that automatically provides a filter by manufacturer. This would permit your shoppers to easily shop your entire store by manufacturer.

Simply navigate your browser to /search.aspx and you should see the default search page with the sidebar filter choices.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

webbspot
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Sat Nov 09, 2013 7:42 am

Re: Manufacturer drop down list

Post by webbspot » Fri Dec 20, 2013 8:38 pm

Thanks for the reply. I know that the side search works and I think it's sufficient, but we are in the testing phase and everyone we have shown the site thinks it's great, but says it needs a manufacturer drop down menu. We are in golf retail and the other sites have that option so maybe that is why they think we need it. I am still working on loading products and tweaking the functionality of the site ( the top category menu is not fully coded yet), but you can see it at: http://216.54.71.17 for a reference.

Thanks again..we are just looking to make anything easier for the customer.
Last edited by webbspot on Sat Dec 21, 2013 10:05 am, edited 1 time in total.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Manufacturer drop down list

Post by jmestep » Sat Dec 21, 2013 7:26 am

You might want to alter the link above (216..) so that it is text instead of a link. Search engines have a way of picking up urls for development sites and then we have seen development sites actually receive orders.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

webbspot
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Sat Nov 09, 2013 7:42 am

Re: Manufacturer drop down list

Post by webbspot » Sat Dec 21, 2013 10:06 am

Thanks for the tip...still hoping someone can help me out on the drop down list. Have a good day!

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Manufacturer drop down list

Post by jmestep » Mon Dec 23, 2013 6:19 am

You could probably take the code for the manufacturer dropdown from the edit product page in the admin. Then add code to send the customer somewhere after he selects a manufacturer. Able doesn't have a shop by manufacturer landing page, but you can send the customer to search.aspx?m=xx where xx is the id of the manufacturer.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Manufacturer drop down list

Post by AbleMods » Wed Jan 08, 2014 7:42 am

David do you still need to have the search sidebar manufacturer list render as a dropdown instead of hyperlinks?

I have a working solution for it that I can post here if you still need it.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

webbspot
Ensign (ENS)
Ensign (ENS)
Posts: 14
Joined: Sat Nov 09, 2013 7:42 am

Re: Manufacturer drop down list

Post by webbspot » Mon Jan 13, 2014 10:57 pm

That would be awesome if you have the code to do that. For the time being I have just hard coded a drop down list in the control and have to manually update it. Thanks so much for your reply and I look forward to seeing the code.

Thanks again.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Manufacturer drop down list

Post by AbleMods » Tue Jan 14, 2014 6:50 am

ok, the following changes must be made in the /conlib/CategorySearchSidebar.ascx and .ascx.cs files.

Let's start with the ASCX file. Find this section of code that defines the manufacturer filtering panel:

Code: Select all

	        <asp:Panel ID="NarrowByManufacturerPanel" runat="server" CssClass="criteriaPanel">
	            <h3 class="searchCriteria">Narrow by Manufacturer</h3>
		        <asp:DataList ID="ManufacturerList" runat="server" DataKeyField="ManufacturerId"  OnItemCreated="ManufacturerList_ItemCreated" EnableViewState="false">
			        <ItemTemplate>
				        <asp:HyperLink ID="NarrowByManufacturerLink" runat="server" CssClass="searchCriteria">
                            <span class="itemName"><%# Eval("Name")%></span>
                            <span class="count">(<%#Eval("ProductCount")%>)</span>
                        </asp:HyperLink>
			        </ItemTemplate>
		        </asp:DataList>		
	            <asp:LinkButton ID="ShowAllManufacturers" runat="server" Text="See All &raquo;" CssClass="showAll" EnableViewState="false"></asp:LinkButton>
            </asp:Panel>
Comment out the whole thing. You can do this easily by putting <%-- before the <asp:Panel> tag and put --%> after the </asp:Panel> closing tag.

What we've done is comment out the old way of rendering the manufacturers. Now we need to add a control to represent the new dropdown list we want to see on this page.

Immediately below the code you commented out above, add this code:

Code: Select all

            <asp:DropDownList runat="server" ID="list_Manufacturers" OnSelectedIndexChanged="list_Manufacturers_OnSelectedIndexChanged" AutoPostBack="True"/>
Now that we've hidden these controls and added our replacement control, the .cs code behind file is going to have some complaints. There will be references to objects that no longer exist in the page. So we have to find that code and comment it out as well.

Edit the /conlib/CategorySearchSidebar.ascx.cs file and find this code in the Page_Init() method:

Code: Select all

                if (eventTarget.StartsWith(ShowAllManufacturers.UniqueID))
                {
                    ShowAllManufacturers.Visible = false;
                }
Comment it out. Just add // to the beginning of each line.

Now find this code in the BindNarrowByManufacturerPanel() method:

Code: Select all

            if (!ExpandManufacturerLink.Visible)
            {
                NarrowByManufacturerPanel.Visible = true;
                if (_manufacturers.Count > _MaximumManufacturers)
                {
                    if (ShowAllManufacturers.Visible)
                    {
                        int count = _manufacturers.Count - _MaximumManufacturers;
                        for (int i = 0; i < count; i++)
                        {
                            if (_manufacturers.Count > _MaximumManufacturers)
                                _manufacturers.RemoveAt(_MaximumManufacturers);
                        }
                    }
                }
                else ShowAllManufacturers.Visible = false;
                ManufacturerList.DataSource = _manufacturers;
                ManufacturerList.DataBind();
                NarrowByManufacturerPanel.Visible = (ManufacturerList.Items.Count > 0);
            }
            else NarrowByManufacturerPanel.Visible = false;
Comment out all of those lines using the same // at the beginning of each line as before.

Now, we've commented out the page's ability to populate the manufacturer links the way it was designed. We need to replace this behavior with our own way of populating the dropdown control. Immediately below the code you just commented out, add this new code:

Code: Select all

            // populate the manufacturer dropdown list
            list_Manufacturers.Items.Add(new ListItem("- choose -"));
            foreach (ManufacturerProductCount mfpc in _manufacturers)
            {
                ListItem item = new ListItem(mfpc.Name + " (" + mfpc.ProductCount.ToString() + ")", mfpc.ManufacturerId.ToString());
                list_Manufacturers.Items.Add(item);

            }
Our new code will build a nice list of manufacturers into the dropdown. But, there's a problem. There's nothing so far that tells the page what to do when the dropdown's selected item is changed. In other words, changing the dropdown to a different manufacturer won't do anything yet. We need to add an event to the code to process a dropdown selection change.

Find the ManufacturerList_ItemCreated() method in the code. Add this code as a new method immediately before the ItemCreated() method:

Code: Select all

        protected void list_Manufacturers_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            Response.Redirect(ModifyQueryStringParameters("m", list_Manufacturers.SelectedValue.ToString()));
        }
Finally, comment out the whole ManufacturerList_ItemCreated() method, we don't need it any more.

Code: Select all

        //protected void ManufacturerList_ItemCreated(object source, DataListItemEventArgs e)
        //{
        //    ManufacturerProductCount m = (ManufacturerProductCount)e.Item.DataItem;
        //    HyperLink narrowByManufacturerLink = (HyperLink)e.Item.FindControl("NarrowByManufacturerLink");
        //    narrowByManufacturerLink.NavigateUrl = ModifyQueryStringParameters("m", m.ManufacturerId.ToString());
        //}
At this point, we've eliminated the old controls and code for rendering manufacturer choices. We've added a new control and the necessary code in the backend to handle the selection changes. Give it a try and see how it works for you. Good luck! :)
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply