LOL... That wont work either. The whole problem with this thread is that an
ORDER can have multiple SHIPMENTS, each SHIPMENT has its own SHIPPING
ADDRESS. So after all this I MUST use the "$shipment in $shipments" callout
and do it as a shipment now instead of per order. 

Thanks to all that helped.


Robert P. Reil
Managing Director,
Motorcyclecarbs.com, Inc.
4292 Country Garden Walk NW
Kennesaw, Ga. 30152
Office 770-974-8851
Fax 770-974-8852
www.motorcyclecarbs.com 

-----Original Message-----
From: Henning P. Schmiedehausen [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 29, 2007 5:36 PM
To: Carbs Sales&Service
Subject: Re: HELP!!!! Able Commerce Email Problem in Velocity Programming

Robert Reil <[EMAIL PROTECTED]> writes:

>Finally got an answer. For somereason you cant just use a Getter. I 
>think because multiple rows are returned sometimes.

>Heres the solution that worked:


>#set ($intShipCount = 1)
>#foreach( $shipment in $shipments )
>#if ( $VelocityUtils.compare($intShipCount,1) == 0 )
>            <td><strong>Ship To</strong>:<br>
>            $shipment.getShipAddr().getFirstName()
>$shipment.getShipAddr().getLastName()<br>
>            $LocaleUtils.formatAddress($token,$shipment.getShipAddr(),true)
>              <p><strong>$shipment.getShipMsg()</strong></p>
>#end
>#set ($intShipCount = $intShipCount + 1) #end

>I don't know why a getter couldn't work. 

Nice. There is an implicit count, BTW, so

#foreach( $shipment in $shipments )
  #if ( $velocityCount == 1)
    <td><strong>Ship To</strong>:<br>
    $shipment.getShipAddr().getFirstName()
    $shipment.getShipAddr().getLastName()<br>
    $LocaleUtils.formatAddress($token,$shipment.getShipAddr(),true)
    <p><strong>$shipment.getShipMsg()</strong></p>
  #end
#end 

should work, too. 

Also 

#set ($shipment = $shipments.get(0))

might work, depending on what $shipments.class.name is (hopefully some sort
of List).

Last but not least, you could also write: 

<td><strong>Ship To</strong>:<br>
$shipment.shipAddr.firstName
$shipment.shipAddr.lastName<br>
$LocaleUtils.formatAddress($token,$shipment.shipAddr, true)
<p><strong>$shipment.shipMsg</strong></p>

which tends to be close to the notation some people are used from e.g. JSTL
(Will likes to capitalize the getters but me prefers the "Java Bean
property" style).

        Best regards
                Henning


--
Henning P. Schmiedehausen  -- [EMAIL PROTECTED] | J2EE, Linux,
91054 Buckenhof, Germany   -- +49 9131 506540 | Apache person
Open Source Consulting, Development, Design | Velocity - Turbine guy

          "Save the cheerleader. Save the world."

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to