Hi Perrin,

I understand what you're trying to tell me. I think my solution will have to be with the database structure. I don't want the script to loop through all the items all the time. I believe a lot of processing time would be required to run the script.

So, I'm going to investigate the database option. From your earlier reply to the node you mentioned a higher entity.

Here's an example of the database structures and let me see if I understand what you're trying to suggest.

Product Table:
item_id: 7
description: ball
category: toys
price: 5.69
PRIMARY KEY item_id

Color Table:
color_id: 7br
item_id: 7
color: blue

color_id: 7gr
item_id: 7
color: green

color_id: 7or
item_id: 7
color: orange

PRIMARY KEY color_id
FOREIGN KEY item_id

I would write a SQL that would join these two tables, along the lines:

SELECT product.item_id, product.description, product.category, product.price, color.color WHERE product.item_id = color.color_id GROUP BY product.item_id, product.description, product.category, product.price;

If I'm on the right track thus far, will I have a popup menu with the individual colors for a single item as well as be able to choose that item more than once with a different color?

Here's my online catalog:

Item picture, item description, item price,
a popup menu that will show me the colors: blue, green orange for this item.
To get a better idea, please visit: http://www.summitwebcrafters.com/cgi-bin/pet_shop1.cgi

Click on the Toys category and the first item on the page is the item that has colors at the moment.

With the above database structure, will I be able to achieve the look and feel of that Toys page, with the color popup menu, and the ability to add that same item with two different colors?

Do you think I'm on the right track?

In reply to Re: Re: Re: Re: Need duplicate item entries in shopping cart by b310
in thread Need duplicate item entries in shopping cart by b310

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.