Sunnysideup\Ecommerce\Pages\Product
This is a standard Product page-type with fields like Price, Weight, Model and basic management of groups.
It also has an associated ProductOrderItem class,
an extension of OrderItem, which is the mechanism
that links this page type class to the rest of the
eCommerce platform. This means you can add an instance
of this page type to the shopping cart.
Synopsis
class Product
extends Page
implements
BuyableModel
{
- // members
- protected string $defaultClassNameForOrderItem = ProductOrderItem::class;
- protected static array $parent_cache = ;
- private static string $buyable_product_variation_class_name = 'Sunnysideup\\EcommerceProductVariation\\Model\\\Buyables\\ProductVariation';
- private static string $folder_name_for_images = 'ProductImages';
- private static string $table_name = 'Product';
- private static array $db = ;
- private static array $has_one = ;
- private static array $many_many = ;
- private static array $owns = ;
- private static array $casting = ;
- private static array $indexes = ;
- private static array $defaults = ;
- private static array $summary_fields = ;
- private static array $searchable_fields = ;
- private static string $singular_name = 'Product';
- private static string $plural_name = 'Products';
- private static string $description = 'A product that is for sale in the shop.';
- private static $default_parent = ProductGroup::class;
- private static string $icon = 'sunnysideup/ecommerce: client/images/icons/product-file.gif';
- private static array $_calculated_price_cache = ;
- // methods
- public void SummaryFields()
- public static void is_product_variation()
- public FieldList scaffoldSearchFields()
- public void i18n_singular_name()
- public void i18n_plural_name()
- public void getCMSFields()
- public string AjaxLink()
- public void prepareFullFields()
- public DataList AllParentGroups()
- public DataList AllParentGroupsIncludingParents()
- public Product getProduct()
- public DataList Siblings()
- public void BestAvailableImage()
- public null|ProductGroup ParentGroup()
- public void MainParentGroup()
- public null|ProductGroup TopParentGroup()
- public string CMSThumbnail()
- public string DefaultImageLink()
- public null|Image DefaultImage()
- public DataObject getVersionOfBuyable()
- public OrderItem OrderItem()
- public string classNameForOrderItem()
- public void setAlternativeClassNameForOrderItem()
- public int QuantityDecimals()
- public void HasBeenSold()
- public void getHasBeenSold()
- public void SalesRecord()
- public string AddVariationsLink()
- public void Product()
- 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 string VersionedLink()
- public void RemoveFromSaleLink()
- public bool IsInCart()
- public EcomQuantityField EcomQuantityField()
- public EcommerceConfigAjax AJAXDefinitions()
- public bool IsProductVariation()
- public bool IsEcommercePage()
- public void ProductType()
- public void AllowPurchaseNice()
- public float CalculatedPrice()
- public float getCalculatedPrice()
- public DBMoney CalculatedPriceAsMoney()
- public void getCalculatedPriceAsMoney()
- public bool canPurchase()
- public void canCreate()
- public bool canEdit()
- public bool canDelete()
- public bool canPublish()
- public void IDForSearchResults()
- public void debug()
- public void onAfterPublish()
- public void onBeforeUnpublish()
- public void onBeforeDelete()
- public void onAfterDelete()
- protected void onBeforeWrite()
- protected void getProductSearchTableDataValues()
- protected GridField getProductGroupsTableField()
- protected LiteralField getAdditionalImagesMessage()
- protected GridField getAdditionalImagesField()
- protected GridField getAdditionalFilesField()
- protected array linkParameters()
Hierarchy
Tasks
Line | Task |
---|---|
68+ | : Ask the silverstripe gods why $default_sort won't work with FullSiteTreeSort |
Members
private
- $_calculated_price_cache
- $buyable_product_variation_class_name
- $casting
- $db
-
$default_parent
Standard SS variable. -
$defaults
Standard SS variable. - $description
—
string
Standard SS variable. - $folder_name_for_images — string
- $has_one
-
$icon
Standard SS variable. - $indexes
- $many_many
- $owns
-
$plural_name
Standard SS variable. -
$searchable_fields
Standard SS variable. -
$singular_name
Standard SS variable. -
$summary_fields
Standard SS variable. - $table_name
protected
- $defaultClassNameForOrderItem — string
- $parent_cache
Methods
protected
- getAdditionalFilesField() — Used in getCSMFields.
- getAdditionalImagesField() — Used in getCSMFields.
- getAdditionalImagesMessage() — Used in getCSMFields.
- getProductGroupsTableField() — Used in getCSMFields.
- getProductSearchTableDataValues()
- linkParameters() — Here you can add additional information to your product links such as the AddLink and the RemoveLink.
- onBeforeWrite()
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()
- AddVariationsLink() — Tells us the link to select variations If ajaxified, this controller method (selectvariation) Will return a html snippet for selecting the variation.
- AjaxLink() — How to view using AJAX e.g. if you want to load the produyct in a list - using AJAX then use this link Opening the link will return a HTML snippet.
- AllParentGroups() — Returns all the parent groups for the product.
- AllParentGroupsIncludingParents() — Returns all the parent groups for the product, including the parent-parents, and so on.
- AllowPurchaseNice()
- 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.
- CMSThumbnail() — Little hack to show thumbnail in summary fields in modeladmin in CMS.
- CalculatedPrice() — Products have a standard price, but for specific situations they have a calculated price.
- 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.
- EcomQuantityField()
- HasBeenSold()
- IDForSearchResults()
- IncrementLink() — link use to add (one) to cart.
- IsEcommercePage() — tells us if the current page is part of e-commerce.
- IsInCart()
- IsProductVariation() — Is it a variation?
- MainParentGroup() — Returns the parent page, but only if it is an instance of Product Group.
- OrderItem() — Returns the order item associated with the buyable. ALWAYS returns one, even if there is none in the cart.
- ParentGroup() — Returns the direct parent group for the product.
- Product() — useful for Product Variations as they return the parent Product.
- ProductType()
- QuantityDecimals() — This is used when you add a product to your cart.
- 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.
- RemoveFromSaleLink()
- RemoveLink() — remove one buyable's orderitem from cart.
- SalesRecord()
- SetSpecificQuantityItemLink() — set new specific new quantity for buyable's orderitem.
- Siblings() — Returns products in the same group.
- SummaryFields()
- TopParentGroup() — Returns the top parent group of the product (in the hierarchy).
- VersionedLink()
- canCreate()
- canDelete() — Standard SS method.
- canEdit() — Shop Admins can edit.
- canPublish() — Standard SS method.
- canPurchase() — Is the product for sale?
- classNameForOrderItem() — you can overwrite this function in your buyable items (such as Product).
- debug()
- getCMSFields() — Standard SS Method.
- getCalculatedPrice() — Products have a standard price, but for specific situations they have a calculated price.
- getCalculatedPriceAsMoney()
- getHasBeenSold()
- getProduct() — We have this so that Variations can link to products and products link to themselves...
- getVersionOfBuyable() — Action to return specific version of a specific product.
- i18n_plural_name()
- i18n_singular_name()
- is_product_variation()
- onAfterDelete()
- onAfterPublish() — add data to search table if the.
- onBeforeDelete()
- onBeforeUnpublish()
- 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.
- scaffoldSearchFields() — By default we search for products that are allowed to be purchased only standard SS method.
- setAlternativeClassNameForOrderItem() — You can set an alternative class name for order item using this method.