\CatalogueProduct
Base class for all products stored in the database. The intention is to allow Product objects to be extended in the same way as a more conventional "Page" object.
This allows users familier with working with the CMS a common
platform for developing ecommerce type functionality.
- Author: i-lateral (http://www.i-lateral.com)
Synopsis
class CatalogueProduct
extends DataObject
implements
PermissionProvider
{
- // members
- private static boolean $auto_stock_id = true;
- private static string $description = "A standard catalogue product";
- private static array $db = ;
- private static array $has_one = ;
- private static array $many_many = ;
- private static array $many_many_extraFields = ;
- private static array $belongs_many_many = ;
- private static array $casting = ;
- private static array $summary_fields = ;
- private static array $searchable_fields = ;
- private static string $default_sort = '"Title" ASC';
- // methods
- public Boolean isEnabled()
- public Boolean isDisabled()
- public boolean IncludesTax()
- public Float getPrice()
- public Float getTax()
- public Decimal getTaxPercent()
- public Float getPriceAndTax()
- public String getTaxString()
- public SiteConfig getSiteConfig()
- public string Link()
- public string AbsoluteLink()
- public string RelativeLink()
- public ArrayList getAncestors()
- public void getMenuTitle()
- public ArrayList SortedRelatedProducts()
- public ArrayList SortedImages()
- public string Breadcrumbs()
- public void getCMSThumbnail()
- public void getCategoriesList()
- public void getCMSFields()
- public void getCMSValidator()
- public bool validURLSegment()
- public string generateURLSegment()
- public void onBeforeWrite()
- public void requireDefaultRecords()
- public void providePermissions()
- public void canView()
- public void canCreate()
- public void canEdit()
- public void canDelete()
Hierarchy
Extends
- DataObject
Implements
- PermissionProvider
Members
private
-
$auto_stock_id
Determines if a product's stock ID will be auto generated if not set. - $belongs_many_many
- $casting
- $db
- $default_sort
- $description
—
string
Description for this object that will get loaded by the website when it comes to creating it for the first time. - $has_one
- $many_many
- $many_many_extraFields
- $searchable_fields
- $summary_fields
Methods
public
- AbsoluteLink() — Get the absolute URL for this page, including protocol and host.
- Breadcrumbs() — Return a breadcrumb trail for this product (which accounts for parent categories)
- IncludesTax() — Method that allows us to define in templates if we should show price including tax, or excluding tax
- Link() — Return the link for this {@link SimpleProduct} object, with the {@link Director::baseURL()} included.
- RelativeLink() — Return the link for this {@link Product}
- SortedImages() — Return sorted images, if no images exist, create a new opbject set with a blank product image in it.
- SortedRelatedProducts() — Return sorted products related to this product
- canCreate()
- canDelete()
- canEdit()
- canView()
- generateURLSegment() — Generate a URL segment based on the title provided.
- getAncestors() — We use this to tap into the categories "isSection" setup, essentially adding the product's first category to the list
- getCMSFields()
- getCMSThumbnail()
- getCMSValidator()
- getCategoriesList()
- getMenuTitle()
- getPrice() — Get a final price for this product. We make this a method so that we can tap into extensions and allow third party modules to alter this (to add items such as tax, bulk pricing, etc).
- getPriceAndTax() — Get the final price of this product, including tax (if any)
- getSiteConfig() — Stub method to get the site config, unless the current class can provide an alternate.
- getTax() — Get a final tax amount for this product. You can extend this method using "UpdateTax" allowing third party modules to alter tax amounts dynamically.
- getTaxPercent() — Get the percentage amount of tax applied to this item
- getTaxString() — Generate a string to go with the the product price. We can overwrite the wording of this by using Silverstripes language files
- isDisabled() — Is this object disabled?
- isEnabled() — Is this object enabled?
- onBeforeWrite()
- providePermissions()
- requireDefaultRecords()
- validURLSegment() — Returns TRUE if this object has a URLSegment value that does not conflict with any other objects. This methods checks for: - A page with the same URLSegment that has a conflict.