You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Heidi Dehaes - Olagos <in...@gmail.com> on 2017/06/27 18:54:47 UTC

the price of an object and the cart object

Hello,

Can anyone give me a hint on how the price which is visualised at a product
in the ecommerce site comes into the cart object for visualisation on the
cart.
I know it is sent via a form into the "additem" request. Via the controller
it goes to the "addToCart" method in the ShoppingCartEvents.java file and
in that method there it goes via the call "cartHelper.addToCart" further.
But i don't see in detail where the price of the product goes into the cart
object.

Can anyone help me? I don't find it immediately.

Thanks in advance,
Eric


Olagos bvba
Heidi Dehaes
Kerkstraat 34
2570 Duffel
Belgium
Tel. :     015/31 53 04
GSM :    0485/22 35 80
E-mail : info.olagos@gmail.com
http://www.olagos.eu
http://www.olagos.com
http://www.olagos.be
http://www.olagos.nl

Re: the price of an object and the cart object

Posted by Heidi Dehaes - Olagos <in...@gmail.com>.
Thanks Taher,

But i need specially to know where cart.price = price is set.

Deepak gave me also more information.

Thanks,
Eric

Olagos bvba
Heidi Dehaes
Kerkstraat 34
2570 Duffel
Belgium
Tel. :     015/31 53 04
GSM :    0485/22 35 80
E-mail : info.olagos@gmail.com
http://www.olagos.eu
http://www.olagos.com
http://www.olagos.be
http://www.olagos.nl



2017-06-28 9:31 GMT+02:00 Taher Alkhateeb <sl...@gmail.com>:

> First of all, just to get it out of my system, this method is 500
> lines long .. OUCH! The file itself is 2000 lines long. We got to
> refactor the entire damn thing.
>
> From what I see the cartHelper.addToCart(...) method takes 21
> arguments (ouch again) one of them being the price. The price itself
> is set from a priceStr variable in the code snippet:
>
> price = (BigDecimal) ObjectType.simpleTypeConvert(priceStr,
> "BigDecimal", null, locale);
>
> And priceStr itself is set with:
>
> priceStr = (String) paramMap.remove("PRICE")
>
> I hope I got things right, maybe others can help if I missed something.
>
> On Tue, Jun 27, 2017 at 9:54 PM, Heidi Dehaes - Olagos
> <in...@gmail.com> wrote:
> > Hello,
> >
> > Can anyone give me a hint on how the price which is visualised at a
> product
> > in the ecommerce site comes into the cart object for visualisation on the
> > cart.
> > I know it is sent via a form into the "additem" request. Via the
> controller
> > it goes to the "addToCart" method in the ShoppingCartEvents.java file and
> > in that method there it goes via the call "cartHelper.addToCart" further.
> > But i don't see in detail where the price of the product goes into the
> cart
> > object.
> >
> > Can anyone help me? I don't find it immediately.
> >
> > Thanks in advance,
> > Eric
> >
> >
> > Olagos bvba
> > Heidi Dehaes
> > Kerkstraat 34
> > 2570 Duffel
> > Belgium
> > Tel. :     015/31 53 04
> > GSM :    0485/22 35 80
> > E-mail : info.olagos@gmail.com
> > http://www.olagos.eu
> > http://www.olagos.com
> > http://www.olagos.be
> > http://www.olagos.nl
>

Re: the price of an object and the cart object

Posted by Heidi Dehaes - Olagos <in...@gmail.com>.
Thanks Deepak,

I will investigate it further.
I seems understandable.

Regards,
Eric

Olagos bvba
Heidi Dehaes
Kerkstraat 34
2570 Duffel
Belgium
Tel. :     015/31 53 04
GSM :    0485/22 35 80
E-mail : info.olagos@gmail.com
http://www.olagos.eu
http://www.olagos.com
http://www.olagos.be
http://www.olagos.nl



2017-06-28 10:01 GMT+02:00 Deepak Dixit <de...@hotwaxsystems.com>:

> Hi Heidi Dehaes,
>
> ShoppingCartItem price set from ShoppingCartItem.updatePrice method.
>
> ShoppingCart.addOrIncreaseItem calls the sci.setQuantityand
> ShoppingCartItem.setQuantity calls the ShoppingCartItem.updatePrice
>
> and it calls the calculateProductPrice service to get the product price.
>
>
> for addItem flow its for CSR user, if CSR want to override the price for an
> item then CSR can set it. It should be permission driven, IF user has
> permission to modify system generated price then only user can modify it.
>
>
>
>
> Thanks & Regards
> --
> Deepak Dixit
> www.hotwaxsystems.com
> www.hotwax.co
>
> On Wed, Jun 28, 2017 at 1:01 PM, Taher Alkhateeb <
> slidingfilaments@gmail.com
> > wrote:
>
> > First of all, just to get it out of my system, this method is 500
> > lines long .. OUCH! The file itself is 2000 lines long. We got to
> > refactor the entire damn thing.
> >
> > From what I see the cartHelper.addToCart(...) method takes 21
> > arguments (ouch again) one of them being the price. The price itself
> > is set from a priceStr variable in the code snippet:
> >
> > price = (BigDecimal) ObjectType.simpleTypeConvert(priceStr,
> > "BigDecimal", null, locale);
> >
> > And priceStr itself is set with:
> >
> > priceStr = (String) paramMap.remove("PRICE")
> >
> > I hope I got things right, maybe others can help if I missed something.
> >
> > On Tue, Jun 27, 2017 at 9:54 PM, Heidi Dehaes - Olagos
> > <in...@gmail.com> wrote:
> > > Hello,
> > >
> > > Can anyone give me a hint on how the price which is visualised at a
> > product
> > > in the ecommerce site comes into the cart object for visualisation on
> the
> > > cart.
> > > I know it is sent via a form into the "additem" request. Via the
> > controller
> > > it goes to the "addToCart" method in the ShoppingCartEvents.java file
> and
> > > in that method there it goes via the call "cartHelper.addToCart"
> further.
> > > But i don't see in detail where the price of the product goes into the
> > cart
> > > object.
> > >
> > > Can anyone help me? I don't find it immediately.
> > >
> > > Thanks in advance,
> > > Eric
> > >
> > >
> > > Olagos bvba
> > > Heidi Dehaes
> > > Kerkstraat 34
> > > 2570 Duffel
> > > Belgium
> > > Tel. :     015/31 53 04
> > > GSM :    0485/22 35 80
> > > E-mail : info.olagos@gmail.com
> > > http://www.olagos.eu
> > > http://www.olagos.com
> > > http://www.olagos.be
> > > http://www.olagos.nl
> >
>

Re: the price of an object and the cart object

Posted by Heidi Dehaes - Olagos <in...@gmail.com>.
Hi Deepak,

Thanks again. I was blocked on ShoppingCart.addOrIncreaseItem . Then i
couldn't find it further.

I will investigate it this evening.

Regards,
Eric

Olagos bvba
Heidi Dehaes
Kerkstraat 34
2570 Duffel
Belgium
Tel. :     015/31 53 04
GSM :    0485/22 35 80
E-mail : info.olagos@gmail.com
http://www.olagos.eu
http://www.olagos.com
http://www.olagos.be
http://www.olagos.nl



2017-06-28 10:01 GMT+02:00 Deepak Dixit <de...@hotwaxsystems.com>:

> Hi Heidi Dehaes,
>
> ShoppingCartItem price set from ShoppingCartItem.updatePrice method.
>
> ShoppingCart.addOrIncreaseItem calls the sci.setQuantityand
> ShoppingCartItem.setQuantity calls the ShoppingCartItem.updatePrice
>
> and it calls the calculateProductPrice service to get the product price.
>
>
> for addItem flow its for CSR user, if CSR want to override the price for an
> item then CSR can set it. It should be permission driven, IF user has
> permission to modify system generated price then only user can modify it.
>
>
>
>
> Thanks & Regards
> --
> Deepak Dixit
> www.hotwaxsystems.com
> www.hotwax.co
>
> On Wed, Jun 28, 2017 at 1:01 PM, Taher Alkhateeb <
> slidingfilaments@gmail.com
> > wrote:
>
> > First of all, just to get it out of my system, this method is 500
> > lines long .. OUCH! The file itself is 2000 lines long. We got to
> > refactor the entire damn thing.
> >
> > From what I see the cartHelper.addToCart(...) method takes 21
> > arguments (ouch again) one of them being the price. The price itself
> > is set from a priceStr variable in the code snippet:
> >
> > price = (BigDecimal) ObjectType.simpleTypeConvert(priceStr,
> > "BigDecimal", null, locale);
> >
> > And priceStr itself is set with:
> >
> > priceStr = (String) paramMap.remove("PRICE")
> >
> > I hope I got things right, maybe others can help if I missed something.
> >
> > On Tue, Jun 27, 2017 at 9:54 PM, Heidi Dehaes - Olagos
> > <in...@gmail.com> wrote:
> > > Hello,
> > >
> > > Can anyone give me a hint on how the price which is visualised at a
> > product
> > > in the ecommerce site comes into the cart object for visualisation on
> the
> > > cart.
> > > I know it is sent via a form into the "additem" request. Via the
> > controller
> > > it goes to the "addToCart" method in the ShoppingCartEvents.java file
> and
> > > in that method there it goes via the call "cartHelper.addToCart"
> further.
> > > But i don't see in detail where the price of the product goes into the
> > cart
> > > object.
> > >
> > > Can anyone help me? I don't find it immediately.
> > >
> > > Thanks in advance,
> > > Eric
> > >
> > >
> > > Olagos bvba
> > > Heidi Dehaes
> > > Kerkstraat 34
> > > 2570 Duffel
> > > Belgium
> > > Tel. :     015/31 53 04
> > > GSM :    0485/22 35 80
> > > E-mail : info.olagos@gmail.com
> > > http://www.olagos.eu
> > > http://www.olagos.com
> > > http://www.olagos.be
> > > http://www.olagos.nl
> >
>

Re: the price of an object and the cart object

Posted by Deepak Dixit <de...@hotwaxsystems.com>.
Hi Heidi Dehaes,

ShoppingCartItem price set from ShoppingCartItem.updatePrice method.

ShoppingCart.addOrIncreaseItem calls the sci.setQuantityand
ShoppingCartItem.setQuantity calls the ShoppingCartItem.updatePrice

and it calls the calculateProductPrice service to get the product price.


for addItem flow its for CSR user, if CSR want to override the price for an
item then CSR can set it. It should be permission driven, IF user has
permission to modify system generated price then only user can modify it.




Thanks & Regards
--
Deepak Dixit
www.hotwaxsystems.com
www.hotwax.co

On Wed, Jun 28, 2017 at 1:01 PM, Taher Alkhateeb <slidingfilaments@gmail.com
> wrote:

> First of all, just to get it out of my system, this method is 500
> lines long .. OUCH! The file itself is 2000 lines long. We got to
> refactor the entire damn thing.
>
> From what I see the cartHelper.addToCart(...) method takes 21
> arguments (ouch again) one of them being the price. The price itself
> is set from a priceStr variable in the code snippet:
>
> price = (BigDecimal) ObjectType.simpleTypeConvert(priceStr,
> "BigDecimal", null, locale);
>
> And priceStr itself is set with:
>
> priceStr = (String) paramMap.remove("PRICE")
>
> I hope I got things right, maybe others can help if I missed something.
>
> On Tue, Jun 27, 2017 at 9:54 PM, Heidi Dehaes - Olagos
> <in...@gmail.com> wrote:
> > Hello,
> >
> > Can anyone give me a hint on how the price which is visualised at a
> product
> > in the ecommerce site comes into the cart object for visualisation on the
> > cart.
> > I know it is sent via a form into the "additem" request. Via the
> controller
> > it goes to the "addToCart" method in the ShoppingCartEvents.java file and
> > in that method there it goes via the call "cartHelper.addToCart" further.
> > But i don't see in detail where the price of the product goes into the
> cart
> > object.
> >
> > Can anyone help me? I don't find it immediately.
> >
> > Thanks in advance,
> > Eric
> >
> >
> > Olagos bvba
> > Heidi Dehaes
> > Kerkstraat 34
> > 2570 Duffel
> > Belgium
> > Tel. :     015/31 53 04
> > GSM :    0485/22 35 80
> > E-mail : info.olagos@gmail.com
> > http://www.olagos.eu
> > http://www.olagos.com
> > http://www.olagos.be
> > http://www.olagos.nl
>

Re: the price of an object and the cart object

Posted by Taher Alkhateeb <sl...@gmail.com>.
First of all, just to get it out of my system, this method is 500
lines long .. OUCH! The file itself is 2000 lines long. We got to
refactor the entire damn thing.

From what I see the cartHelper.addToCart(...) method takes 21
arguments (ouch again) one of them being the price. The price itself
is set from a priceStr variable in the code snippet:

price = (BigDecimal) ObjectType.simpleTypeConvert(priceStr,
"BigDecimal", null, locale);

And priceStr itself is set with:

priceStr = (String) paramMap.remove("PRICE")

I hope I got things right, maybe others can help if I missed something.

On Tue, Jun 27, 2017 at 9:54 PM, Heidi Dehaes - Olagos
<in...@gmail.com> wrote:
> Hello,
>
> Can anyone give me a hint on how the price which is visualised at a product
> in the ecommerce site comes into the cart object for visualisation on the
> cart.
> I know it is sent via a form into the "additem" request. Via the controller
> it goes to the "addToCart" method in the ShoppingCartEvents.java file and
> in that method there it goes via the call "cartHelper.addToCart" further.
> But i don't see in detail where the price of the product goes into the cart
> object.
>
> Can anyone help me? I don't find it immediately.
>
> Thanks in advance,
> Eric
>
>
> Olagos bvba
> Heidi Dehaes
> Kerkstraat 34
> 2570 Duffel
> Belgium
> Tel. :     015/31 53 04
> GSM :    0485/22 35 80
> E-mail : info.olagos@gmail.com
> http://www.olagos.eu
> http://www.olagos.com
> http://www.olagos.be
> http://www.olagos.nl