first commit

This commit is contained in:
2024-10-25 23:02:37 +02:00
commit faeb2e52e8
7653 changed files with 1095335 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
<div class="category-additional-text">
<?= $this -> category['language']['additional_text'];?>
</div>

View File

@@ -0,0 +1,9 @@
<div id="category-subcategory-tiles">
<ul class="category-subcategory-tiles">
<?php foreach ( $this -> categories as $category ): ?>
<li class="category-subcategory-tile">
<a href="/<?= $category['seo_link']; ?>"><?= $category['title']; ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>

View File

@@ -0,0 +1,9 @@
<? global $lang_id;?>
<div class="row">
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):?>
<?= \Tpl::view( 'shop-product/product-mini', [
'product' => \shop\Product::getFromCache( $product_id, $lang_id ),
'class' => 'col-12 col-sm-6 col-lg-3'
] );?>
<? endforeach; endif;?>
</div>

View File

@@ -0,0 +1,61 @@
<?
if ( is_array( $this -> categories ) ):
?>
<ul class="<? if ( $this -> level == 0 ):?>shop-categories<? endif;?> level-<?= (int)$this -> level;?>">
<? foreach ( $this -> categories as $category ):?>
<? if ( $category['status'] ):?>
<li id="category-<?= $category['id'];?>" class="<? if ( $category['id'] == $this -> current_category ) echo 'active open';?>
<?
if ( $this -> level == 1 and is_array( $category['categories'] ) ):
foreach ( $category['categories'] as $category_tmp ):
if ( $category_tmp['id'] == $this -> current_category )
echo 'open';
endforeach;
endif;
?>">
<?
$category['language']['seo_link'] ? $url = '/' . $category['language']['seo_link'] : $url = '/k-' . $category['id'] . '-' . \S::seo( $category['language']['title'] );
if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#' )
$url = '/' . \S::get_session( 'current-lang' ) . $url;
?>
<a href="<?= $url;?>" title="<?= $category['language']['title'];?>" <? if ( is_array( $category['categories'] ) ) echo "class='menu-trigger'";?>>
<?= $category['language']['title'];?>
</a>
<? if ( is_array( $category['categories'] ) and $category['id'] == $this -> current_category and $this -> level != 0 ):?>
<i class="fa fa-chevron-up toggle" category="<?= $category['id'];?>"></i>
<? endif;?>
<? if ( is_array( $category['categories'] ) and $category['id'] != $this -> current_category and $this -> level != 0 ):?>
<i class="fa fa-chevron-down toggle" category="<?= $category['id'];?>"></i>
<? endif;?>
<? if ( is_array( $category['categories'] ) ) echo \front\view\ShopCategory::categories( $category['categories'], $this -> current_category, $this -> level + 1 );?>
</li>
<? endif;?>
<? endforeach;?>
</ul>
<?
endif;
?>
<? if ( $this -> level == 0 ):?>
<script class="footer" type="text/javascript">
$( function()
{
$( 'body' ).on( click_event, '.shop-categories .toggle', function()
{
var category = $( this ).attr( 'category' );
if ( $( '#category-' + category ).hasClass( 'open' ) )
{
$( '#category-' + category ).children( 'ul' ).css( 'height', 0 );
$( '#category-' + category ).children( 'i.toggle' ).removeClass( 'fa-chevron-up' ).addClass( 'fa-chevron-down' );
$( '#category-' + category ).removeClass( 'open' );
}
else
{
$( '#category-' + category ).children( 'ul' ).css( 'height', 'auto' );
$( '#category-' + category ).children( 'i.toggle' ).removeClass( 'fa-chevron-down' ).addClass( 'fa-chevron-up' );
$( '#category-' + category ).addClass( 'open' );
}
});
});
</script>
<? endif; ?>

View File

@@ -0,0 +1,24 @@
<? if ( $this -> category['language']['text'] or $this -> category['language']['text_hidden']) : ?>
<div id="category-description">
<div id="visible"><?= $this->category['language']['text']; ?></div>
<div id="hidden"><?= $this->category['language']['text_hidden']; ?></div>
<? if ($this->category['language']['text_hidden']) : ?>
<a href="#" class="btn"><?= \S::lang('wiecej'); ?></a>
<? endif; ?>
</div>
<? endif; ?>
<script class="footer" type="text/javascript">
$( function()
{
$( 'body' ).on( 'click touchstart', '#category-description .btn', function(e) {
e.preventDefault();
if ($('#category-description #hidden').is(':visible')) {
$('#category-description #hidden').slideToggle();
$('#category-description .btn').html('<?= \S::lang('wiecej'); ?>');
} else {
$('#category-description #hidden').slideToggle();
$('#category-description .btn').html('<?= \S::lang('mniej'); ?>');
}
});
});
</script>

View File

@@ -0,0 +1,75 @@
<? global $lang_id; ?>
<? if ($this->query) : ?>
<div class="box-title">
<?= \S::lang('wyniki-wyszukiwania-dla-zapytania') . ': <strong>' . $this->query . '</strong>'; ?>
</div>
<? endif; ?>
<?
if ($this->category_additional_text) :
echo \Tpl::view('shop-category/_partials/category-additional-text', [
'category' => $this->category
]);
endif;
?>
<div class="category-content">
<? if (is_array($this->products)) : foreach ($this->products as $product_id) :
echo \Tpl::view('shop-product/product-mini', [
'product' => \shop\Product::getFromCache( $product_id, $lang_id )
]);
endforeach;
endif; ?>
</div>
<?
if ($this->category_description) :
echo \Tpl::view('shop-category/category-description', [
'category' => $this->category
]);
endif;
?>
<script type="text/javascript" class="footer">
$(document).ready(function() {
let offset = 0;
const limit = 8;
let isLoading = false;
const $categoryContent = $('.category-content');
function loadProducts() {
if (isLoading) {
return;
}
isLoading = true;
$.ajax({
type: 'POST',
cache: false,
url: '/shopProduct/lazy_loading_products',
data: {
offset: offset,
category_id: <?= $this -> category['id'] ?>
},
beforeSend: function() {
},
success: function( response ) {
response = jQuery.parseJSON( response );
if ( response.html.length > 0 ) {
$categoryContent.append( response.html );
offset += limit;
isLoading = false;
} else {
$( document) .off( 'scroll', checkScroll );
}
}
});
}
function checkScroll() {
if( $(window).scrollTop() >= $('.category-content').offset().top + $('.category-content').outerHeight() - window.innerHeight - 250 ) {
loadProducts();
}
}
$( document ).on( 'scroll', checkScroll );
loadProducts();
});
</script>

View File

@@ -0,0 +1,39 @@
<? global $lang_id;?>
<? if ( $this -> query ):?>
<div class="box-title">
<?= \S::lang( 'wyniki-wyszukiwania-dla-zapytania' ) . ': <strong>' . $this -> query . '</strong>';?>
</div>
<? endif;?>
<?
if ( $this -> category_additional_text ):
echo \Tpl::view( 'shop-category/_partials/category-additional-text', [
'category' => $this -> category
] );
endif;
?>
<?php
if ( $this -> category['view_subcategories'] ):
echo \Tpl::view( 'shop-category/_partials/category-subcategory-tiles', [
'categories' => \shop\Category::get_subcategory_by_category( $this -> category['id'] ),
] );
endif;
?>
<div class="category-content" t='2'>
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
echo \Tpl::view( 'shop-product/product-mini', [
'product' => \shop\Product::getFromCache( $product_id, $lang_id )
] );
endforeach; endif;?>
</div>
<?= $this -> pager;?>
<?
if ( $this -> category_description ):
echo \Tpl::view( 'shop-category/category-description', [
'category' => $this -> category
] );
endif;
?>

View File

@@ -0,0 +1,14 @@
<? global $lang_id;?>
<? if ( $this -> query ):?>
<div class="box-title">
<?= \S::lang( 'wyniki-wyszukiwania-dla-zapytania' ) . ': <strong>' . $this -> query . '</strong>';?>
</div>
<? endif;?>
<div class="category-content">
<? if ( is_array( $this -> products ) ): foreach ( $this -> products as $product_id ):
$product = new \shop\Product( $product_id );
echo \Tpl::view( 'shop-product/product-mini', [
'product' => new \shop\Product( $product_id, $lang_id )
] );
endforeach; endif;?>
</div>