Class: Falsify::Smartcollection

Inherits:
Object
  • Object
show all
Extended by:
Enumerize
Defined in:
lib/falsify/models/product/collection/smart_collection.rb

Overview

See the API documentation.

Required Fields:

  • rules
  • title

Instance Attribute Summary collapse

Instance Attribute Details

#body_htmlString

The description of the smart collection. Includes HTML markup. Many shop themes display this on the smart collection page.

Returns:

  • (String)


16
17
18
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 16

def body_html
  @body_html
end

#disjunctiveString

Whether the product must match all the rules to be included in the smart collection. Valid values:

  • true: Products only need to match one or more of the rules to be included in the smart collection.
  • false: Products must match all of the rules to be included in the smart collection.

Returns:

  • (String)


147
148
149
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 147

def disjunctive
  @disjunctive
end

#handleString

A human-friendly unique string for the smart collection. Automatically generated from the title. Used in shop themes by the Liquid templating language to refer to the smart collection. (maximum: 255 characters)

Returns:

  • (String)


23
24
25
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 23

def handle
  @handle
end

#idString

The ID of the smart collection.

Returns:

  • (String)


27
28
29
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 27

def id
  @id
end

#imageHash

The image associated with the smart collection. Valid values:

  • attachment: An image attached to a smart collection returned as Base64-encoded binary data.
  • src: A URL that specifies the location of the image.
  • alt: Alternative text that describes the collection image.

Returns:

  • (Hash)


35
36
37
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 35

def image
  @image
end

#products_manually_sorted_countObject (readonly)

Returns the value of attribute products_manually_sorted_count.



179
180
181
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 179

def products_manually_sorted_count
  @products_manually_sorted_count
end

#published_atString?

The date and time (ISO 8601 format) that the smart collection was published. Returns null when the collection is hidden.

Returns:

  • (String, nil)


40
41
42
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 40

def published_at
  @published_at
end

#published_scope:web, :global

Whether the smart collection is published to the Point of Sale channel. Valid values:

  • web: The smart collection is published to the Online Store channel but not published to the Point of Sale channel.
  • global: The smart collection is published to both the Online Store channel and the Point of Sale channel.

Returns:

  • (:web, :global)


47
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 47

enumerize :published_scope, in: [:web, :global]

#rulesString

The list of rules that define what products go into the smart collection. Each rule has the following properties:

-

column : The property of a product being used to populate the smart collection.

Valid values for text relations:

  • title: The product title.
  • type: The product type.
  • vendor: The name of the product vendor.
  • variant_title: The title of a product variant.

Valid values for number relations:

  • variant_compare_at_price: The compare price.
  • variant_weight: The weight of the product.
  • variant_inventory: The inventory stock. Note: not_equals does not work with this property.
  • variant_price: product price.

Valid values for an equals relation:

- tag: A tag associated with the product.

relation : The relationship between the column choice, and the condition.

Valid values for number relations:

  • greater_than The column value is greater than the condition.
  • less_than The column value is less than the condition.
  • equals The column value is equal to the condition.
  • not_equals The column value is not equal to the condition.

Valid values for text relations:

  • equals: Checks if the column value is equal to the condition value.
  • not_equals: Checks if the column value is not equal to the condition value.
  • starts_with: Checks if the column value starts with the condition value.
  • ends_with: Checks if the column value ends with the condition value.
  • contains: Checks if the column value contains the condition value.

- not_contains: Checks if the column value does not contain the condition value.

condition : Select products for a smart collection using a condition. Values are either strings or numbers, depending on the relation value.

column : The property of a product being used to populate the smart collection.

Valid values for text relations:

  • title: The product title.
  • type: The product type.
  • vendor: The name of the product vendor.
  • variant_title: The title of a product variant.

Valid values for number relations:

  • variant_compare_at_price: The compare price.
  • variant_weight: The weight of the product.
  • variant_inventory: The inventory stock. Note: not_equals does not work with this property.
  • variant_price: product price.

Valid values for an equals relation:

  • tag: A tag associated with the product.

relation : The relationship between the column choice, and the condition.

Valid values for number relations:

  • greater_than The column value is greater than the condition.
  • less_than The column value is less than the condition.
  • equals The column value is equal to the condition.
  • not_equals The column value is not equal to the condition.

Valid values for text relations:

  • equals: Checks if the column value is equal to the condition value.
  • not_equals: Checks if the column value is not equal to the condition value.
  • starts_with: Checks if the column value starts with the condition value.
  • ends_with: Checks if the column value ends with the condition value.
  • contains: Checks if the column value contains the condition value.
  • not_contains: Checks if the column value does not contain the condition value.

condition : Select products for a smart collection using a condition. Values are either strings or numbers, depending on the relation value.

Returns:

  • (String)


139
140
141
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 139

def rules
  @rules
end

#sort_orderString

The order of the products in the smart collection. Valid values:

  • alpha-asc: The products are sorted alphabetically from A to Z.
  • alpha-des: The products are sorted alphabetically from Z to A.
  • best-selling: The products are sorted by number of sales.
  • created: The products are sorted by the date they were created, from oldest to newest.
  • created-desc: The products are sorted by the date they were created, from newest to oldest.
  • manual: The products are manually sorted by the shop owner. Deprecation will begin in 2019.
  • price-asc: The products are sorted by price from lowest to highest.
  • price-desc: The products are sorted by price from highest to lowest.

Returns:

  • (String)


161
162
163
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 161

def sort_order
  @sort_order
end

#template_suffixString

The suffix of the Liquid template that the shop uses. By default, the original template is called product.liquid, and additional templates are called product.suffix.liquid.

Returns:

  • (String)


166
167
168
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 166

def template_suffix
  @template_suffix
end

#titleString

The name of the smart collection. Maximum length: 255 characters.

Returns:

  • (String)


171
172
173
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 171

def title
  @title
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



175
176
177
# File 'lib/falsify/models/product/collection/smart_collection.rb', line 175

def updated_at
  @updated_at
end