Adding product functionality/info

Last post 08-29-2003 11:26 AM by mnswiftone. 1 replies.

Sort Posts:

  • Adding product functionality/info

    08-27-2003, 1:11 PM
    • Member
      245 point Member
    • Chuke
    • Member since 10-04-2002, 10:19 AM
    • Posts 49
    Has anyone tried to add additional info to the products...

    For instance:

    If I have a "size" and "color" for each product that I want a user to be able to specify...

    Any idea on the best way to implement?

    I understand that the database will need modifying, but any ideas on the ASP.NET logic?

    I am using the C# SDK version with the Web Matrix...

    Thanks for any help

    Chuke
  • Re: Adding product functionality/info

    08-29-2003, 11:26 AM
    • Member
      222 point Member
    • mnswiftone
    • Member since 07-20-2003, 7:44 AM
    • Eden Prairie, MN
    • Posts 49
    Simple - just add fields to your database, then add matching fields inside the Datalist on your web page - look at the existing for formatting ideas, and add tags for size and color - something like:

    <%# DataBinder.Eval(Container.DataItem, "Size")%>
    and
    <%# DataBinder.Eval(Container.DataItem, "Color")%>

    You'll need to update the matching call or stored procedue that gets the data for this page, i.e. add Size, Color to the Select statement in ProductsByCategory - like:

    CREATE Procedure ProductsByCategory
    (
    @CategoryID int
    )
    AS

    SELECT
    ProductID,
    ModelName,
    UnitCost,
    ProductImage,
    Color,
    Size

    FROM
    Products

    WHERE
    CategoryID = @CategoryID

    ORDER BY
    ModelName,
    ModelNumber

    GO


    I've done a lot of changes to my database, added fields for Weight, ModelNumber which is the manufacturers part number in addition to ModelName, shortDescription which is a short description shown on the productlist page.


    CREATE TABLE [dbo].[Products] (
    [ProductID] [int] IDENTITY (1, 1) NOT NULL ,
    [CategoryID] [int] NOT NULL ,
    [ModelNumber] [nvarchar] (50) ,
    [ModelName] [nvarchar] (50) ,
    [ProductImage] [nvarchar] (50) ,
    [UnitCost] [money] NOT NULL ,
    [Weight][number],
    [ShortDescription][nvarchar](50),
    [Description] [nvarchar] (3800)
    ) ON [PRIMARY]
    GO


    Good luck,
    It's not very hard if you read the existing stuff enough.

    Todd
Page 1 of 1 (2 items)