2016-01-04 12:49:26 +01:00
|
|
|
<script type="text/javascript">{literal}
|
|
|
|
function hideExpressCart(event){
|
|
|
|
if($(".button.expresscart.active").parent().parent().has($(event.target)).length == 0 || $(".button.expresscart.active") == $(event.target)) {
|
|
|
|
event.data.m.removeClass('active');
|
|
|
|
$(".expresscart_frame").hide();
|
|
|
|
$("html").unbind("click", hideExpressCart);
|
|
|
|
$('a.button').css('opacity', 1);
|
|
|
|
|
|
|
|
$('.close_popup').remove();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function showExpressCart(event) {
|
|
|
|
var m = $(event.target);
|
|
|
|
m.toggleClass('active');
|
|
|
|
|
|
|
|
if(m.parent().children(".expresscart_frame:visible").length > 0) {
|
|
|
|
event.data = {m: m};
|
|
|
|
hideExpressCart(event);
|
|
|
|
} else {
|
|
|
|
m.parent().children(".expresscart_frame").slideDown(function() {
|
|
|
|
if(m.parent().children(".expresscart_frame").children("p.loading").length > 0) {
|
|
|
|
var id_product = m.parent().children(".button.ajax_add_to_cart_button").attr("rel").split("_")[3];
|
|
|
|
m.parent().children(".expresscart_frame").append("<iframe src=\"{/literal}{$base_dir_ssl}{literal}modules/expresscart/ajax.php?id_product=" + id_product + "\" style=\"display: none;\" border=\"0\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" onload=\"$(this).show(); $(this).parent().children('p.loading').remove();\"></iframe>");
|
|
|
|
|
|
|
|
}
|
|
|
|
$(m).parent().append('<a href="#" class="close_popup"></a>');
|
|
|
|
$('.close_popup', $(m).parent()).click(function() {
|
|
|
|
$(this).remove();
|
|
|
|
hideExpressCart(event);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('a.button').css('opacity', 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
$("html").bind("click", {m: m}, hideExpressCart);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function initButtons() {
|
2017-12-04 09:36:08 +01:00
|
|
|
$('.button.ajax_add_to_cart_button.exclusive:visible').hide()
|
|
|
|
.after("{/literal}<a title=\"{l s='Express cart' mod='expresscart'}\" onclick=\"showExpressCart(event); return false;\" class=\"button expresscart\">{l s='Express cart' mod='expresscart'}</a><div style=\"display:none;\" class=\"expresscart_frame\"><p class=\"loading\"><img src=\"{$img_dir|replace:'"':'"'}ajax-loader.gif\" alt=\"\" /></p></div>{literal}");
|
2016-01-04 12:49:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
initButtons();
|
|
|
|
|
|
|
|
$("#product_list").bind("updated", function() {
|
|
|
|
initButtons();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
{/literal}</script>
|