Overview
Collections, although not strictly the same, are akin to Categories. They serve to allow you to add products ,either explicitly or via certain criteria, for use on your store. For example, you may have a Collection called “Red T-Shirts” and within that collection specify that any product which has the tag “Red” and “T-Shirt” to be included. A collection can also have other collections underneath it, forming a nested set hierarchy. A collection must also belong to a collection group, this allows you to have greater flexibility when building out things like Menu’s and Landing pages.Collection Groups
Create a collection groupCollections
Collections are a hierarchy of models that have products associated to them, you can think of them as “Categories”. Once you have added products you can then determine how they are sorted on display.Create a collection
Add a child collection
Adding products
Products are related using aBelongsToMany relationship with a pivot column for position.
The key in the
$products array is the product idSorting products
Lunar comes with a handful of criteria out the box for sorting products in a collection:| Name | Description |
|---|---|
min_price:asc | Sorts using the base price ascending |
min_price:desc | Sorts using the base price descending |
sku:asc | Sorts using the sku ascending |
sku:desc | Sorts using the sku descending |
custom | This will allow you to specify the order of each product manually |