- ORM-D: Consumer commodity hazardous chemicals (aerosols) can only ship via ground
- Perishable: Food items can only ship via ground in Zone 1, otherwise must ship via air
- Domestic Only: We chose not to send electronics internationally due to differences in electric grid
We also need to add custom fields to the Ship Methods for Min Weight, Max Weight, Disallow ORM-D, Disallow Perishable, Disallow Domestic Only. I see that there is a custom fields table and that I can pretty easily add these fields to that table. Then I just have to customize the ShipMethod page to filter out the ship methods based on the contents of the cart.
My concerns are that I have to write 5-10 lines of convoluted code to select each property, test for it's existence, create a new property if it doesn't exist, and update the value. In addition it makes an additional database hit every time I need to access custom properties. It would be tons easier to have typed properties on the class, like Product.Ormd, as opposed to this:
Code: Select all
// Load ORM-D flag
var ormd = _Product.CustomFields.FirstOrDefault(x => x.FieldName == "ORM-D");
if (ormd != null)
Ormd.Checked = bool.Parse(ormd.FieldValue);
Code: Select all
// Set ORM-D value
var ormd = product.CustomFields.FirstOrDefault(x => x.FieldName == "ORM-D");
if (ormd == null)
{
ormd = new ProductCustomField(product, false, true, "ORM-D");
product.CustomFields.Add(ormd);
}
ormd.FieldValue = Ormd.Checked.ToString();
I just don't want to travel too far down one path and then get stuck. We use source control, so theoretically, I should be able to compare and merge changes as AbleCommerce releases them. Does anyone have experience with deeper customizations like this? Which method do you prefer?