Commerce Server General - Fractional Quantities - CS2007

This is Interesting: Free IT Magazines  
Home > Archive > Commerce Server General > October 2006 > Fractional Quantities - CS2007





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Fractional Quantities - CS2007
Vince Cooper

2006-10-25, 1:24 am

We are having trouble with using fractional quantities. Is CS2007 really
setup so that you cannot use a quantity of 1.5 or something similar. We
found when reflecting the LineItem object where the quantity was being cast
to an Int32 which of course strips all of the precission. Do we have to
extend the object and create our own Quantity management stuff in order to
have fractional quantities?

-Vince


Joseph Johnson

2006-10-25, 1:24 am

Vince,

This would seem to coincide from the discussion from last week labeled
"Pipeline / Gift Issue,".

The documentation seems to suggest that quantity is of type decimal, but it
seems from this earlier post that it is in fact an integer.

Joe

"Vince Cooper" <vcooper@oakwoodsys.com> wrote in message
news:28183559716c8c8c59504f75920@msnews.microsoft.com...
> We are having trouble with using fractional quantities. Is CS2007 really
> setup so that you cannot use a quantity of 1.5 or something similar. We
> found when reflecting the LineItem object where the quantity was being
> cast to an Int32 which of course strips all of the precission. Do we have
> to extend the object and create our own Quantity management stuff in order
> to have fractional quantities?
>
> -Vince
>
>



Mike Langley

2006-10-25, 1:25 pm

Hi Joe,
I've been working with Vince on this issue and here is the code I reflected
from the LineItem class.

internal void InternalSetQuantity(decimal quantity)
{
if (quantity >= new decimal(0))
{
if (quantity == ((decimal) Convert.ToInt32(quantity)))
{
this.quantity = quantity;
return;
}
throw new
InvalidOperationException(RuntimeMessage
s.GetString("InvalidQuantityValue"));
}
string text1 = string.Format(CultureInfo.CurrentCulture,
RuntimeMessages.GetString("InvalidPropertyValue"), new object[] {
"Quantity" });
throw new ArgumentException(text1, "Quantity");
}

As you can see the quantity is passed in as a decimal and then cast to an
Int32 which strips off all the precission of the decimal and then they cast
it back to the decimal. I guess our question is do we need to write our own
LineItem class to fix this issue. I honestly don't see the point in the
casts that have been made here, can anyone shed some light on this?

Mike

"Joseph Johnson" <joe8t88@hotmail.com> wrote in message
news:ekGB%23$69GHA.360@TK2MSFTNGP04.phx.gbl...
> Vince,
>
> This would seem to coincide from the discussion from last week labeled
> "Pipeline / Gift Issue,".
>
> The documentation seems to suggest that quantity is of type decimal, but
> it seems from this earlier post that it is in fact an integer.
>
> Joe
>
> "Vince Cooper" <vcooper@oakwoodsys.com> wrote in message
> news:28183559716c8c8c59504f75920@msnews.microsoft.com...
>
>



Mike Langley

2006-10-26, 1:21 am

Actually, now that I've taken a better look at this theres no way this
property will ever work if you pass in a decimal. Once you've passed a
fractional decimal to this method it will never pass the if statement and
always throw an exception. This is definately a bug that needs to be fixed.

Mike
"Mike Langley" <mike_langley68@msn.com> wrote in message
news:OUzPp6E%23GHA.4428@TK2MSFTNGP04.phx.gbl...
> Hi Joe,
> I've been working with Vince on this issue and here is the code I
> reflected from the LineItem class.
>
> internal void InternalSetQuantity(decimal quantity)
> {
> if (quantity >= new decimal(0))
> {
> if (quantity == ((decimal) Convert.ToInt32(quantity)))
> {
> this.quantity = quantity;
> return;
> }
> throw new
> InvalidOperationException(RuntimeMessage
s.GetString("InvalidQuantityValue"));
> }
> string text1 = string.Format(CultureInfo.CurrentCulture,
> RuntimeMessages.GetString("InvalidPropertyValue"), new object[] {
> "Quantity" });
> throw new ArgumentException(text1, "Quantity");
> }
>
> As you can see the quantity is passed in as a decimal and then cast to an
> Int32 which strips off all the precission of the decimal and then they
> cast it back to the decimal. I guess our question is do we need to write
> our own LineItem class to fix this issue. I honestly don't see the point
> in the casts that have been made here, can anyone shed some light on this?
>
> Mike
>
> "Joseph Johnson" <joe8t88@hotmail.com> wrote in message
> news:ekGB%23$69GHA.360@TK2MSFTNGP04.phx.gbl...
>
>



Vinayak Tadas[MSFT]

2006-10-28, 1:33 pm

Commerce Server 2007 does not support fractional quantities.

Thanks
Vinayak Tadas
Microsoft
http://blogs.msdn.com/vinayakt

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights
reserved.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Get Secure! For more info visit http://www.microsoft.com/security. Please
reply to the newsgroups only


--------------------
From: "Mike Langley" <mike_langley68@msn.com>
References: <28183559716c8c8c59504f75920@msnews.microsoft.com>
<ekGB#$69GHA.360@TK2MSFTNGP04.phx.gbl>
<OUzPp6E#GHA.4428@TK2MSFTNGP04.phx.gbl>
Subject: Re: Fractional Quantities - CS2007
Date: Wed, 25 Oct 2006 11:53:12 -0500
Lines: 68
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Response
Message-ID: <ui4DQYF#GHA.924@TK2MSFTNGP03.phx.gbl>
Newsgroups: microsoft.public.commerceserver.general
NNTP-Posting-Host: static-206.196.102.238.primary.net 206.196.102.238
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.commerceserver.general:18769
X-Tomcat-NG: microsoft.public.commerceserver.general

Actually, now that I've taken a better look at this theres no way this
property will ever work if you pass in a decimal. Once you've passed a
fractional decimal to this method it will never pass the if statement and
always throw an exception. This is definately a bug that needs to be fixed.

Mike
"Mike Langley" <mike_langley68@msn.com> wrote in message
news:OUzPp6E%23GHA.4428@TK2MSFTNGP04.phx.gbl...
> Hi Joe,
> I've been working with Vince on this issue and here is the code I
> reflected from the LineItem class.
>
> internal void InternalSetQuantity(decimal quantity)
> {
> if (quantity >= new decimal(0))
> {
> if (quantity == ((decimal) Convert.ToInt32(quantity)))
> {
> this.quantity = quantity;
> return;
> }
> throw new
>

InvalidOperationException(RuntimeMessage
s.GetString("InvalidQuantityValue"))
;
> }
> string text1 = string.Format(CultureInfo.CurrentCulture,
> RuntimeMessages.GetString("InvalidPropertyValue"), new object[] {
> "Quantity" });
> throw new ArgumentException(text1, "Quantity");
> }
>
> As you can see the quantity is passed in as a decimal and then cast to an
> Int32 which strips off all the precission of the decimal and then they
> cast it back to the decimal. I guess our question is do we need to write
> our own LineItem class to fix this issue. I honestly don't see the point
> in the casts that have been made here, can anyone shed some light on this?
>
> Mike
>
> "Joseph Johnson" <joe8t88@hotmail.com> wrote in message
> news:ekGB%23$69GHA.360@TK2MSFTNGP04.phx.gbl...
Quantity[vbcol=seagreen]
>
>




Steve

2006-10-28, 1:33 pm

Hello Vince,

I stumbled across a similar situation while developing our company's website.

Our websites sells whole products like "printers, faxes" and also products
that can be purchased by weight (for example cheese) a user can buy 0.5 pound
of cheese but not 0.5 printer you know... So Basically when you say 1.5
quantity of a product I am going to assume the product is like
"cheese/cream/lemons" and not printers/faxes/scanners and thus you can add a
weakly typed property = weight to define the quantities u like.

In my case, things are even more difficult. We sell some products in
packages that have a fix volume but variable weight, for example a solid
plastic box (of 1 liter volume) that can contain cheese or potato chips...
This box has a fixed volume but depending on the contents inside, the weight
will vary for example: 1litre of water weighs different than 1 liter of
cotton (just an example) so this box (1 liter) if it contains cheese it would
weigh (assuming 0.5 Kg) but u can't just say it's quantity = 0.5

What I did, is that when a user adds a product to the basket, the product
properties are calculated depending on the package, so a package that can
contain say 200grams of cheese is added to the basket as a single line item
with a (weight/Package : weakly type properties) of 200g and <b>quantity</b>
of 1....

If a user choose to buy 1.5 Kg of cheese then the MSCS will actually be
placing 2 line items (one for a 1.0 Kg of cheese and another for 0.5Kg of
cheese) each line item has a different weight/package (again weight/packages
are custom added weakly type properties)

So in your situation, I think this is what's going to happen:

A user places (say 350 gram of a product - remember this doesn’t mean
quantity = 0.35) what u can do is place a line item of that product, adds 350
to the weight (WTP) and after running the pipeline (because pipelines will
calculate price based on quantity) you update the price using a simple
mathematical operation:

1000g (1Kg) of product costs 10$
350g =??
And you got it...

You will also need to set "LineItemRollUp" to false when adding item to
basket because if a user chose to add the same product to the same basket
(but with a different weight) again the lineItem will have a quantity of 2
with similar weights both which is not the case


"Vince Cooper" wrote:

> We are having trouble with using fractional quantities. Is CS2007 really
> setup so that you cannot use a quantity of 1.5 or something similar. We
> found when reflecting the LineItem object where the quantity was being cast
> to an Int32 which of course strips all of the precission. Do we have to
> extend the object and create our own Quantity management stuff in order to
> have fractional quantities?
>
> -Vince
>
>
>

Joseph Johnson

2006-10-28, 1:33 pm

Steve and Mike,

I think the most elegant solution is to simply change your base unit of
measurement.

Going from the earlier example, if I create an entry for 1 Kg of cheese in
the product catalog at a rate of $10, it's only fair that customers *will
not* be able to purchase 350 grams of cheese. If I instead create an entry
for 1 gram of cheese at a cost of $.01, I've suddenly got a very intuitive
method for calculating how much 350 grams of cheese would cost, and I didn't
even have to change the pipeline!

While Steve's solution might work, removing the LineItemRollUp functionality
would definately cause an undesired effect on the presentation layer of the
application. (IE: I add two "computers" to my cart, then decide to add
another "computer", I now have two lineitems of the same product, one of
quantity 2 and the other of quantity 1. This would be really confusing to
shoppers who would expect to see three individual lineitems or one line item
with a quantity of 3).

Joe

In Steve's example, 1 Kg of a product costs $10. It is therefore reasonable
to infer that
"Steve" <Steve@discussions.microsoft.com> wrote in message
news:6044CAFD-E334-459F-8AA1-C1B71CBC5031@microsoft.com...[vbcol=seagreen]
> Hello Vince,
>
> I stumbled across a similar situation while developing our company's
> website.
>
> Our websites sells whole products like "printers, faxes" and also products
> that can be purchased by weight (for example cheese) a user can buy 0.5
> pound
> of cheese but not 0.5 printer you know... So Basically when you say 1.5
> quantity of a product I am going to assume the product is like
> "cheese/cream/lemons" and not printers/faxes/scanners and thus you can add
> a
> weakly typed property = weight to define the quantities u like.
>
> In my case, things are even more difficult. We sell some products in
> packages that have a fix volume but variable weight, for example a solid
> plastic box (of 1 liter volume) that can contain cheese or potato chips...
> This box has a fixed volume but depending on the contents inside, the
> weight
> will vary for example: 1litre of water weighs different than 1 liter of
> cotton (just an example) so this box (1 liter) if it contains cheese it
> would
> weigh (assuming 0.5 Kg) but u can't just say it's quantity = 0.5
>
> What I did, is that when a user adds a product to the basket, the product
> properties are calculated depending on the package, so a package that can
> contain say 200grams of cheese is added to the basket as a single line
> item
> with a (weight/Package : weakly type properties) of 200g and
> <b>quantity</b>
> of 1....
>
> If a user choose to buy 1.5 Kg of cheese then the MSCS will actually be
> placing 2 line items (one for a 1.0 Kg of cheese and another for 0.5Kg of
> cheese) each line item has a different weight/package (again
> weight/packages
> are custom added weakly type properties)
>
> So in your situation, I think this is what's going to happen:
>
> A user places (say 350 gram of a product - remember this doesn't mean
> quantity = 0.35) what u can do is place a line item of that product, adds
> 350
> to the weight (WTP) and after running the pipeline (because pipelines will
> calculate price based on quantity) you update the price using a simple
> mathematical operation:
>
> 1000g (1Kg) of product costs 10$
> 350g =??
> And you got it...
>
> You will also need to set "LineItemRollUp" to false when adding item to
> basket because if a user chose to add the same product to the same basket
> (but with a different weight) again the lineItem will have a quantity of 2
> with similar weights both which is not the case
>
>
> "Vince Cooper" wrote:
>


Vince Cooper

2006-10-28, 1:33 pm

Hello Vinayak Tadas[MSFT],

I hope this is an oversight that will be fixed in the first service pack.
There are a multitude of products that are sold with fractional quantities.
A pound and a half of this, a foot and a half of that... Ok, we'll rewrite
that part of our site.

Thanks!
-Vince


> Commerce Server 2007 does not support fractional quantities.
>
> Thanks
> Vinayak Tadas
> Microsoft
> http://blogs.msdn.com/vinayakt
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> You assume all risk for your use. © 2002 Microsoft Corporation. All
> rights
> reserved.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> Get Secure! For more info visit http://www.microsoft.com/security.
> Please
> reply to the newsgroups only
> --------------------
> From: "Mike Langley" <mike_langley68@msn.com>
> References: <28183559716c8c8c59504f75920@msnews.microsoft.com>
> <ekGB#$69GHA.360@TK2MSFTNGP04.phx.gbl>
> <OUzPp6E#GHA.4428@TK2MSFTNGP04.phx.gbl>
> Subject: Re: Fractional Quantities - CS2007
> Date: Wed, 25 Oct 2006 11:53:12 -0500
> Lines: 68
> X-Priority: 3
> X-MSMail-Priority: Normal
> X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
> X-RFC2646: Format=Flowed; Response
> Message-ID: <ui4DQYF#GHA.924@TK2MSFTNGP03.phx.gbl>
> Newsgroups: microsoft.public.commerceserver.general
> NNTP-Posting-Host: static-206.196.102.238.primary.net 206.196.102.238
> Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP03.phx.gbl
> Xref: TK2MSFTNGXA01.phx.gbl
> microsoft.public.commerceserver.general:18769
> X-Tomcat-NG: microsoft.public.commerceserver.general
> Actually, now that I've taken a better look at this theres no way this
> property will ever work if you pass in a decimal. Once you've passed a
> fractional decimal to this method it will never pass the if statement
> and always throw an exception. This is definately a bug that needs to
> be fixed.
>
> Mike
> "Mike Langley" <mike_langley68@msn.com> wrote in message
> news:OUzPp6E%23GHA.4428@TK2MSFTNGP04.phx.gbl...
> InvalidOperationException(RuntimeMessage
s.GetString("InvalidQuantityVa
> lue")) ;
>
> Quantity
>
> & #123;\rtf1\ansi\ansicpg1252\deff0\deflan
g1033{\fonttbl{\f0\fnil\fprq2\fcha
> rset0 MS Sans Serif;}}
> \viewkind4\uc1\pard\f0\fs20 Commerce Server 2007 does not support
> fractional quantities.
> \par
> \par Thanks
> \par Vinayak Tadas
> \par Microsoft
> \par http://blogs.msdn.com/vinayakt
> \par
> \par This posting is provided "AS IS" with no warranties, and confers
> no rights.
> \par You assume all risk for your use. 'c2'a9 2002 Microsoft
> Corporation. All rights
> \par reserved.
> \par Use of included script samples are subject to the terms
> specified at
> \par http://www.microsoft.com/info/cpyright.htm
> \par Get Secure! For more info visit
> http://www.microsoft.com/security. Please
> \par reply to the newsgroups only
> \par
> \par
> \par \pard\li720 --------------------
> \par From: "Mike Langley" <mike_langley68@msn.com>
> \par References: <28183559716c8c8c59504f75920@msnews.microsoft.com>
> <ekGB#$69GHA.360@TK2MSFTNGP04.phx.gbl>
> <OUzPp6E#GHA.4428@TK2MSFTNGP04.phx.gbl>
> \par Subject: Re: Fractional Quantities - CS2007
> \par Date: Wed, 25 Oct 2006 11:53:12 -0500
> \par Lines: 68
> \par X-Priority: 3
> \par X-MSMail-Priority: Normal
> \par X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
> \par X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
> \par X-RFC2646: Format=Flowed; Response
> \par Message-ID: <ui4DQYF#GHA.924@TK2MSFTNGP03.phx.gbl>
> \par Newsgroups: microsoft.public.commerceserver.general
> \par NNTP-Posting-Host: static-206.196.102.238.primary.net
> 206.196.102.238
> \par Path:
> TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSFTNGP03.phx.gbl
> \par Xref: TK2MSFTNGXA01.phx.gbl
> microsoft.public.commerceserver.general:18769
> \par X-Tomcat-NG: microsoft.public.commerceserver.general
> \par
> \par Actually, now that I've taken a better look at this theres no way
> this
> \par property will ever work if you pass in a decimal. Once you've
> passed a
> \par fractional decimal to this method it will never pass the if
> statement and
> \par always throw an exception. This is definately a bug that needs to
> be fixed.
> \par
> \par Mike
> \par "Mike Langley" <mike_langley68@msn.com> wrote in message
> \par news:OUzPp6E%23GHA.4428@TK2MSFTNGP04.phx.gbl...
> \par > Hi Joe,
> \par > I've been working with Vince on this issue and here is the code
> I
> \par > reflected from the LineItem class.
> \par >
> \par > internal void InternalSetQuantity(decimal quantity)
> \par > \{
> \par > if (quantity >= new decimal(0))
> \par > \{
> \par > if (quantity == ((decimal)
> Convert.ToInt32(quantity)))
> \par > \{
> \par > this.quantity = quantity;
> \par > return;
> \par > \}
> \par > throw new
> \par >
> InvalidOperationException(RuntimeMessage
s.GetString("InvalidQuantityVa
> lue"));
> \par > \}
> \par > string text1 = string.Format(CultureInfo.CurrentCulture,
> \par > RuntimeMessages.GetString("InvalidPropertyValue"), new object[]
> \{
> \par > "Quantity" \});
> \par > throw new ArgumentException(text1, "Quantity");
> \par > \}
> \par >
> \par > As you can see the quantity is passed in as a decimal and then
> cast to an
> \par > Int32 which strips off all the precission of the decimal and
> then they
> \par > cast it back to the decimal. I guess our question is do we need
> to write
> \par > our own LineItem class to fix this issue. I honestly don't see
> the point
> \par > in the casts that have been made here, can anyone shed some
> light on this?
> \par >
> \par > Mike
> \par >
> \par > "Joseph Johnson" <joe8t88@hotmail.com> wrote in message
> \par > news:ekGB%23$69GHA.360@TK2MSFTNGP04.phx.gbl...
> \par >> Vince,
> \par >>
> \par >> This would seem to coincide from the discussion from last week
> labeled
> \par >> "Pipeline / Gift Issue,".
> \par >>
> \par >> The documentation seems to suggest that quantity is of type
> decimal, but
> \par >> it seems from this earlier post that it is in fact an integer.
> \par >>
> \par >> Joe
> \par >>
> \par >> "Vince Cooper" <vcooper@oakwoodsys.com> wrote in message
> \par >> news:28183559716c8c8c59504f75920@msnews.microsoft.com...
> \par >>> We are having trouble with using fractional quantities. Is
> CS2007
> \par >>> really setup so that you cannot use a quantity of 1.5 or
> something
> \par >>> similar. We found when reflecting the LineItem object where
> the
> \par >>> quantity was being cast to an Int32 which of course strips
> all of the
> \par >>> precission. Do we have to extend the object and create our
> own Quantity
> \par >>> management stuff in order to have fractional quantities?
> \par >>>
> \par >>> -Vince
> \par >>>
> \par >>>
> \par >>
> \par >>
> \par >
> \par >
> \par
> \par
> \par \pard
> \par
> \par }



Steve

2006-10-28, 1:33 pm

Vince,

Joe's solution may be more appropriate for you in your case...

The example I gave reflects the nature of my website. Some matters need to
be taken into consideration:

For example: LineItemRollUp set to false:
This is required in my situation because I don’t want MSCS to merge 2 same
products with different packaging together, instead I treat them as different
lineItems then I run a procedure that checks whether these 2 lineItems have
same productId and same package type and update the quantity accordingly.

Using grams as base unit is not an option in my situation. Simply put, a
user buys say 350 grams of cheese so to MSCS this would be quantity = 350,
now what if a user adds another 350 grams of the same cheese!! If
LineItemRollUp is disabled, the MSCS will have 2 line items, of the same
product. If the LineItemRollUp is enabled, the MSCS will adds the 350 to the
other 350 and then you'll have no way to figure whether the user has ordered
say: 2 x 350 grams (small bag of cheese) or a 1x700 (large bag of cheese) :
assuming (for the sake of this example) you sell cheese in two types of bag
(small & large)

Furthermore in my website some (but not all)... some packages do have a
price of their own (not the cheap plastic bags but the heavy wooden box) so
the website needs to calculate the products cost and the package cost then
sums them all together...

I managed to do this as a standalone procedure, that is called the after
running the basket pipeline (simply because basket pipeline doesn’t support
this)...

But now I would like to create a custom pipeline component to reduce the
overhead on server, that way, I don’t have to run my own procedure after each
time the pipeline is called for…

But I still don't know how to read values from previous components of the
pipeline and how to write my own values for the following components to read,
and that will be my next question

"Joseph Johnson" wrote:

> Steve and Mike,
>
> I think the most elegant solution is to simply change your base unit of
> measurement.
>
> Going from the earlier example, if I create an entry for 1 Kg of cheese in
> the product catalog at a rate of $10, it's only fair that customers *will
> not* be able to purchase 350 grams of cheese. If I instead create an entry
> for 1 gram of cheese at a cost of $.01, I've suddenly got a very intuitive
> method for calculating how much 350 grams of cheese would cost, and I didn't
> even have to change the pipeline!
>
> While Steve's solution might work, removing the LineItemRollUp functionality
> would definately cause an undesired effect on the presentation layer of the
> application. (IE: I add two "computers" to my cart, then decide to add
> another "computer", I now have two lineitems of the same product, one of
> quantity 2 and the other of quantity 1. This would be really confusing to
> shoppers who would expect to see three individual lineitems or one line item
> with a quantity of 3).
>
> Joe
>
> In Steve's example, 1 Kg of a product costs $10. It is therefore reasonable
> to infer that
> "Steve" <Steve@discussions.microsoft.com> wrote in message
> news:6044CAFD-E334-459F-8AA1-C1B71CBC5031@microsoft.com...
>
>
>

Joseph Johnson

2006-10-31, 1:24 am

Steve,

The example you described with using LineItemRollUp on two distinct bags of
cheese is actually a good example of when you should consider using product
variants (or a product family, as the API would often suggest). IE: You
have one product called "cheese" and within that product you have two
variants, one of size 350, and the other of size 700. If the user adds both
of these products to the cart, they will actually show up as different line
items.

Looking back at this though, I am somehow confused as to how you let a user
buy a "stepped quantity" of goods, and yet you also sell the same goods at
fixed amounts AND that somehow determines the price of those goods. It
seems to me that a user who buys 700 1 gram units of cheese should end up
paying the same amount as someone who buys one 700 gram unit of cheese.
Keep in mind that the pipelines are currently set up to do pricing
calculations, and it sounds more and more like you need to develop a custom
pipeline to handle the packaging of goods.

To that end, I offer you this link:

http://blogs.msdn.com/maxakbar/arch...em/default.aspx

You'll notice a nice 4-part series of blog posts which will give you a
really in-depth look at how to develop pipelines, as well as what the
existing pipeline components are doing.

Joe


"Steve" <Steve@discussions.microsoft.com> wrote in message
news:3C321F97-5C0B-42A8-BB75-83C24238F630@microsoft.com...[vbcol=seagreen]
> Vince,
>
> Joe's solution may be more appropriate for you in your case...
>
> The example I gave reflects the nature of my website. Some matters need to
> be taken into consideration:
>
> For example: LineItemRollUp set to false:
> This is required in my situation because I don't want MSCS to merge 2 same
> products with different packaging together, instead I treat them as
> different
> lineItems then I run a procedure that checks whether these 2 lineItems
> have
> same productId and same package type and update the quantity accordingly.
>
> Using grams as base unit is not an option in my situation. Simply put, a
> user buys say 350 grams of cheese so to MSCS this would be quantity = 350,
> now what if a user adds another 350 grams of the same cheese!! If
> LineItemRollUp is disabled, the MSCS will have 2 line items, of the same
> product. If the LineItemRollUp is enabled, the MSCS will adds the 350 to
> the
> other 350 and then you'll have no way to figure whether the user has
> ordered
> say: 2 x 350 grams (small bag of cheese) or a 1x700 (large bag of cheese)
> :
> assuming (for the sake of this example) you sell cheese in two types of
> bag
> (small & large)
>
> Furthermore in my website some (but not all)... some packages do have a
> price of their own (not the cheap plastic bags but the heavy wooden box)
> so
> the website needs to calculate the products cost and the package cost then
> sums them all together...
>
> I managed to do this as a standalone procedure, that is called the after
> running the basket pipeline (simply because basket pipeline doesn't
> support
> this)...
>
> But now I would like to create a custom pipeline component to reduce the
> overhead on server, that way, I don't have to run my own procedure after
> each
> time the pipeline is called for.
>
> But I still don't know how to read values from previous components of the
> pipeline and how to write my own values for the following components to
> read,
> and that will be my next question
>
> "Joseph Johnson" wrote:
>


Steve H.

2006-10-31, 7:21 pm

Joseph,

First about using product Variants, is a good idea for general puposes,
however in my situation things are a bit different: (this is stated in the
pipeline/gift issue post) for example:
in our situation: consider a hard metal/wooden box: that box have a fix
volume, but a variable wait, if u put water in that box, it will have a
different weight then if it is filled with cotton/air/gum/etc..etc...

Now imagine you have 20 types of similar boxes.... having variants is simply
not an option, for every product (more than 100 products in this case) will
need to have 20 variants, you can imagine what nightmare this will be for the
person who is managing the catalog - not to mention what issues may future
needs impose on this scenrario.

So by adding a Weakly Type Property(WTP) "package" i can do a check up
whether the current product being added to the basket already exist in the
basket (by checking the product_id) and has the same package (by checking the
package WTP), if that product already exist with same package I simply update
the quantity.

As for your second question:
The stepped quantity is actually a whole one. so a 0.75Kg of a product is
actually a line item of quantity =1 and a weight = 0.75 (here weight is a
WTP).

Since pipeline handles all calculations, You were right I had to create a
custom pipeline component to handle my price/weight calculations...


"Joseph Johnson" wrote:

> Steve,
>
> The example you described with using LineItemRollUp on two distinct bags of
> cheese is actually a good example of when you should consider using product
> variants (or a product family, as the API would often suggest). IE: You
> have one product called "cheese" and within that product you have two
> variants, one of size 350, and the other of size 700. If the user adds both
> of these products to the cart, they will actually show up as different line
> items.
>
> Looking back at this though, I am somehow confused as to how you let a user
> buy a "stepped quantity" of goods, and yet you also sell the same goods at
> fixed amounts AND that somehow determines the price of those goods. It
> seems to me that a user who buys 700 1 gram units of cheese should end up
> paying the same amount as someone who buys one 700 gram unit of cheese.
> Keep in mind that the pipelines are currently set up to do pricing
> calculations, and it sounds more and more like you need to develop a custom
> pipeline to handle the packaging of goods.
>
> To that end, I offer you this link:
>
> http://blogs.msdn.com/maxakbar/arch...em/default.aspx
>
> You'll notice a nice 4-part series of blog posts which will give you a
> really in-depth look at how to develop pipelines, as well as what the
> existing pipeline components are doing.
>
> Joe
>
>
> "Steve" <Steve@discussions.microsoft.com> wrote in message
> news:3C321F97-5C0B-42A8-BB75-83C24238F630@microsoft.com...
>
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com