0

I'm trying to set up an EE e-commerce site for the following scenario:

  1. A product categories list that is 4 levels deep. The product categories will have at least two custom category fields: amount and amount_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.
  2. The Channel that has the Store field will have a custom channel field cost. This represents the cost of the product to the retailer.
  3. Optionally set the price.

In the frontend, I want customers to see this:

  1. If the price field is populated, show that amount.
  2. If the price field is not populated, then compute the selling price by using cost custom Channel field and amount and amount_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?

1

Store 2.x allows for user defined prices so you should be able to enter 0 in the price field then create some template logic when the price is 0 you would then run the math to get the correct price based upon your custom fields.

  • Well, I think a price of 0 would be a valid amount (meaning, free). So, I guess my -1 idea might work? Will Store allow me to define the price in the frontend? Basically letting me override what was entered in the Store field? – ExpressionEngineNewbie Jul 24 '14 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.