Object Api¶
Object Api is a collection of methods that allow you to gain access to the data in the store.
Objects¶
Objects contain properties to output dynamic content on the page. For example, the produt
object contains a property called name
that you can use to output the name of the product.
Properties of an object can be accessed using the .
operator. For example, the following code outputs the name of the product:
Properties of an object can also be a reference to another object.
If an object has a property referencing another object, that property can sometimes have a null value, even when it seems it shouldn't. This happens when some data is deleted during API object generation.
<h2>{{ product.name }}</h2>
{% for comment in product.comments %}
<h2>{{ comment.product.name }}</h2>
{% endfor %}
Lists of objects¶
Some properties are not just strings, but also objects. For example, the product
object contains a property called images
that is a list of objects.
It is possible to iterate over the list of images using the for
loop:
Every list is paginated. You can get the current page number by accessing the page
property of the list:
You can switch iterator to the next page by accessing the nextPage
property or calling the nextPage()
method of the list:
You can switch iterator to the previous page by accessing the prevPage
property or calling the prevPage()
method of the list:
You cen set the page number by calling the setPage()
method and setting the value:
You can get the total number of pages by accessing the pages
property of the list:
You can get the total number of items by accessing the count
property of the list:
You cen get current number of items per pages by accessing the itemCountPerPage
property of the list:
You can change the number of items per page by calling the setItemCountPerPage()
method of the list:
Available methods¶
- getBasketSettings()
- getBestsellingProducts(int items_per_page)
- getBlogArticle(int article_id)
- getBlogArticles(int items_per_page, int page)
- getBlogCategory(int category_id)
- getBlogCategories(int items_per_page)
- getBlogSettings()
- getBlogTags(int items_per_page)
- getBreadcrumbs()
- getCategory(int category_id)
- getCategories(bool rootOnly, int items_per_page)
- getCollection(int collection_id)
- getConsentsSettings()
- getContactAdditionalFields(int items_per_page)
- getCountry(int country_id)
- getCurrencies(int items_per_page)
- getDate(mixed date)
- getDateTime(mixed datetime)
- getFilters()
- getFooterGroup(int group_id)
- getFooterGroups(int items_per_page)
- getHeaderLinks(int items_per_page)
- getLocale(int locale_id)
- getLocales(int items_per_page)
- getLoyaltyProgramSettings()
- getMainPageBlogArticles(int items_per_page)
- getModuleBlogArticles(int items_per_page)
- getNewProducts(int items_per_page)
- getNotificationSettings()
- getNow()
- getPage(int page_id)
- getProducer(int producer_id)
- getProducers(int items_per_page)
- getProduct(int product_id)
- getProductPricesSettings()
- getProductReviewsSettings()
- getProducts(int items_per_page, int page)
- getProductsInCollection(int collection_id, int items_per_page)
- getProductsListSortTypes()
- getProductsOfTheDay(int items_per_page)
- getRecaptchaSettings()
- getSearchSettings()
- getSeoProperties()
- getShopCurrency()
- getShopInfo()
- getShopLocale()
- getShopOffInformation()
- getSystemMetafields()
- getTime(mixed time)
- getToday()
- getUsersSettings()
- getUrl()
- getWarehouses(int items_per_page)
- setMetatag(string content, null|string name, null|string property)
Objects reference¶
Value objects¶
There are objects that are not specific to a product or a category or any other type of object.
For example the product.createdAt
property returns the DateTime
object that represents the date and time when the product was created.
This object itself is not product specific and is used in many types of objects.
Value objects simplifies and standardizes access to common properties for developers.
Objects¶
- AdditionalField
- AdditionalFieldOption
- AttributesFilter
- AttributesFilterValue
- AvailabilitiesFilter
- AvailabilitiesFilterValue
- BlogArticle
- BlogArticleUrl
- BlogCategory
- BlogCategoryUrl
- BlogComment
- BlogFile
- BlogSettings
- BlogTag
- BlogTagUrl
- Category
- CategoryUrl
- CategoriesFilter
- CategoriesFilterValue
- Collection
- CollectionUrl
- CollectionsFilter
- CollectionsFilterValue
- ColorOptionsFilterValue
- ConsentsSettings
- CountryShippingCost
- DeliveryFilter
- Filter
- FilterValue
- Filters
- FooterGroup
- FooterLink
- GpsrCertificate
- GpsrImporter
- GpsrProducer
- GpsrResponsible
- HeaderLink
- Locale
- LoyaltyProductsListUrl
- LoyaltyProgramSettings
- MainPageUrl
- Metafields
- Metatag
- MetaProperties
- NewProductsUrl
- Page
- OptionsFilter
- OptionsFilterValue
- PageUrl
- PriceFilter
- Producer
- ProducersFilter
- ProducersFilterValue
- ProducerUrl
- Product
- ProductAttribute
- ProductAttributeGroup
- ProductAvailability
- ProductBundle
- ProductBundleItem
- ProductComment
- ProductDelivery
- ProductImage
- ProductFile
- ProductHistoricalPrice
- ProductOption
- ProductOptionValue
- ProductOptionValueWithColor
- ProductPricesSettings
- ProductReviewsSettings
- ProductUrl
- ProductVariant
- ProductVariantOptionValue
- ProductsSearchUrl
- ProductsOfTheDayUrl
- PromotionsUrl
- Property
- RecaptchaSettings
- RouteUrl
- SearchSettings
- Shipping
- ShippingCost
- ShopInfo
- ShopOffInformation
- SpecialOffer
- Tax
- UsersSettings
- VariantSpecialOffer
- Warehouse
Lists¶
Sometimes an Object Api method or a property of an object returns a list of objects.
Those lists are paginated by default and can be iterated using the for
loop.
- AdditionalFieldsList
- AdditionalFieldOptionsList
- AttributesFiltersList
- AttributesFilterValuesList
- AvailabilitiesFilterValuesList
- BlogArticlesList
- BlogCategoriesList
- BlogCommentsList
- BlogFilesList
- BlogTagsList
- CategoriesList
- CategoriesFilterValuesList
- CollectionsList
- CollectionsFilterValuesList
- ColorOptionsFilterValuesList
- CountriesList
- CountryShippingCostsList
- CurrenciesList
- FilterValuesList
- FooterGroupsList
- FooterLinksList
- GpsrCertificatesList
- HeaderLinksList
- LinksList
- LocalesList
- MetatagsList
- OptionsFilterList
- OptionsFilterValuesList
- PagesList
- ProducersList
- ProducersFilterValuesList
- ProductAttributesList
- ProductAttributeGroupsList
- ProductAvailabilitiesList
- ProductBundlesList
- ProductBundleItemsList
- ProductCommentsList
- ProductImagesList
- ProductFilesList
- ProductHistoricalPricesList
- ProductOptionsList
- ProductOptionValuesList
- ProductOptionValuesWithColorList
- ProductVariantsList
- ProductsList
- PropertiesList
- TaxesList
- UnitsList
- WarehousesList