I wouldn't say it need be sopisticated, but certainly could be more elegant...
It also can be very simple if the attrbutes are set up with simplicity. Ask for clarification of anything I'm about to try to describe that may not be understood:
When reviewing the option names entered in the option names manager for the size of the bottle, is there only one such option name that is applied to all scent product that come in a size? Or is there several like fragrance1 size, fragrance2 size, etc....?
If the answer is that every fragrance has the exact same option_id (data value of the option name) then they will also all have the same option_value_id for the 1ml option.
With those two pieces known, when an item is added to the cart, two ways to approach, either first see if the item being added is a limiting product and then see if the limit has been reached (I think this is the preferred sequence) or identify hoow many of the limiting product are in the cart and then if the add-to-cart is the limiting item and te sum of the existing and new exceeds the limit take appropriate action...
Both end up either allowing, preventing, or partially allowing product being added, but there are differences in the amount of "work" they each perform.
Sure it can be coded to handle several different option_id and option_value_id pairs, but the simplest both for the code and I would say for operation/maintenance is for all product to be sold with the same type option to just simply use the same option(s) throughout.



Reply With Quote

