Products by manufactuer control

This forum is where we'll mirror posts that are of value to the community so they may be more easily found.
Post Reply
User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Products by manufactuer control

Post by mazhar » Tue Dec 02, 2008 6:29 am

ProductsByManufacturer control lists the products by there manufacturer. In order to install the control extract the attached zip file and place the user control files in ConLib folder then use it like any other ConLib control on store pages.

Code: Select all

[[ConLib:ProductsByManufacturer]]

User avatar
Tomgard
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 108
Joined: Sun Jul 20, 2008 1:00 pm

Re: Products by manufactuer control

Post by Tomgard » Tue Dec 02, 2008 10:08 am

Thank you for posting this. For SEO purposes it would be better to list all manufactures and hyperlink them to the product listing. A manufacturer site map of sorts.
Bryan Bundgaard
AC7 User http://www.SchoolSupplyStore.com

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Products by manufactuer control

Post by mazhar » Tue Dec 02, 2008 1:01 pm

It could be done easily, all you need is to send the vendor id to the listing page. The listing page will list the products by extracting the vendorid from encoded url.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Products by manufactuer control

Post by mazhar » Mon Dec 22, 2008 5:55 am

Thank you for posting this. For SEO purposes it would be better to list all manufactures and hyperlink them to the product listing. A manufacturer site map of sorts.
Check the following post
viewtopic.php?f=47&t=9343

User avatar
Willisski
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 82
Joined: Thu Oct 27, 2005 1:46 am
Location: http://www.Thejibshop.com
Contact:

Re: Products by manufactuer control

Post by Willisski » Fri May 29, 2009 12:40 pm

dumb question... In your screen shot you have an image of a manufacturers drop down. I have installed the controls but I am unable to find that drop down. Could you point me in the right direction?


Greg
Thanks for any help you can give me..

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Products by manufactuer control

Post by mazhar » Sat May 30, 2009 2:36 am

I just installed the component and dropdown is there as shown in screen capture. Do you have some customization in control file?

User avatar
Willisski
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 82
Joined: Thu Oct 27, 2005 1:46 am
Location: http://www.Thejibshop.com
Contact:

Re: Products by manufactuer control

Post by Willisski » Sun May 31, 2009 8:42 am

For whatever reason the
The drop down is showing up now I have no idea what I did before... something Screwy for sure..

However now when I sort by anything on the page i get
The data source 'ProductDS' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: The data source 'ProductDS' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.
Do you have any suggestions?

Ps is there a way to suppress manufacturers that currently do not have products

Greg

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Products by manufactuer control

Post by mazhar » Mon Jun 01, 2009 5:12 am

The data source 'ProductDS' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: The data source 'ProductDS' does not support sorting with IEnumerable data. Automatic sorting is only supported with DataView, DataTable, and DataSet.
Edit the file and locate following code block

Code: Select all

<asp:ObjectDataSource ID="ProductDS" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="AdvancedSearch" TypeName="CommerceBuilder.Products.ProductDataSource">
and change it as below

Code: Select all

<asp:ObjectDataSource ID="ProductDS" runat="server" OldValuesParameterFormatString="original_{0}"
        SelectMethod="AdvancedSearch" TypeName="CommerceBuilder.Products.ProductDataSource" SortParameterName="sortExpression">
Do you have any suggestions?

Ps is there a way to suppress manufacturers that currently do not have products
For this locate

Code: Select all

<asp:DropDownList ID="ManufacturersList" runat="server" AppendDataBoundItems="True"
                DataSourceID="ManufacturerDs" DataTextField="Name" 
        DataValueField="ManufacturerId" AutoPostBack="true">
and change it as below

Code: Select all

<asp:DropDownList ID="ManufacturersList" runat="server" AppendDataBoundItems="True"
                DataSourceID="ManufacturerDs" DataTextField="Name" 
        DataValueField="ManufacturerId" AutoPostBack="true" 
        onprerender="ManufacturersList_PreRender">
Now finally add following method to code file

Code: Select all

protected void ManufacturersList_PreRender(object sender, EventArgs e)
    {
        foreach (ListItem listItem in ManufacturersList.Items)
        {
            int manufacturerId = AlwaysConvert.ToInt(listItem.Value);
            if (manufacturerId > 0)
            {
                bool enabled = (ProductDataSource.CountForManufacturer(manufacturerId) > 0);
                listItem.Enabled = enabled;
            }
        }
    }

Post Reply