48 lines
1.7 KiB
Smarty
48 lines
1.7 KiB
Smarty
|
<script type="text/javascript">{literal}
|
||
|
$(document).ready(function() {
|
||
|
var loading = false;
|
||
|
var error = false;
|
||
|
var endreached = false;
|
||
|
$(window).scroll(function() {
|
||
|
if(!endreached && !error) {
|
||
|
if((($(window).scrollTop() + $(window).height()) + /*550*/ 900) >= $(document).height()) {
|
||
|
if(loading == false) {
|
||
|
loading = true;
|
||
|
$.get("{/literal}{$base_dir_ssl}{literal}modules/categoryscroll/ajax.php?c={/literal}{$id_category}{literal}&p=" + $("#product_list").val(), function(loaded) {
|
||
|
loaded = $.parseJSON(loaded)[0];
|
||
|
if(loaded.error == false) {
|
||
|
endreached = loaded.endreached;
|
||
|
$("#product_list").append(loaded.products);
|
||
|
$("#product_list").val(parseInt($("#product_list").val()) + 1);
|
||
|
|
||
|
$('.flexslider').flexslider({
|
||
|
animation: "slide",
|
||
|
controlNav: false,
|
||
|
slideshow: false,
|
||
|
itemWidth: 300,
|
||
|
pauseOnHover : false,
|
||
|
mousewheel: true,
|
||
|
});
|
||
|
|
||
|
} else {
|
||
|
error = true;
|
||
|
var error_i18n = {
|
||
|
"privatesale_inactive": "{/literal}{l s='This sale is now disabled.' mod='categoryscroll'}{literal}",
|
||
|
"permission_denied": "{/literal}{l s='You can\'t access this content.' mod='categoryscroll'}{literal}",
|
||
|
"invalid_request": "{/literal}{l s='Invalid request.' mod='categoryscroll'}{literal}",
|
||
|
"inactive_category": "{/literal}{l s='This category is disabled.' mod='categoryscroll'}{literal}"
|
||
|
};
|
||
|
$('<div class="error">' + error_i18n[loaded.error] + '</div>').insertAfter("#product_list");
|
||
|
}
|
||
|
loading = false;
|
||
|
$("#product_list").trigger('updated');
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$("#product_list").val(1);
|
||
|
});
|
||
|
{/literal}</script>
|