Results 1 to 5 of 5

Thread: Implementation of a SKU drop down on a Item detail page

  1. #1

    Default Implementation of a SKU drop down on a Item detail page

    Hi all,

    I am trying to implement a drop down functionality for an item detail page for a web site.
    However, I am having difficulties getting both the item attribute and
    the sku details. I have a form that will populate the sku info and submit them.
    At the same time, I want to display the item price , item description and so forth on the same page.
    I am using the simpleformController but I'm trying to implement both the handleRequest() method and the onSubmit() method.

    Is that doable?

    Thanks in advance you for your reply.

  2. #2
    Join Date
    Aug 2008
    Location
    St Louis, MO
    Posts
    51

    Default

    If you are trying to show the detail of an item and also look it up on the same page, yes it can be done. If this is not what you meant can you elaborate more on your problem?

  3. #3

    Default

    Hi Maverick,

    Yes, what i'm trying to do is to show the item detail and also have the possibility to pick the item sku from a drop down and show them in my shopping cart on a left nav like most ecommerce sites do.

    I will greatly appreciate if you can show me how to do that.

    Thanks,

  4. #4
    Join Date
    Aug 2008
    Location
    St Louis, MO
    Posts
    51

    Default

    I would do something like this.

    In the SimpleFormController subclass

    override the referenceData method as follows

    Code:
    Map<String, Object> referenceDataMap = new HashMap<String, Object>();
            referenceDataMap.put("itemSkuList", itemSkuList);
            return referenceDataMap;
    bean definition would be something like this for the command assuming sku is a property in Item object

    Code:
    <bean id="someController" class="pathToYourControllerClass">
    	<property name="commandClass" value="com.??.Item"/>
    	....................
    	....................
    </bean>
    override onSubmit(Object command) method as

    Code:
    ModelAndView modelAndView = super.onSubmit(command);
    Item item = (Item) command;
    modelAndView.getModel().put("item", retrieveItem(item.getSku()));
    return modelAndView;
    And your jsp would be something like this

    Code:
    <form:form>
    <form:select path="sku">
    	<form:options items="${requestScope.itemSkuList}"/> <!-- Matches what you populated into model -->
    </form:select>
    <input type="submit" ..../>
    <form:form/>
    
    <c:if test="${!empty requestScope.item}"> <!-- Matches what you populated into model -->
    	// display your item here
    </c:if>
    Last edited by maverickthinker; Aug 20th, 2008 at 12:48 PM. Reason: more notes

  5. #5

    Default

    Thank you very much. I will try this and let you know how it goes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •