first commit
This commit is contained in:
87
modules/leofeature/views/js/back.js
Normal file
87
modules/leofeature/views/js/back.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$('select#id_product_review_criterion_type').change(function() {
|
||||
// PS 1.6
|
||||
$('#categoryBox').closest('div.form-group').hide();
|
||||
$('#ids_product').closest('div.form-group').hide();
|
||||
// PS 1.5
|
||||
$('#categories-treeview').closest('div.margin-form').hide();
|
||||
$('#categories-treeview').closest('div.margin-form').prev().hide();
|
||||
$('#ids_product').closest('div.margin-form').hide();
|
||||
$('#ids_product').closest('div.margin-form').prev().hide();
|
||||
|
||||
if (this.value == 2)
|
||||
{
|
||||
$('#categoryBox').closest('div.form-group').show();
|
||||
// PS 1.5
|
||||
$('#categories-treeview').closest('div.margin-form').show();
|
||||
$('#categories-treeview').closest('div.margin-form').prev().show();
|
||||
}
|
||||
else if (this.value == 3)
|
||||
{
|
||||
$('#ids_product').closest('div.form-group').show();
|
||||
// PS 1.5
|
||||
$('#ids_product').closest('div.margin-form').show();
|
||||
$('#ids_product').closest('div.margin-form').prev().show();
|
||||
}
|
||||
});
|
||||
|
||||
$('select#id_product_review_criterion_type').trigger("change");
|
||||
|
||||
//DONGND:: tab change in group config
|
||||
var id_panel = $("#leofeature-setting .leofeature-tablist li.active a").attr("href");
|
||||
$(id_panel).addClass('active').show();
|
||||
$('.leofeature-tablist li').click(function(){
|
||||
if(!$(this).hasClass('active'))
|
||||
{
|
||||
var default_tab = $(this).find('a').attr("href");
|
||||
$('#LEOFEATURE_DEFAULT_TAB').val(default_tab);
|
||||
}
|
||||
})
|
||||
|
||||
// console.log('test');
|
||||
if (typeof leofeature_module_dir != 'undefined')
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: leofeature_module_dir + 'psajax.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "get-new-review",
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if(result != '')
|
||||
{
|
||||
var obj = $.parseJSON(result);
|
||||
if (obj.number_review > 0)
|
||||
{
|
||||
$('#subtab-AdminLeofeatureManagement').addClass('has-review');
|
||||
// $('#subtab-AdminLeofeatureReviews').append('<span id="total_notif_number_wrapper" class="notifs_badge"><span id="total_notif_value">'+obj.number_review+'</span></span>');
|
||||
$('#subtab-AdminLeofeatureReviews').append('<div class="notification-container"><span class="notification-counter">'+obj.number_review+'</span></div>');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
// alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
35
modules/leofeature/views/js/index.php
Normal file
35
modules/leofeature/views/js/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
2472
modules/leofeature/views/js/jquery.mCustomScrollbar.js
Normal file
2472
modules/leofeature/views/js/jquery.mCustomScrollbar.js
Normal file
File diff suppressed because it is too large
Load Diff
22
modules/leofeature/views/js/jquery.mousewheel.min.js
vendored
Normal file
22
modules/leofeature/views/js/jquery.mousewheel.min.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
/*!
|
||||
* jQuery Mousewheel 3.1.13
|
||||
*
|
||||
* Copyright 2015 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
|
||||
26
modules/leofeature/views/js/jquery.rating.pack.js
Normal file
26
modules/leofeature/views/js/jquery.rating.pack.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
/*
|
||||
### jQuery Star Rating Plugin v2.0 - 2008-03-12 ###
|
||||
By Diego A, http://www.fyneworks.com, diego@fyneworks.com
|
||||
- v2 by Keith Wood, kbwood@virginbroadband.com.au
|
||||
|
||||
Project: http://plugins.jquery.com/project/MultipleFriendlyStarRating
|
||||
Website: http://www.fyneworks.com/jquery/star-rating/
|
||||
|
||||
This is a modified version of the star rating plugin from:
|
||||
http://www.phpletter.com/Demo/Jquery-Star-Rating-Plugin/
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';4(w)(3($){$.Y.T=3(c){c=$.15({m:\'X U\',E:\'\',B:z,8:z},c||{});o d={};o e={t:3(n,a,b){2.6(n);$(a).D(\'.j\').A().l(b||\'x\')},6:3(n){$(d[n].7).O(\'.j\').u(\'9\').u(\'x\')},h:3(n){4(!$(d[n].5).Z(\'.m\')){$(d[n].5).D(\'.j\').A().l(\'9\')}},g:3(n,a){d[n].5=a;o b=$(a).L(\'a\').K();$(d[n].7).J(b);e.6(n);e.h(n);4(c.I)c.I.W(d[n].7,[b,a])}};2.V(3(i){o n=2.G;4(!d[n])d[n]={r:0};i=d[n].r;d[n].r++;4(i==0){c.8=$(2).S(\'p\')||c.8;d[n].7=$(\'<R Q="P" G="\'+n+\'" q=""\'+(c.8?\' p="p"\':\'\')+\'>\');$(2).C(d[n].7);4(c.8||c.B){}F{$(2).C($(\'<k y="m"><a s="\'+c.m+\'">\'+c.E+\'</a></k>\').H(3(){e.6(n);$(2).l(\'9\')}).v(3(){e.h(n);$(2).u(\'9\')}).g(3(){e.g(n,2)}))}};f=$(\'<k y="j"><a s="\'+(2.s||2.q)+\'">\'+2.q+\'</a></k>\');$(2).N(f);4(c.8){$(f).l(\'M\')}F{$(f).H(3(){e.6(n);e.t(n,2)}).v(3(){e.6(n);e.h(n)}).g(3(){e.g(n,2)})};4(2.14)d[n].5=f;$(2).13();4(i+1==2.12)e.h(n)});11(n 10 d)4(d[n].5){e.t(n,d[n].5,\'9\');$(d[n].7).J($(d[n].5).L(\'a\').K())}16 2}})(w);',62,69,'||this|function|if|currentElem|drain|valueElem|readOnly|star_on||||||eStar|click|reset||star|div|addClass|cancel||var|disabled|value|count|title|fill|removeClass|mouseout|jQuery|star_hover|class|false|andSelf|required|before|prevAll|cancelValue|else|name|mouseover|callback|val|text|children|star_readonly|after|siblings|hidden|type|input|attr|rating|Rating|each|apply|Cancel|fn|is|in|for|length|remove|checked|extend|return'.split('|'),0,{}));
|
||||
2246
modules/leofeature/views/js/leofeature_cart.js
Normal file
2246
modules/leofeature/views/js/leofeature_cart.js
Normal file
File diff suppressed because it is too large
Load Diff
234
modules/leofeature/views/js/leofeature_compare.js
Normal file
234
modules/leofeature/views/js/leofeature_compare.js
Normal file
@@ -0,0 +1,234 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
createLeoCompareModalPopup();
|
||||
LeoCompareButtonAction();
|
||||
prestashop.on('updateProductList', function() {
|
||||
LeoCompareButtonAction();
|
||||
});
|
||||
//DONGND:: recall button action if need when change attribute at product page
|
||||
prestashop.on('updatedProduct', function() {
|
||||
LeoCompareButtonAction();
|
||||
});
|
||||
prestashop.on('clickQuickView', function() {
|
||||
check_active_compare = setInterval(function(){
|
||||
if($('.quickview.modal').length)
|
||||
{
|
||||
$('.quickview.modal').on('shown.bs.modal', function (e) {
|
||||
LeoCompareButtonAction();
|
||||
})
|
||||
clearInterval(check_active_compare);
|
||||
}
|
||||
|
||||
}, 300);
|
||||
|
||||
});
|
||||
activeEventModalCompare();
|
||||
});
|
||||
|
||||
function createLeoCompareModalPopup()
|
||||
{
|
||||
var leoCompareModalPopup = '';
|
||||
leoCompareModalPopup += '<div class="modal leo-modal leo-modal-compare fade" tabindex="-1" role="dialog" aria-hidden="true">';
|
||||
leoCompareModalPopup += '<div class="modal-dialog" role="document">';
|
||||
leoCompareModalPopup += '<div class="modal-content">';
|
||||
leoCompareModalPopup += '<div class="modal-header">';
|
||||
leoCompareModalPopup += '<button type="button" class="close" data-dismiss="modal" aria-label="Close">';
|
||||
leoCompareModalPopup += '<span aria-hidden="true">×</span>';
|
||||
leoCompareModalPopup += '</button>';
|
||||
leoCompareModalPopup += '<h5 class="modal-title text-xs-center">';
|
||||
leoCompareModalPopup += '</h5>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
leoCompareModalPopup += '</div>';
|
||||
$('body').append(leoCompareModalPopup);
|
||||
}
|
||||
function LeoCompareButtonAction()
|
||||
{
|
||||
$('.leo-compare-button').click(function(){
|
||||
if (!$('.leo-compare-button.active').length)
|
||||
{
|
||||
var total_product_compare = compared_products.length;
|
||||
var id_product = $(this).data('id-product');
|
||||
|
||||
var content_product_compare_mess_remove = productcompare_remove+'. <a href="'+productcompare_url+'"><strong>'+productcompare_viewlistcompare+'.</strong></a>';
|
||||
var content_product_compare_mess_add = productcompare_add+'. <a href="'+productcompare_url+'"><strong>'+productcompare_viewlistcompare+'.</strong></a>';
|
||||
var content_product_compare_mess_max = productcompare_max_item+'. <a href="'+productcompare_url+'"><strong>'+productcompare_viewlistcompare+'.</strong></a>';
|
||||
|
||||
$(this).addClass('active');
|
||||
$(this).find('.leo-compare-bt-loading').css({'display':'block'});
|
||||
$(this).find('.leo-compare-bt-content').hide();
|
||||
var object_e = $(this);
|
||||
if ($(this).hasClass('added') || $(this).hasClass('delete'))
|
||||
{
|
||||
//DONGND:: remove product form list product compare
|
||||
//DONGND:: add product to list product compare
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: productcompare_url+ '?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"ajax": 1,
|
||||
"action": "remove",
|
||||
"id_product": id_product,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
// console.log(result);
|
||||
if (result == 1)
|
||||
{
|
||||
//Leotheme add: update number product on icon compare
|
||||
if ($('.ap-btn-compare .ap-total-compare').length)
|
||||
{
|
||||
var old_num_compare = parseInt($('.ap-btn-compare .ap-total-compare').data('compare-total'));
|
||||
var new_num_compare = old_num_compare-1;
|
||||
$('.ap-btn-compare .ap-total-compare').data('compare-total',new_num_compare);
|
||||
$('.ap-btn-compare .ap-total-compare').text(new_num_compare);
|
||||
}
|
||||
|
||||
compared_products.splice($.inArray(parseInt(id_product), compared_products), 1);
|
||||
if (object_e.hasClass('delete'))
|
||||
{
|
||||
//DONGND:: remove from page product compare
|
||||
if ($('.leo-productscompare-item').length == 1)
|
||||
{
|
||||
window.location.replace(productcompare_url);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('td.product-'+id_product).fadeOut(function(){
|
||||
$(this).remove();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//DONGND:: remove from page product list
|
||||
$('.leo-modal-compare .modal-title').html(content_product_compare_mess_remove);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').removeClass('added');
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').attr('title',buttoncompare_title_add);
|
||||
// object_e.find('.leo-compare-bt-loading').hide();
|
||||
// object_e.find('.leo-compare-bt-content').show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-modal-compare .modal-title').html(productcompare_remove_error);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
|
||||
}
|
||||
object_e.find('.leo-compare-bt-loading').hide();
|
||||
object_e.find('.leo-compare-bt-content').show();
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (total_product_compare < comparator_max_item)
|
||||
{
|
||||
//DONGND:: add product to list product compare
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: productcompare_url+ '?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"ajax": 1,
|
||||
"action": "add",
|
||||
"id_product": id_product,
|
||||
"token": leo_token,
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
// console.log(result);
|
||||
if (result == 1)
|
||||
{
|
||||
$('.leo-modal-compare .modal-title').html(content_product_compare_mess_add);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
//Leotheme add: update number product on icon compare
|
||||
if ($('.ap-btn-compare .ap-total-compare').length)
|
||||
{
|
||||
var old_num_compare = parseInt($('.ap-btn-compare .ap-total-compare').data('compare-total'));
|
||||
var new_num_compare = old_num_compare+1;
|
||||
$('.ap-btn-compare .ap-total-compare').data('compare-total',new_num_compare);
|
||||
$('.ap-btn-compare .ap-total-compare').text(new_num_compare);
|
||||
}
|
||||
|
||||
compared_products.push(id_product);
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').addClass('added');
|
||||
$('.leo-compare-button[data-id-product='+id_product+']').attr('title',buttoncompare_title_remove);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-modal-compare .modal-title').html(productcompare_add_error);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
}
|
||||
|
||||
object_e.find('.leo-compare-bt-loading').hide();
|
||||
object_e.find('.leo-compare-bt-content').show();
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//DONGND:: list product compare limited
|
||||
$('.leo-modal-compare .modal-title').html(content_product_compare_mess_max);
|
||||
$('.leo-modal-compare').modal('show');
|
||||
object_e.find('.leo-compare-bt-loading').hide();
|
||||
object_e.find('.leo-compare-bt-content').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
}
|
||||
|
||||
function activeEventModalCompare()
|
||||
{
|
||||
$('.leo-modal-compare').on('hide.bs.modal', function (e) {
|
||||
// console.log($('.leo-modal-review-bt').length);
|
||||
if ($('.leo-compare-button.active').length)
|
||||
{
|
||||
// console.log('aaa');
|
||||
$('.leo-compare-button.active').removeClass('active');
|
||||
}
|
||||
})
|
||||
$('.leo-modal-compare').on('hidden.bs.modal', function (e) {
|
||||
$('body').css('padding-right', '');
|
||||
})
|
||||
$('.leo-modal-compare').on('shown.bs.modal', function (e) {
|
||||
if ($('.quickview.modal').length)
|
||||
{
|
||||
$('.quickview.modal').modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
306
modules/leofeature/views/js/leofeature_review.js
Normal file
306
modules/leofeature/views/js/leofeature_review.js
Normal file
@@ -0,0 +1,306 @@
|
||||
/**
|
||||
* 2007-2017 Leotheme
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Leo feature for prestashop 1.7: ajax cart, review, compare, wishlist at product list
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* @Module Name: Leo Feature
|
||||
* @author leotheme <leotheme@gmail.com>
|
||||
* @copyright 2007-2018 Leotheme
|
||||
* @license http://leotheme.com - prestashop template provider
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
if ($('.open-review-form').length)
|
||||
{
|
||||
var id_product = $('.open-review-form').data('id-product');
|
||||
var is_logged = $('.open-review-form').data('is-logged');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "render-modal-review",
|
||||
"id_product": id_product,
|
||||
"is_logged": is_logged,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if(result != '')
|
||||
{
|
||||
$('body').append(result);
|
||||
activeEventModalReview();
|
||||
activeStar();
|
||||
$('.open-review-form').fadeIn('fast');
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
// alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
|
||||
$('.open-review-form').click(function(){
|
||||
if ($('#criterions_list').length)
|
||||
{
|
||||
$('.leo-modal-review').modal('show');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($('.leo-modal-review .modal-body .disable-form-review').length)
|
||||
{
|
||||
$('.leo-modal-review').modal('show');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-modal-review-bt').remove();
|
||||
$('.leo-modal-review .modal-header').remove();
|
||||
$('.leo-modal-review .modal-body').empty();
|
||||
$('.leo-modal-review .modal-body').append('<div class="form-group disable-form-review has-danger text-center"><label class="form-control-label">'+disable_review_form_txt+'</label></div>');
|
||||
$('.leo-modal-review').modal('show');
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
$('.read-review').click(function(){
|
||||
// if ($('.leo-product-show-review-title').length && $('#leo-product-show-review-content').length)
|
||||
if ($('.leo-product-show-review-title').length)
|
||||
{
|
||||
if ($('.leo-product-show-review-title').hasClass('leofeature-accordion'))
|
||||
{
|
||||
if ($('.leo-product-show-review-title').hasClass('collapsed'))
|
||||
{
|
||||
$('.leo-product-show-review-title').trigger('click');
|
||||
}
|
||||
var timer = setInterval(function() {
|
||||
if ($('#collapseleofeatureproductreview').hasClass('collapse in') || $('#collapsereviews').hasClass('collapse in')) {
|
||||
//run some other function
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.leo-product-show-review-title').offset().top
|
||||
}, 500);
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.leo-product-show-review-title').trigger('click');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.leo-product-show-review-title').offset().top
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.usefulness_btn').click(function(){
|
||||
if (!$(this).hasClass('disabled'))
|
||||
{
|
||||
$(this).addClass('active');
|
||||
$(this).parents('.review_button').find('.usefulness_btn').addClass('disabled');
|
||||
var id_product_review = $(this).data('id-product-review');
|
||||
var is_usefull = $(this).data('is-usefull');
|
||||
var e_parent_button = $(this).parent();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "add-review-usefull",
|
||||
"id_product_review": id_product_review,
|
||||
"is_usefull": is_usefull,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if (result != '')
|
||||
{
|
||||
e_parent_button.fadeOut(function(){
|
||||
e_parent_button.remove();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
// window.location.replace($('.open-review-form').data('product-link'));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.report_btn').click(function(){
|
||||
if (!$(this).hasClass('disabled'))
|
||||
{
|
||||
$(this).addClass('disabled');
|
||||
var e_button = $(this);
|
||||
var id_product_review = $(this).data('id-product-review');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
"action": "add-review-report",
|
||||
"id_product_review": id_product_review,
|
||||
"token": leo_token
|
||||
},
|
||||
success: function (result)
|
||||
{
|
||||
if (result != '')
|
||||
{
|
||||
e_button.fadeOut(function(){
|
||||
e_button.remove();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
// window.location.replace($('.open-review-form').data('product-link'));
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// activeEventModalReview();
|
||||
activeStar();
|
||||
});
|
||||
|
||||
function activeStar()
|
||||
{
|
||||
//DONGND:: add txt cancel rating to translate
|
||||
$('input.star').rating({cancel: cancel_rating_txt});
|
||||
$('.auto-submit-star').rating({cancel: cancel_rating_txt});
|
||||
}
|
||||
|
||||
function activeEventModalReview()
|
||||
{
|
||||
$('.form-new-review').submit(function(){
|
||||
if ($('.new_review_form_content .form-group.leo-has-error').length || $('.leo-fake-button').hasClass('validate-ok'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$('.leo-modal-review').on('show.bs.modal', function (e) {
|
||||
$('.leo-modal-review-bt').click(function(){
|
||||
if (!$(this).hasClass('active'))
|
||||
{
|
||||
$(this).addClass('active');
|
||||
$('.leo-modal-review-bt-text').hide();
|
||||
$('.leo-modal-review-loading').css({'display':'block'});
|
||||
|
||||
$('.new_review_form_content input, .new_review_form_content textarea').each(function(){
|
||||
|
||||
if ($(this).val() == '')
|
||||
{
|
||||
$(this).parent('.form-group').addClass('leo-has-error');
|
||||
$(this).attr("required", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).parent('.form-group').removeClass('leo-has-error');
|
||||
$(this).removeAttr('required');
|
||||
}
|
||||
})
|
||||
|
||||
if ($('.new_review_form_content .form-group.leo-has-error').length)
|
||||
{
|
||||
$(this).removeClass('active');
|
||||
$('.leo-modal-review-bt-text').show();
|
||||
$('.leo-modal-review-loading').hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
// console.log('pass');
|
||||
// $('.leo-modal-review-bt').remove();
|
||||
// console.log($( ".new_review_form_content input, .new_review_form_content textarea" ).serialize());
|
||||
$('.leo-fake-button').addClass('validate-ok');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
url: prestashop.urls.base_url + 'modules/leofeature/psajax_review.php?action=add-new-review&token='+leo_token+'&rand=' + new Date().getTime(),
|
||||
async: true,
|
||||
cache: false,
|
||||
data: $( ".new_review_form_content input, .new_review_form_content textarea" ).serialize(),
|
||||
success: function (result)
|
||||
{
|
||||
if (result != '')
|
||||
{
|
||||
var object_result = $.parseJSON(result);
|
||||
// console.log(object_result);
|
||||
$('.leo-modal-review-bt').fadeOut('slow', function(){
|
||||
$(this).remove();
|
||||
|
||||
});
|
||||
|
||||
$('.leo-modal-review .modal-body>.row').fadeOut('slow', function(){
|
||||
$(this).remove();
|
||||
if (object_result.result)
|
||||
{
|
||||
$('.leo-modal-review .modal-body').append('<div class="form-group has-success"><label class="form-control-label">'+object_result.sucess_mess+'</label></div>');
|
||||
}
|
||||
else
|
||||
{
|
||||
// $('.leo-modal-review .modal-body').append('<div class="form-group has-danger text-center"></div>');
|
||||
$.each(object_result.errors, function(key, val){
|
||||
$('.leo-modal-review .modal-body').append('<div class="form-group has-danger text-center"><label class="form-control-label">'+val+'</label></div>');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(review_error);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
window.location.replace($('.open-review-form').data('product-link'));
|
||||
}
|
||||
});
|
||||
}
|
||||
$('.leo-fake-button').trigger('click');
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
$('.leo-modal-review').on('hide.bs.modal', function (e) {
|
||||
// console.log($('.leo-modal-review-bt').length);
|
||||
if (!$('.leo-modal-review-bt').length && !$('.leo-modal-review .modal-body .disable-form-review').length)
|
||||
{
|
||||
// console.log('aaa');
|
||||
// window.location.replace($('.open-review-form').data('product-link'));
|
||||
location.reload();
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
1206
modules/leofeature/views/js/leofeature_wishlist.js
Normal file
1206
modules/leofeature/views/js/leofeature_wishlist.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user