Call the method setItemShipGroupQty of ShoppingCart class from a simple method

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Call the method setItemShipGroupQty of ShoppingCart class from a simple method

risalitim@gmail.com
Hi to all,

I'm trying to call from a simple method the method  
setItemShipGroupQty() of ShoppingCart but actually it accepts only  
some parameters with native type double and int and so it gives to me  
an error from the simple method.

I have tried to add this method and now everything is ok.

public void setItemShipGroupQty(ShoppingCartItem item, Double  
quantity, Integer idx) {
     this.setItemShipGroupQty(item, this.getItemIndex(item),  
quantity.doubleValue(), idx.intValue());
}

Is it ok if I add this method or did you have a different idea to  
solve this problem ?

Thanks in advance
Marco
Reply | Threaded
Open this post in threaded view
|

Re: Call the method setItemShipGroupQty of ShoppingCart class from a simple method

Mridul Pathak-2
Marco,

     I think we can call any method accepting native types from a  
simple method by just specifying native data type in type attribute of  
<field> element.  I have tried this with boolean and it worked for  
me.  Here is one code snippet from FixedAssetServices.xml:

<set field="startIndex" value="0" type="Integer"/>
<set field="endIndex" value="4" type="Integer"/>

<!-- Extract asset end of life year from field expectedEndOfLife -->
<if-not-empty field="fixedAsset.expectedEndOfLife">
     <set field="expectedEndOfLife" from-
field="fixedAsset.expectedEndOfLife"/>
     <to-string field-name="expectedEndOfLife"/>
     <call-object-method method-name="substring" obj-field-
name="expectedEndOfLife" ret-field-name="expEndOfLifeYear">
         <field field-name="startIndex" type="int"/>
         <field field-name="endIndex" type="int"/>
     </call-object-method>
<else>
     <add-error><fail-property resource="AccountingUiLabels"  
property="AccountingExpEndOfLifeIsEmpty"/></add-error>
     <check-errors/>
</else>
</if-not-empty>


--
Thanks & Regards,

Mridul Pathak
HotWax Media, Inc.
http://www.hotwaxmedia.com
[hidden email]





On Jul 31, 2008, at 12:45 AM, [hidden email] wrote:

> Hi to all,
>
> I'm trying to call from a simple method the method  
> setItemShipGroupQty() of ShoppingCart but actually it accepts only  
> some parameters with native type double and int and so it gives to  
> me an error from the simple method.
>
> I have tried to add this method and now everything is ok.
>
> public void setItemShipGroupQty(ShoppingCartItem item, Double  
> quantity, Integer idx) {
>    this.setItemShipGroupQty(item, this.getItemIndex(item),  
> quantity.doubleValue(), idx.intValue());
> }
>
> Is it ok if I add this method or did you have a different idea to  
> solve this problem ?
>
> Thanks in advance
> Marco

Reply | Threaded
Open this post in threaded view
|

Re: Call the method setItemShipGroupQty of ShoppingCart class from a simple method

mrisaliti@libero.it
In reply to this post by risalitim@gmail.com
Thanks a lot Mridul for your suggestions, I will try it later.

Marco

> Marco,
>
>      I think we can call any method accepting native types from a
> simple method by just specifying native data type in type attribute of
> <field> element.  I have tried this with boolean and it worked for
> me.  Here is one code snippet from FixedAssetServices.xml:
>
> <set field="startIndex" value="0" type="Integer"/>
> <set field="endIndex" value="4" type="Integer"/>
>
> <!-- Extract asset end of life year from field expectedEndOfLife -->
> <if-not-empty field="fixedAsset.expectedEndOfLife">
>      <set field="expectedEndOfLife" from-
> field="fixedAsset.expectedEndOfLife"/>
>      <to-string field-name="expectedEndOfLife"/>
>      <call-object-method method-name="substring" obj-field-
> name="expectedEndOfLife" ret-field-name="expEndOfLifeYear">
>          <field field-name="startIndex" type="int"/>
>          <field field-name="endIndex" type="int"/>
>      </call-object-method>
> <else>
>      <add-error><fail-property resource="AccountingUiLabels"
> property="AccountingExpEndOfLifeIsEmpty"/></add-error>
>      <check-errors/>
> </else>
> </if-not-empty>
>
>
> --
> Thanks & Regards,
>
> Mridul Pathak
> HotWax Media, Inc.
> http://www.hotwaxmedia.com
> [hidden email]
>
>
>
>
>
> On Jul 31, 2008, at 12:45 AM, [hidden email] wrote:
>
> > Hi to all,
> >
> > I'm trying to call from a simple method the method
> > setItemShipGroupQty() of ShoppingCart but actually it accepts only
> > some parameters with native type double and int and so it gives to
> > me an error from the simple method.
> >
> > I have tried to add this method and now everything is ok.
> >
> > public void setItemShipGroupQty(ShoppingCartItem item, Double
> > quantity, Integer idx) {
> >    this.setItemShipGroupQty(item, this.getItemIndex(item),
> > quantity.doubleValue(), idx.intValue());
> > }
> >
> > Is it ok if I add this method or did you have a different idea to
> > solve this problem ?
> >
> > Thanks in advance
> > Marco
>
>