Why was there not a "_CalculatedCogs" variable added to the CommerceBuilder.Products.ProductVariant.cs class?
It's easy enough to simply add and calculate with the rest of them, but with the other "_Calculated..." variables, it just seems like this one may have simply been overlooked?
Any fellow source code holders have any thoughts on this one? I don't see how I can break anything by adding it, and my initial testing works as expected.
Source Code Question
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 42
- Joined: Fri Apr 15, 2011 11:04 pm
Source Code Question
Jason Hendee
Cables for Less
Cables for Less
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Source Code Question
I haven't looked at it, but if it is a calculated field based on other variables, it wouldn't be a good idea to have it in the source code because then it couldn't be customized later. For example, on shipping method rates there is something calculated in the source code (don't remember what) and we had a client who wanted one variant of a product to be available for free shipping, but the other variants to not be available. So I tried to take the weight off the one variant thru checkout and couldn't because of whatever was calculated within the source code and sent across to the shipping provider.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 42
- Joined: Fri Apr 15, 2011 11:04 pm
Re: Source Code Question
The SQL table [ac_OptionChoices] contains fields called [PriceModifier], [CogsModifier], [WeightModifier] & [SkuModifier]. Of these four very relevant "modifier" fields, only the COGS is not calculated in the ProductVariant class, based on a product's currently selected options (in the CalculateVariant() method). So when a product with options - that each have their own COGS defined - gets added to the basket and finalized in an order, the true COGS for that line item does not get calculated.
So I was simply proposing that this variable/field was mistakenly left out of said class. When would you not want to properly calculate the true COGS if it's defined per option in the database? And I guess due to the nature of this field, and the already-present iteration through a product's currently selected options in the ProductVariant class, I don't know where else such a customization would be made to make sure it's properly encapsulated.
So I was simply proposing that this variable/field was mistakenly left out of said class. When would you not want to properly calculate the true COGS if it's defined per option in the database? And I guess due to the nature of this field, and the already-present iteration through a product's currently selected options in the ProductVariant class, I don't know where else such a customization would be made to make sure it's properly encapsulated.
Jason Hendee
Cables for Less
Cables for Less