Sunnysideup\EcommerceProductVariation\Model\Buyables\ProductVariation
Synopsis
class ProductVariation
extends DataObject
implements
BuyableModel,EditableEcommerceObject
{
- // members
- protected string $currentStageOfRequest = '';
- protected bool $saveParentProduct = false;
- protected string $defaultClassNameForOrderItem = ProductVariation_OrderItem::class;
- private static array $api_access = ;
- private static string $table_name = 'ProductVariation';
- private static array $db = ;
- private static array $has_one = ;
- private static array $many_many = ;
- private static array $casting = ;
- private static array $defaults = ;
- private static array $versioning = ;
- private static array $extensions = ;
- private static array $indexes = ;
- private static array $field_labels = ;
- private static array $summary_fields = ;
- private static array $searchable_fields = ;
- private static string $default_sort = '"AllowPurchase" DESC, "FullSiteTreeSort" ASC, "Sort" ASC, "InternalItemID" ASC, "Price" ASC';
- private static string $singular_name = 'Product Variation';
- private static string $plural_name = 'Product Variations';
- private static array $title_style_option = ;
- private static string $current_style_option_code = 'default';
- // methods
- public void i18n_singular_name()
- public void i18n_plural_name()
- public static void get_plural_name()
- public static void add_title_style_option()
- public static void remove_title_style_option()
- public static void get_current_style_option_array()
- public FieldSet getCMSFields()
- public string CMSEditLink()
- public DataObjectSet AttributeValuesSorted()
- public void populateDefaults()
- public string Title()
- public void TitleWithHTML()
- public void getTitle()
- public string FullDescription()
- public string ImgAltTag()
- public string AllowPurchaseNice()
- public void setSaveParentProduct()
- public void onBeforeWrite()
- public bool prepareFullFields()
- public void onAfterWrite()
- public void onBeforeDelete()
- public DataObject AttributeProxy()
- public DataObject Parent()
- public void getParent()
- public void MainParentGroup()
- public void Siblings()
- public Image BestAvailableImage()
- public string CMSThumbnail()
- public string DefaultImageLink()
- public Image DefaultImage()
- public Product_Image DummyImage()
- public void viewversion()
- public DataObject getVersionOfBuyable()
- public OrderItem OrderItem()
- public string classNameForOrderItem()
- public void setAlternativeClassNameForOrderItem()
- public int QuantityDecimals()
- public int HasBeenSold()
- public void getHasBeenSold()
- public string Link()
- public string VersionedLink()
- public string AddLink()
- public string IncrementLink()
- public string DecrementLink()
- public string RemoveLink()
- public string RemoveAllLink()
- public string RemoveAllAndEditLink()
- public string SetSpecificQuantityItemLink()
- public string AddToCartAndGoToCheckoutLink()
- public bool IsInCart()
- public EcomQuantityField EcomQuantityField()
- public EcommerceConfigAjax AJAXDefinitions()
- public EcommerceDBConfig EcomConfig()
- public bool IsProductVariation()
- public float CalculatedPrice()
- public void getCalculatedPrice()
- public Money CalculatedPriceAsMoney()
- public void getCalculatedPriceAsMoney()
- public bool canPurchase()
- public bool canView()
- public bool canEdit()
- public bool canDelete()
- public bool canDeleteFromLive()
- public bool canCreate()
- public DataList MostLikeMe()
- protected array linkParameters()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Implements
- Sunnysideup\Ecommerce\Interfaces\BuyableModel
- Sunnysideup\Ecommerce\Interfaces\EditableEcommerceObject
Tasks
Line | Task |
---|---|
604 | reverse the ampersands, etc... |
702 | what is this for? |
865+ | : this is not correct yet, as the versions of product and productvariation are muddled up! |
989+ | : check if we need to use other class names |
1041+ | TEST!!!! |
Members
private
-
$api_access
Standard SS variable. -
$casting
Standard SS variable. - $current_style_option_code
- $db
-
$default_sort
Standard SS variable. -
$defaults
Standard SS variable. -
$extensions
Standard SS variable. -
$field_labels
Standard SS variable. -
$has_one
Standard SS variable. -
$indexes
Standard SS variable. -
$many_many
Standard SS variable. -
$plural_name
Standard SS variable. -
$searchable_fields
Standard SS variable. -
$singular_name
Standard SS variable. -
$summary_fields
Standard SS variable. -
$table_name
### @@@@ START REPLACEMENT @@@@ ### OLD: private static $db (case sensitive) NEW: private static $db (COMPLEX) EXP: Check that is class indeed extends DataObject and that it is not a data-extension! ### @@@@ STOP REPLACEMENT @@@@ ### - $title_style_option
—
array
How is the title build up? -
$versioning
Standard SS variable.
protected
- $currentStageOfRequest
- $defaultClassNameForOrderItem — string
- $saveParentProduct
—
Sunnysideup\EcommerceProductVariation\Model\Buyables\bool
when we save this object, should we save the parent as well?
Methods
protected
- linkParameters() — Here you can add additional information to your product links such as the AddLink and the RemoveLink.
public
- AJAXDefinitions() — returns the instance of EcommerceConfigAjax for use in templates.
- AddLink() — passing on shopping cart links ...is this necessary?? ...why not just pass the cart?
- AddToCartAndGoToCheckoutLink()
- AllowPurchaseNice() — returns YES or NO for the CMS Fields.
- AttributeProxy() — this is used by TableListField to access attribute values.
- AttributeValuesSorted() — Use the sort order of the variation attributes to order the attribute values.
- BestAvailableImage() — returns a "BestAvailable" image if the current one is not available In some cases this is appropriate and in some cases this is not.
- CMSEditLink() — link to edit the record.
- CMSThumbnail() — Little hack to show thumbnail in summary fields in modeladmin in CMS.
- CalculatedPrice() — returns the actual price worked out after discounts, currency conversions, etc...
- CalculatedPriceAsMoney() — How do we display the price?
- DecrementLink() — Link used to remove one from cart we can do this, because by default remove link removes one.
- DefaultImage() — returns the default image of the product.
- DefaultImageLink() — Returns a link to a default image.
- DummyImage() — returns a product image for use in templates e.g. $DummyImage.Width();.
- EcomConfig()
- EcomQuantityField()
- FullDescription() — shorthand.
- HasBeenSold() — Number of variations sold.
- ImgAltTag() — shorthand.
- IncrementLink() — link use to add (one) to cart.
- IsInCart()
- IsProductVariation() — Is it a variation?
- Link() — Takes you to the Product and filters for the provided variation.
- MainParentGroup() — Returns the direct parent (group) for the product.
- MostLikeMe() — finds similar ("siblings") variations where one attribute value is NOT the same.
- OrderItem() — returns the order item associated with the buyable.
- Parent() — We use this function to make it more universal.
- QuantityDecimals() — When purchasing this buyable, how many decimals can it have?
- RemoveAllAndEditLink() — remove all of this buyable's orderitem from cart and go through to this buyble to add alternative selection.
- RemoveAllLink() — remove all of this buyable's orderitem from cart.
- RemoveLink() — remove one buyable's orderitem from cart.
- SetSpecificQuantityItemLink() — set new specific new quantity for buyable's orderitem.
- Siblings() — Returns Buybales in the same group.
- Title() — Puts together a title for the Product Variation.
- TitleWithHTML()
- VersionedLink()
- add_title_style_option() — change the way the title of the variation is displayed
- canCreate() — Standard SS method.
- canDelete() — Standard SS method.
- canDeleteFromLive() — Standard SS method //check if it is in a current cart?
- canEdit() — Shop Admins can edit.
- canPurchase() — Is the product for sale?
- canView() — standard SS Method we explicitely set this to give access in the API.
- classNameForOrderItem() — you can overwrite this function in your buyable items (such as Product).
- getCMSFields() — Standard SS method.
- getCalculatedPrice()
- getCalculatedPriceAsMoney()
- getHasBeenSold()
- getParent()
- getTitle()
- getVersionOfBuyable() — Action to return specific version of a product variation.
- get_current_style_option_array()
- get_plural_name()
- i18n_plural_name()
- i18n_singular_name()
- onAfterWrite() — Standard SS Method.
- onBeforeDelete() — Standard SS Method Remove links to Attribute Values.
- onBeforeWrite() — standard SS method sets the FullName + FullSiteTreeSort of the variation.
- populateDefaults() — standard SS method.
- prepareFullFields() — sets the FullName and FullSiteTreeField to the latest values This can be useful as you can compare it to the ones saved in the database.
- remove_title_style_option() — remove style option by key
- setAlternativeClassNameForOrderItem() — You can set an alternative class name for order item using this method.
- setSaveParentProduct() — By setting this to TRUE the parent (product) will be save when this object will be saved.
- viewversion() — Action to return specific version of a product.