7 Replies Latest reply: Jan 7, 2013 3:16 AM by Gopinath Ramasamy RSS

    Promotions

    jkvel
      Hi,

      How to display promotion of a particular product in jsp.

      I have created and implemented a promotion and it works successfully during my price summary but dont know how to display the promotion..( eg:10% off)

      Thanks
      Jk
        • 1. Re: Promotions
          Gopinath Ramasamy
          Hi,

          There is a droplet available which will help you - /atg/commerce/pricing/GetApplicablePromotions

          Link to the documentation of this droplet:
          http://docs.oracle.com/cd/E26180_01/Platform.94/ATGCommStoreGuide/html/s1721getapplicablepromotions01.html

          Hope this helps.

          Thanks,
          Gopinath Ramasamy
          • 2. Re: Promotions
            karthik chopperla
            Use GetApplicablePromotions droplet to get it for a particular product or sku or commerce item.

            http://docs.oracle.com/cd/E26180_01/Platform.94/ATGCommStoreGuide/html/s1721getapplicablepromotions01.html

            -karthik
            • 3. Re: Promotions
              RMishra
              How to display promotion of a particular product in jsp.
              You can try below code
              <!-- Promotions Details -->
              <dsp:droplet name="ForEach">
                   <dsp:param bean="Profile.activePromotions" name="array"/>
                   <dsp:oparam name="outputStart">
                        <b>You have these promotions:</b><p>
                   </dsp:oparam>
                   <dsp:oparam name="output">
                        <dsp:valueof param="element.promotion.displayName"/><br>
                        </dsp:oparam>
                   <dsp:oparam name="empty">You have no promotions</dsp:oparam>
              </dsp:droplet>
              -RMishra
              • 4. Re: Promotions
                karthik chopperla
                The code will dispaly all the promotions that profile has.

                To display particular promotion applied on a product, either the given droplet can be used or you can write a droplet which does the following

                pseudo code

                List pricingModels=CommerceItem.getPriceInfo.getAdjustments()
                pricingModels[0]..displayName gives the promotion's displayname

                -karthik
                • 5. Re: Promotions
                  RMishra
                  Thanks.

                  -RMishra
                  • 6. Re: Promotions
                    jkvel
                    Hi,

                    I used GetApplicablePromotions droplet to display promotion for the product.

                    i used this snippet below, but i get NullPointerException or EmptyStackException when i use the following code.

                    <dsp:droplet name="/atg/commerce/pricing/GetApplicablePromotions">
                    <dsp:param name="item" param="product">
                    <dsp:oparam name="output">
                    <dsp:droplet name="ForEach">
                    <dsp:param name="array" param="promotions">
                    <dsp:oparam name="output">
                    <dsp:valueof param="element.displayName">
                    </dsp:oparam>
                    </dsp:droplet>
                    </dsp:oparam>
                    </dsp:droplet>

                    --
                    sanjeev

                    Edited by: jkvel on Jan 7, 2013 12:07 AM
                    • 7. Re: Promotions
                      Gopinath Ramasamy
                      Hi,

                      The product that you are trying with will not be having any promotions. Add a IsEmpty check before passing the promotions to ForEach. Try with below code.

                      <dsp:droplet name="/atg/commerce/pricing/GetApplicablePromotions">
                      <dsp:param name="item" param="product">
                      <dsp:oparam name="output">
                      </dsp:droplet name="/atg/dynamo/droplet/IsEmpty">
                      <dsp:param name="array" param="promotions">
                      <dsp:oparam name="false">
                      <dsp:droplet name="ForEach">
                      <dsp:param name="array" param="promotions">
                      <dsp:oparam name="output">
                      <dsp:valueof param="element.displayName">
                      </dsp:oparam>
                      </dsp:droplet>
                      </dsp:oparam>
                      </dsp:droplet>
                      </dsp:oparam>
                      </dsp:droplet>

                      If you continue to get the exceptions, please post the error logs after enabling loggingDebug in both GetApplicablePromotions and ForEach droplets.

                      Thanks,
                      Gopinath Ramasamy