I'm trying to set up an EE e-commerce site for the following scenario:
- A product categories list that is 4 levels deep. The product categories will have at least two custom category fields:
amount
andamount_type
. These fields represent the markup (profit) of a particular product associated with the category. Example values are: {10, 'percentage'} or {5, 'amount'}. NOTE: products will only be assigned the lowest level category. - The Channel that has the Store field will have a custom channel field
cost.
This represents the cost of the product to the retailer. - Optionally set the
price
.
In the frontend, I want customers to see this:
- If the
price
field is populated, show that amount. - If the
price
field is not populated, then compute the selling price by usingcost
custom Channel field andamount
andamount_type
custom Categories fields.
As there is no requirement for the lowest level categories to actually have a value for amount
and amount_type
, the frontend logic would need to keep checking the parent category until it finds a category level that does have those fields populated. The root nodes will always be populated.
It appears that price
is required, though. So, what might I be able to do in order to support this custom business logic? Perhaps I set the price to an invalid value, like -1
and do checks in the frontend based on that somehow?