Description
Catalog module helps you to create live editable catalog on frontend.
Include
use yii\easyii\modules\catalog\api\Catalog;
Public functions
object Catalog::cat( $id, $options = [] )
|
$id |
integer / string |
Category identifier can be integer (id) or string (slug) |
$options |
array |
- pageSize (int) - item count on single page
|
examples
Catalog::cat(1);
Catalog::cat('cat-slug');
|
stdClass Object
(
[id] => 1
[title] => "Category name"
[seo_h1] => "Seo category title"
[seo_title] => "Seo window title"
[seo_keywords] => "seo, website, keywords"
[seo_description] => "Seo description"
[slug] => "cat-slug"
[items] => Array
(
[0] => stdClass Object
(
[id] => 1
[title] => "Item name"
[thumb] => "/path/to/thumb.jpg"
[description] => "Item description"
[slug] => "item-slug"
[field1] => "value1"
[field2] => "value2"
[field3] => "value3"
)
)
[empty] => false
)
|
IF category with id == 1 or slug == 'cat-slug' exists |
stdClass Object
(
[id] => ""
[title] => ""
[seo_h1] => ""
[seo_title] => ""
[seo_keywords] => ""
[seo_description] => ""
[slug] => ""
[items] => Array
(
)
[empty] => true
)
|
IF category is not exist |
stdClass Object
(
[id] => ""
[title] => "<a href="...">Create category</a>"
[seo_h1] => ""
[seo_title] => ""
[seo_keywords] => ""
[seo_description] => ""
[slug] => ""
[items] => Array
(
)
[empty] => true
)
|
IF category is not exist and user logged in |
array Catalog::cats( $options = [] )
|
$options |
array |
- pageSize (int) - category count on single page
- where (array) - additional select condition
|
examples
Catalog::cats();
|
array of category objects
|
object Catalog::item( $id )
|
$id |
integer / string |
Item identifier can be integer (id) or string (slug) |
examples
Catalog::item(1);
Catalog::item('item-slug');
|
stdClass Object
(
[id] => 1
[title] => "Item name"
[thumb] => "/path/to/thumb.jpg"
[description] => "Item description"
[seo_h1] => "Seo item title"
[seo_title] => "Seo window title"
[seo_keywords] => "seo, website, keywords"
[seo_description] => "Seo description"
[slug] => "item-slug"
[field1] => "value1"
[field2] => "value2"
[field3] => "value3"
[photos] => Array
(
[0] => stdClass Object
(
[id] => 1
[image] => "/path/to/image.jpg"
[thumb] => "/path/to/thumb.jpg"
[box] => "<a href=image><img src=thumb></a>"
)
)
)
|
IF item with id == 1 or slug == 'item-slug' exists |
null
|
IF item is not exist |
string Catalog::photo( $id )
|
$id |
integer |
Photo identifier |
examples
Catalog::photo(1);
|
"/path/to/image.jpg"
|
IF photo with id == 1 exists |
void Catalog::plugin( $options = [] )
|
$options |
array |
Fancybox jquery widget options. More info
|
On all your photos, called as $photo->box, will be apply Fancybox plugin.
|
string Catalog::pages()
|
returns pagination html generated by yii\widgets\LinkPager widget. |
object Catalog::pagination()
|
returns yii\data\Pagination object. |