Page 1 of 1

REmove Manufacturers as a search option

Posted: Tue Oct 07, 2008 8:45 am
by pmcalister
I have a client who wants to remove the search by Manufacturer option. Any ideas?

Re: REmove Manufacturers as a search option

Posted: Tue Oct 07, 2008 9:09 am
by mazhar
Lets for example you can remove the manufacturers search option from the Advacne Search Page by first removing the manufactures dropdown list and data source form the AdvanceSearchPages.ascx and then setting the default value for ManufactureId parameter to 0.

For example on the AdvanceSearchPage.ascx file locate and comment out following two blocks of code

Code: Select all

<%--<asp:DropDownList ID="ManufacturerList" runat="server" AppendDataBoundItems="True"
                DataSourceID="ManufacturerDs" DataTextField="Name" DataValueField="ManufacturerId">
                <asp:ListItem Text="- Any Manufacturer -" Value="0"></asp:ListItem>
            </asp:DropDownList>--%>

and 

<%--<asp:ObjectDataSource ID="ManufacturerDs" runat="server" OldValuesParameterFormatString="original_{0}"
    SelectMethod="LoadForStore" TypeName="CommerceBuilder.Products.ManufacturerDataSource">
    <SelectParameters>
        <asp:Parameter Name="sortExpression" DefaultValue="Name" />
    </SelectParameters>
</asp:ObjectDataSource>--%>
and then locate the following line of code

Code: Select all

<asp:ControlParameter Name="manufacturerId" Type="Int32" ControlID="ManufacturerList" PropertyName="SelectedValue" />
and make it look like

Code: Select all

<asp:Parameter Name="manufacturerId" Type="Int32" DefaultValue="0" />

Re: REmove Manufacturers as a search option

Posted: Tue Oct 07, 2008 9:11 am
by compunerdy
I like to use the manufacturer field but I did not want is displayed to customers. Here are the files I had to edit to remove it.

Edit <conlibs> searchpage.ascx and .cs/categorysearchsidebar.ascx and .cs/categorygridpage.ascx and .cs to not display manufacturer info.

Hope that helps.

Re: REmove Manufacturers as a search option

Posted: Tue Oct 07, 2008 10:13 am
by pmcalister
Great! This worked just fine. Thanks a bunch.

Re: REmove Manufacturers as a search option

Posted: Thu Dec 18, 2008 4:40 pm
by dappy2
How can I remove the manufacturer column from the search results on the advanced search also? I've commented out all the sections that pertain to choosing a manufacturer but I don't even want the column in the results. Everytime I try to remove it and comment out the c# code that mentions manufacturer I get:

Code: Select all

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Our store doesn't use a manufacturer (98% of the time we are the manufacturer in a round about sort of way) and in the 2-3 years it has been running I've never used it. And since I'm transitioning from storefront software to AbleCommerce I don't forsee us using it. I can always add it back if needed.

Thanks,
Dappy

Re: REmove Manufacturers as a search option

Posted: Fri Dec 19, 2008 4:52 am
by mazhar
Find the following code in AdvanceSearchPage.ascx file

Code: Select all

<asp:TemplateField HeaderText="Manufacturer" SortExpression="Manufacturer">                    
                <ItemTemplate>
                    <asp:Label ID="Manufacturer" runat="server" Text='<%#GetManufacturerLink((int)Eval("ManufacturerId"))%>'
                        ></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
and comment it out like below

Code: Select all

<%--<asp:TemplateField HeaderText="Manufacturer" SortExpression="Manufacturer">                    
                <ItemTemplate>
                    <asp:Label ID="Manufacturer" runat="server" Text='<%#GetManufacturerLink((int)Eval("ManufacturerId"))%>'
                        ></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>--%>

Re: REmove Manufacturers as a search option

Posted: Fri Dec 19, 2008 7:34 am
by jmestep
dappy2- I occasionally get that error when I'm editing something that has code in it where paramters were passed, like the search page. If I go to another page, then go back to it, it is usually OK.

Re: REmove Manufacturers as a search option

Posted: Fri Dec 19, 2008 8:39 am
by dappy2
Thanks - that worked. But i had commented that section out before and was getting the error like jmstep said.

Works now.