ModelProducts module

BaseProduct

Product

A model in the Products module, with 41 members for templates, 35 API properties and 43 members for admin templates.

View
What Smarty and Twig templates receive. Properties in REST API responses and job payloads. What admin screen templates receive when you override them.

Templates view

Properties 38

Take no arguments.

# isVariant()
bool
Returns if a product is a variant.
# getText()
?string
Get the short description in the default language for this product
# hasDefaultPricing()
bool
Checks if the product has a default pricing.
# getDefaultPricing()
ProductPricing
Gets the default pricing.
# getName()
?string
Fetches the name in the default description for this container
# getSlug()
?string
Fetches the slug for the default description for this container
# 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 urlAddressableModel defaults, 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's resolveCustomUrl() would check the container's own entity — which has no getCustomUrl() — and silently drop the description's custom URL. The description itself uses urlAddressableModel, so the guarded custom-URL resolution still happens exactly once, one level down. That is why this trait does not use 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
# hasDefaultDescription()
bool
Checks if the container has a default description.
# getDefaultDescription()
Model
Fetches the description in the default language for this container.
# getOriginalPath()
string
It's an alias and deprecated! Directly use getOriginalFullPath() instead.
# getId()
?int
# getCode()
?string
The code that uniquely identifies this product
# isPurchasable()
bool
# getAvailableFrom()
?DateTime
# getAvailableTill()
?DateTime
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getPublished()
?DateTime
# isPublished()
bool
Determines if the record is published.
# getImage()
?Image
# getSite()
?Site
# 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
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned

Methods 3

Take arguments. The API serialises only getters that need none.

# 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*) are 0, they are ignored, and *base price* is returned (that could be 0.00).
# getDescriptionForLanguage(Language $language)
?Model
Retrieves the description for the specified language. Returns null when there is no description in that language.

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 35

Read-only values on the record.

# variant
bool
Returns if a product is a variant.
# text
?string
Get the short description in the default language for this product
# defaultPricing
bool
Checks if the product has a default pricing.
# defaultPricing
ProductPricing
Gets the default pricing.
# name
?string
Fetches the name in the default description for this container
# slug
?string
Fetches the slug for the default description for this container
# 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 urlAddressableModel defaults, 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's resolveCustomUrl() would check the container's own entity — which has no getCustomUrl() — and silently drop the description's custom URL. The description itself uses urlAddressableModel, so the guarded custom-URL resolution still happens exactly once, one level down. That is why this trait does not use 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
# defaultDescription
bool
Checks if the container has a default description.
# defaultDescription
Model
Fetches the description in the default language for this container.
# originalPath
string
It's an alias and deprecated! Directly use getOriginalFullPath() instead.
# id
?int
# code
?string
The code that uniquely identifies this product
# purchasable
bool
# availableFrom
?DateTime
# availableTill
?DateTime
# created
?DateTime
Date the record was created.
# modified
?DateTime
Last modification date for the record.
# published
?DateTime
# published
bool
Determines if the record is published.
# image
?Image
# site
?Site
# width
?string
# height
?string
# depth
?string
# weight
?string
# availableQuantity
?int
# inventoryTemplate
?string
# stocks
?Collection<Stock>
# externalId
?string

Admin view

AdminAvailable in cdna-admin templates. Copy an admin template into your site repository to change how this record is edited.

Properties 40

Take no arguments.

# isVariant()
bool
Returns if a product is a variant.
# getText()
?string
Get the short description in the default language for this product
# hasDefaultPricing()
bool
Checks if the product has a default pricing.
# getDefaultPricing()
ProductPricing
Gets the default pricing.
# getName()
?string
Fetches the name in the default description for this container
# getSlug()
?string
Fetches the slug for the default description for this container
# 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 urlAddressableModel defaults, 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's resolveCustomUrl() would check the container's own entity — which has no getCustomUrl() — and silently drop the description's custom URL. The description itself uses urlAddressableModel, so the guarded custom-URL resolution still happens exactly once, one level down. That is why this trait does not use 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
# hasDefaultDescription()
bool
Checks if the container has a default description.
# getDefaultDescription()
Model
Fetches the description in the default language for this container.
# 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
# getCode()
?string
The code that uniquely identifies this product
# isPurchasable()
bool
# getAvailableFrom()
?DateTime
# getAvailableTill()
?DateTime
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getPublished()
?DateTime
# isPublished()
bool
Determines if the record is published.
# getImage()
?Image
# getSite()
?Site
# 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
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned

Methods 3

Take arguments. The API serialises only getters that need none.

# 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*) are 0, they are ignored, and *base price* is returned (that could be 0.00).
# getDescriptionForLanguage(Language $language)
?Model
Retrieves the description for the specified language. Returns null when there is no description in that language.