ModelProducts module
Product
A model in the Products module, with 63 members for templates, 45 API properties and 72 members for admin templates.
Templates view
Properties 50
Take no arguments.
-
#
__toString()Templates only -
string - Returns the rendered HTML when the model is used in a string context.
-
#
getCategoryElements() -
?Collection<CategoryElement> -
#
getVariants() -
?Collection<ProductVariant> -
#
getChildren() -
?Collection -
#
getCustomFieldValues() -
?Collection<ProductCustomFieldValue> -
#
getFullSlug() -
string - Gets the effective full slug for the container by forwarding to its default description. All four UrlAddressable methods forward instead of using the
urlAddressableModeldefaults, because a container's URL is entirely its default description's URL: the custom URL lives on the description entity, not on the container entity, so the trait'sresolveCustomUrl()would check the container's own entity — which has nogetCustomUrl()— and silently drop the description's custom URL. The description itself usesurlAddressableModel, so the guarded custom-URL resolution still happens exactly once, one level down. That is why this trait does notuse urlAddressableModel: every method it would contribute is replaced here. -
#
getFullPath() -
string - Gets the effective full path for the container by forwarding to its default description
-
#
getOriginalFullSlug() -
string - Gets the original full slug for the container by forwarding to its default description
-
#
getOriginalFullPath() -
string - Gets the original path for the container without any custom urls applied by forwarding to its default description
-
#
getOriginalPath() -
string - It's an alias and deprecated! Directly use
getOriginalFullPath()instead. -
#
getId() -
?int -
#
isPurchasable() -
bool -
#
getAvailableFrom() -
?DateTime -
#
getAvailableTill() -
?DateTime -
#
getPublished() -
?DateTime -
#
getDescriptions() -
?Collection<ProductDescription> -
#
getPricings() -
?Collection<ProductPricing> -
#
getWidth() -
?string -
#
getHeight() -
?string -
#
getDepth() -
?string -
#
getWeight() -
?string -
#
getAvailableQuantity() -
?int -
#
getInventoryTemplate() -
?string -
#
getStocks() -
?Collection<Stock> -
#
getInterests() -
?Collection<ProductInterest> -
#
getExternalId() -
?string -
#
isHierarchicalModel()Not in API & Jobs -
bool - Check whether a model is a hierarchical model, i.e. can have children
-
#
isInWishlist()Templates only -
bool - Checks if the user is logged-in or if the product is available in the user's wishlist
-
#
getHtml()Templates only -
string - Gets the rendered HTML for the record using its layout template. Delegates to the default description, which holds the layout.
Methods 13
Take arguments. The API serialises only getters that need none.
-
#
getProductCategories(?array $criteria, string $sort, string $direction) -
Collection - Helper that will fetch instances of Products\Models\Category through Products\Models\CategoryElement
-
#
getCustomFieldValueByName(string $customFieldName) -
?CustomFieldValue - Get the value for a custom field by the custom field name
-
#
getCustomFieldContent(string $customFieldName) -
?Content - Get the content for the custom field identified by the specified name
-
#
getCustomFieldContentOrDefault(string $customFieldName) -
?Content - Get the (default) content for the custom field identified by the specified name
-
#
getCustomFieldBoolean(string $customFieldName, ?bool $default) -
?bool - Get the (default) content of the custom field as boolean value
-
#
getCustomFieldText(string $customFieldName, ?string $default) -
?string - Get the (default) content of the custom field as text
-
#
getCustomFieldImage(string $customFieldName) -
?Image - Get the (default) image contained in the custom field
-
#
getCustomFieldFile(string $customFieldName) -
?File - Get the (default) file contained in the custom field
-
#
hasCustomField(string $customFieldName) -
bool - Check if the entity has a custom field with the specified name
-
#
getPricingForCurrency(Currency $currency) -
?ProductPricing - Returns the pricing for a specific currency. Returns nothing if there is no pricing set for the given currency.
-
#
getFinalPrice(?Currency $currency) -
?string - Calculates the final price for the product based on the provided pricing. If *base price* of the product is
0.00, such a product could be added to the cart. If other prices (e.g. *special price*) are0, they are ignored, and *base price* is returned (that could be0.00).
No members match the filter.
API & Jobs view
API & JobsEach property is a key in REST API responses and job payloads. Its name is the template getter without get, is or has. Methods that need arguments are not available here.
Properties 45
Read-only values on the record.
-
#
categoryElements -
?Collection<CategoryElement> -
#
variants -
?Collection<ProductVariant> -
#
children -
?Collection -
#
customFieldValues -
?Collection<ProductCustomFieldValue> -
#
customFieldContent -
object - Get a serialized representation of the custom fields associated with the record
-
#
fullSlug -
string - Gets the effective full slug for the container by forwarding to its default description. All four UrlAddressable methods forward instead of using the
urlAddressableModeldefaults, because a container's URL is entirely its default description's URL: the custom URL lives on the description entity, not on the container entity, so the trait'sresolveCustomUrl()would check the container's own entity — which has nogetCustomUrl()— and silently drop the description's custom URL. The description itself usesurlAddressableModel, so the guarded custom-URL resolution still happens exactly once, one level down. That is why this trait does notuse urlAddressableModel: every method it would contribute is replaced here. -
#
fullPath -
string - Gets the effective full path for the container by forwarding to its default description
-
#
originalFullSlug -
string - Gets the original full slug for the container by forwarding to its default description
-
#
originalFullPath -
string - Gets the original path for the container without any custom urls applied by forwarding to its default description
-
#
id -
?int -
#
purchasable -
bool -
#
availableFrom -
?DateTime -
#
availableTill -
?DateTime -
#
published -
?DateTime -
#
descriptions -
?Collection<ProductDescription> -
#
pricings -
?Collection<ProductPricing> -
#
width -
?string -
#
height -
?string -
#
depth -
?string -
#
weight -
?string -
#
availableQuantity -
?int -
#
inventoryTemplate -
?string -
#
stocks -
?Collection<Stock> -
#
interests -
?Collection<ProductInterest> -
#
externalId -
?string
No members match the filter.
Admin view
AdminAvailable in cdna-admin templates. Copy an admin template into your site repository to change how this record is edited.
Properties 59
Take no arguments.
-
#
getCategoryElements() -
?Collection<CategoryElement> -
#
getVariants() -
?Collection<ProductVariant> -
#
getChildren() -
?Collection -
#
getCustomFieldValues() -
?Collection<ProductCustomFieldValue> -
#
getFullSlug() -
string - Gets the effective full slug for the container by forwarding to its default description. All four UrlAddressable methods forward instead of using the
urlAddressableModeldefaults, because a container's URL is entirely its default description's URL: the custom URL lives on the description entity, not on the container entity, so the trait'sresolveCustomUrl()would check the container's own entity — which has nogetCustomUrl()— and silently drop the description's custom URL. The description itself usesurlAddressableModel, so the guarded custom-URL resolution still happens exactly once, one level down. That is why this trait does notuse urlAddressableModel: every method it would contribute is replaced here. -
#
getFullPath() -
string - Gets the effective full path for the container by forwarding to its default description
-
#
getOriginalFullSlug() -
string - Gets the original full slug for the container by forwarding to its default description
-
#
getOriginalFullPath() -
string - Gets the original path for the container without any custom urls applied by forwarding to its default description
-
#
getOriginalPath() -
string - It's an alias and deprecated! Directly use
getOriginalFullPath()instead. -
#
getImageRootTargetFolderPath()Admin only -
string - Retrieves the *root* target folder path for uploaded images. This is usually the root entity path without the ID or slug sub folder.
-
#
getImageTargetFolderPath()Admin only -
string - Retrieves the target folder path for uploaded images. Images will be moved to this path after the upload has been processed.
-
#
getId() -
?int -
#
isPurchasable() -
bool -
#
getAvailableFrom() -
?DateTime -
#
getAvailableTill() -
?DateTime -
#
getPublished() -
?DateTime -
#
getDescriptions() -
?Collection<ProductDescription> -
#
getPricings() -
?Collection<ProductPricing> -
#
getWidth() -
?string -
#
getHeight() -
?string -
#
getDepth() -
?string -
#
getWeight() -
?string -
#
getAvailableQuantity() -
?int -
#
getInventoryTemplate() -
?string -
#
getStocks() -
?Collection<Stock> -
#
getInterests() -
?Collection<ProductInterest> -
#
getExternalId() -
?string -
#
isHierarchicalModel()Not in API & Jobs -
bool - Check whether a model is a hierarchical model, i.e. can have children
-
#
getAvailableWarehouses()Admin only -
array - Returns the list of warehouses sorted by name and indexed by ID
-
#
getStockQuantities()Admin only -
array - Fetches stock quantities (indexed by warehouse ID) and keeps current value, value (submitted by user) and original value (value fetched as current on HTML form rendering)
Methods 13
Take arguments. The API serialises only getters that need none.
-
#
getProductCategories(?array $criteria, string $sort, string $direction) -
Collection - Helper that will fetch instances of Products\Models\Category through Products\Models\CategoryElement
-
#
getCustomFieldValueByName(string $customFieldName) -
?CustomFieldValue - Get the value for a custom field by the custom field name
-
#
getCustomFieldContent(string $customFieldName) -
?Content - Get the content for the custom field identified by the specified name
-
#
getCustomFieldContentOrDefault(string $customFieldName) -
?Content - Get the (default) content for the custom field identified by the specified name
-
#
getCustomFieldBoolean(string $customFieldName, ?bool $default) -
?bool - Get the (default) content of the custom field as boolean value
-
#
getCustomFieldText(string $customFieldName, ?string $default) -
?string - Get the (default) content of the custom field as text
-
#
getCustomFieldImage(string $customFieldName) -
?Image - Get the (default) image contained in the custom field
-
#
getCustomFieldFile(string $customFieldName) -
?File - Get the (default) file contained in the custom field
-
#
hasCustomField(string $customFieldName) -
bool - Check if the entity has a custom field with the specified name
-
#
getPricingForCurrency(Currency $currency) -
?ProductPricing - Returns the pricing for a specific currency. Returns nothing if there is no pricing set for the given currency.
-
#
getFinalPrice(?Currency $currency) -
?string - Calculates the final price for the product based on the provided pricing. If *base price* of the product is
0.00, such a product could be added to the cart. If other prices (e.g. *special price*) are0, they are ignored, and *base price* is returned (that could be0.00).
No members match the filter.