\CombinationProduct
A combination product combines several products into one new product.
The way this works is that the combo product links to zero or more products (many many relationship)
When you add the combo product, the individual products are added. A modifier adds the "discount" for the combo.
It also deletes all the products as soon as you delete one.
There are two restrictions to keep in mind:
(a) it only applies to products and not all buyables.
(b) all products need to return true for canPurchase. This means that if the product is available as part of a combo, it should also be available by itself.
We use the sort order for the order attribute to group it...
Synopsis
class CombinationProduct
extends Product
{
- // members
- private static array $db = ;
- private static array $many_many = ;
- private static array $searchable_fields = ;
- private static array $casting = ;
- private static string $singular_name = "Combination Product";
- private static string $plural_name = "Combination Products";
- private static string $default_parent = 'ProductGroup';
- private static string $default_sort = '"Title" ASC';
- private static string $icon = 'ecommerce_combo_product/images/icons/CombinationProduct';
- // methods
- public void i18n_singular_name()
- public void i18n_plural_name()
- public void getCMSFields()
- protected TreeMultiselectField getIncludedProductsFormField()
- public boolean canPurchase()
- public void classNameForOrderItem()
- public void getPrice()
- public void getCalculatedPrice()
- public void onBeforeWrite()
Hierarchy
Extends
- Product
Members
private
- $casting
- $db
- $default_parent
- $default_sort
- $icon
- $many_many
- $plural_name
- $searchable_fields
- $singular_name
Methods
protected
public
- canPurchase() — Conditions for whether a product can be purchased.
- classNameForOrderItem()
- getCMSFields()
- getCalculatedPrice()
- getPrice()
- i18n_plural_name()
- i18n_singular_name()
- onBeforeWrite() — remove any non-products from the list.