Announcement Announcement Module
Collapse
No announcement yet.
Implementation of a SKU drop down on a Item detail page Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?

    Comment


    • #3
      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,

      Comment


      • #4
        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, 12:48 PM. Reason: more notes

        Comment


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

          Comment

          Working...
          X