first commit
This commit is contained in:
71
templates/shop-search/product-search.php
Normal file
71
templates/shop-search/product-search.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<? global $lang_id;?>
|
||||
<?
|
||||
$this -> product -> language['seo_link'] ? $url = '/' . $this -> product -> language['seo_link'] : $url = '/p-' . $this -> product['id'] . '-' . \S::seo( $this -> product -> language['name'] );
|
||||
|
||||
if ( \S::get_session( 'current-lang' ) != \front\factory\Languages::default_language() and $url != '#' )
|
||||
$url = '/' . \S::get_session( 'current-lang' ) . $url;
|
||||
?>
|
||||
<div class="product-search">
|
||||
<? if ( $this -> product -> new_to_date and $this -> product -> new_to_date >= date( 'Y-m-d' ) ):?>
|
||||
<div class="new"><?= \S::lang( 'nowosc' );?></div>
|
||||
<? endif;?>
|
||||
<a href="<?= $url;?>" class="a-img">
|
||||
<div class="img">
|
||||
<? if ( file_exists( substr( $this -> product -> images[0]['src'], 1 ) ) ):?>
|
||||
<? if ( $this -> class == 'item' ):?>
|
||||
<img class="owl-lazy" data-src="/thumb/490/0/<?= substr( $this -> product -> images[0]['src'], 1, strlen( $this -> product -> images[0]['src'] ) );?>" alt="<?= $this -> product -> images[0]['alt'];?>">
|
||||
<? else:?>
|
||||
<img class="first" src="/thumb/490/0/<?= substr( $this -> product -> images[0]['src'], 1, strlen( $this -> product -> images[0]['src'] ) );?>" alt="<?= $this -> product -> images[0]['alt'];?>">
|
||||
<? if ( file_exists( substr( $this -> product -> images[1]['src'], 1 ) ) ):?>
|
||||
<img class="second" src="/thumb/490/0/<?= substr( $this -> product -> images[1]['src'], 1, strlen( $this -> product -> images[1]['src'] ) );?>" alt="<?= $this -> product -> images[1]['alt'];?>">
|
||||
<? else:?>
|
||||
<img class="second" src="/thumb/490/0/<?= substr( $this -> product -> images[0]['src'], 1, strlen( $this -> product -> images[0]['src'] ) );?>" alt="<?= $this -> product -> images[0]['alt'];?>">
|
||||
<? endif;?>
|
||||
<? endif;?>
|
||||
<? else:?>
|
||||
|
||||
<? endif;?>
|
||||
</div>
|
||||
</a>
|
||||
<div class="product-details">
|
||||
<h2 class="name">
|
||||
<a href="<?= $url;?>" class="a-name">
|
||||
<?= $this -> product -> language['name'];?>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="prices">
|
||||
<?
|
||||
$prices = $this -> product -> getDefaultCombinationPrices();
|
||||
if ( $prices )
|
||||
{
|
||||
if ( $prices['price_brutto_promo'] ):?>
|
||||
<div class="price-old">
|
||||
<?= \shop\Shop::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<div class="price">
|
||||
<?= \shop\Shop::shortPrice( $prices['price_brutto_promo'] );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<? else:?>
|
||||
<div class="price">
|
||||
<?= \shop\Shop::shortPrice( $prices['price_brutto'] );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<? endif;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $this -> product -> price_brutto_promo ):?>
|
||||
<div class="price-old">
|
||||
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<div class="price">
|
||||
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto_promo );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<? else:?>
|
||||
<div class="price">
|
||||
<?= \shop\Shop::shortPrice( $this -> product -> price_brutto );?> <span class="small">zł</span>
|
||||
</div>
|
||||
<? endif;
|
||||
};?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
13
templates/shop-search/products.php
Normal file
13
templates/shop-search/products.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<? global $lang_id;?>
|
||||
<? if ( $this -> query ):?>
|
||||
<div class="box-title">
|
||||
<?= \S::lang( 'wyniki-wyszukiwania-dla-zapytania' ) . ': <strong>' . $this -> query . '</strong>';?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
<div class="search-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>
|
||||
102
templates/shop-search/simple-form.php
Normal file
102
templates/shop-search/simple-form.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<div id="search-button">
|
||||
<button class="btn" type="button">
|
||||
<img src="/layout/images/icon-magnifier.svg">
|
||||
</button>
|
||||
</div>
|
||||
<div id="search-form-big">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="small-title">
|
||||
<?= \S::lang( 'czego-szukasz' );?>?
|
||||
<a href="#" class="search-form-big-close"><i class="fa fa-times"></i></a>
|
||||
</div>
|
||||
<div class="input">
|
||||
<input type="text" name="q" class="form-control" placeholder="<?= \S::lang( 'wpisz-szukany-produkt' );?>">
|
||||
</div>
|
||||
<div class="search-big-results"></div>
|
||||
<div class="search-more-button"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" class="footer">
|
||||
$( function()
|
||||
{
|
||||
$( 'body' ).on( click_event, '.search-form-big-close', function()
|
||||
{
|
||||
$( '#search-form-big' ).removeClass( 'visible' );
|
||||
$( '.menu-overlay' ).removeClass( 'visible' );
|
||||
$( 'body' ).removeClass( 'no-scroll' );
|
||||
});
|
||||
|
||||
$( 'body' ).on( click_event, '#search-button .btn', function()
|
||||
{
|
||||
$( '#search-form-big' ).addClass( 'visible' );
|
||||
$( '#search-form-big input' ).val( "" ).focus();
|
||||
$( '.menu-overlay' ).addClass( 'visible' );
|
||||
$( 'body' ).addClass( 'no-scroll' );
|
||||
});
|
||||
|
||||
var timer = '';
|
||||
$( '#search-form-big input[type="text"]' ).keyup( function()
|
||||
{
|
||||
var _this = $( this);
|
||||
clearTimeout( timer );
|
||||
timer = setTimeout( function()
|
||||
{
|
||||
if ( _this.val().length < 2 )
|
||||
return false;
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
url: '/search/search_products',
|
||||
data:
|
||||
{
|
||||
query: _this.val()
|
||||
},
|
||||
beforeSend: function()
|
||||
{
|
||||
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
data = jQuery.parseJSON( response );
|
||||
$( '.search-big-results' ).html( '' );
|
||||
var time = 0;
|
||||
if ( data == null )
|
||||
{
|
||||
$( '.search-big-results' ).html( '<div class="no-found"><?= \S::lang( 'nie-znaleziono-produktow' );?><\/div>' );
|
||||
$( '.search-more-button' ).html('');
|
||||
}
|
||||
else
|
||||
{
|
||||
$.each( data, function( index, item )
|
||||
{
|
||||
setTimeout( function()
|
||||
{
|
||||
$( '.search-big-results' ).append( item ).children(':last').hide().fadeIn( 500 );
|
||||
observer.observe();
|
||||
}, time );
|
||||
time += 200;
|
||||
var is_last_item = (index == (data.length - 1));
|
||||
|
||||
if ( is_last_item )
|
||||
{
|
||||
setTimeout( function()
|
||||
{
|
||||
$( '.search-more-button' ).html( '<a href="/wyszukiwarka/' + _this.val() + '" class="btn btn-success"><?= \S::lang( 'zobacz-wiecej' );?><\/a>' );
|
||||
}, time );
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}, 1000 );
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user