How to add extra field(In stock/Out of stock) to a DropDownList ?

  • Thread starter Thread starter savvy
  • Start date Start date
S

savvy

I am developing a Garments shopping cart. On the single product page
where the customer selects size and colour of a garment and if its ok
for him, then adds to his basket, so every time he checks for Colour
(dropdownlist) and Size (dropdownlist) I'm checking whether the Item is
"In Stock" or "Out of Stock" and displaying the same using a Label
outside.

Is their any way so that I can display "In Stock" or "Out of Stock"
inside the dropdownlist menu of the Size when the customer chooses a
Colour. The pattern wanted is displayed below.

Colour DropdownList
Black
Blue
Green

Size DropdownList
3 yrs (In Stock)
6 yrs (Out of Stock)
12 yrs (In Stock)

I have no idea how to add an extra field inside the DropdownList.
Any ideas would be of great help to me and will be greatly appreciated
Thanks in Advance for your time

Database Queries:
SELECT * FROM ProductClrIcons WHERE ProductID=@prod_id -- (For
ColourIcons)
SELECT * FROM ProductSizes WHERE ProductID=@prod_id--- (For Sizes)
SELECT * FROM ProductSizesColours WHERE ColourName=@colname AND
Sizes=@sizes AND ProductID=@prod_id--- ( For StockLevels)
 
PUll the data the way you like it up front

SELECT ps.ProductSizeID
, [Description] -- raw description
, InStock -- raw Boolean for in stock?
, CASE InStock WHEN 0 THEN Description + ' (Out of Stock)'
ELSE Description + ' (In Stock)' END As DropDownItem
FORM ProductSizes
WHERE ProductID = @ProductID

You then bind the display field to the concatenated field.

You will still have to do a server side check when the order is processed,
but this alerts the customer up front without the check each change.

If you are bleeding edge, you can also have the check done via Ajax. Okay,
let's drop that idea for now. :-)

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 
Back
Top