57 lines
1.9 KiB
PHP
57 lines
1.9 KiB
PHP
<?php
|
|
namespace front\view;
|
|
class ShopCategory
|
|
{
|
|
static public function category_description( $category )
|
|
{
|
|
return \Tpl::view( 'shop-category/category-description', [
|
|
'category' => $category
|
|
] );
|
|
}
|
|
|
|
static public function category_view( $category, $lang_id, $bs = 1 )
|
|
{
|
|
global $settings, $page;
|
|
|
|
if ( !$settings['infinitescroll'] )
|
|
{
|
|
$results = \front\factory\ShopCategory::category_products( $category, $lang_id, $bs );
|
|
|
|
if ( $results['ls'] > 1 )
|
|
{
|
|
$tpl = new \Tpl;
|
|
$tpl -> ls = $results['ls'];
|
|
$tpl -> bs = $bs ? $bs : 1;
|
|
$tpl -> page = $page;
|
|
$tpl -> link = $category['language']['seo_link'] ? $url = $category['language']['seo_link'] : $url = 'k-' . $category['id'] . '-' . \S::seo( $category['language']['title'] );
|
|
$pager = $tpl -> render( 'site/pager' );
|
|
}
|
|
|
|
return \Tpl::view( 'shop-category/category', [
|
|
'category' => $category,
|
|
'products' => $results['products'],
|
|
'pager' => $pager,
|
|
'category_description' => (int)$bs <= 1 ? true : false,
|
|
'category_additional_text' => true
|
|
] );
|
|
}
|
|
|
|
$products_count = \front\factory\ShopCategory::category_products_count( $category, $lang_id );
|
|
return \Tpl::view( 'shop-category/category-infinitescroll', [
|
|
'category' => $category,
|
|
'products_count' => $products_count,
|
|
'category_description' => (int)$bs <= 1 ? true : false,
|
|
'category_additional_text' => true
|
|
] );
|
|
}
|
|
|
|
public static function categories( $categories, $current_category = 0, $level = 0 )
|
|
{
|
|
$tpl = new \Tpl;
|
|
$tpl -> level = $level;
|
|
$tpl -> current_category = $current_category;
|
|
$tpl -> categories = $categories;
|
|
return $tpl -> render( 'shop-category/categories' );
|
|
}
|
|
}
|