Skip to content

Commit 88a8726

Browse files
authored
Merge pull request #695 from tblivet/feat/improvements-part-6
[IMPROVEMENTS - PART 6] Global quality improvement
2 parents df8dd3b + 602c1cb commit 88a8726

File tree

73 files changed

+1997
-1489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1997
-1489
lines changed

config/theme.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ assets:
5151
global_settings:
5252
configuration:
5353
PS_IMAGE_QUALITY: png
54+
HOME_FEATURED_NBR: 4
55+
NEW_PRODUCTS_NBR: 4
56+
BLOCKSPECIALS_SPECIALS_NBR: 4
57+
PS_BLOCK_BESTSELLERS_TO_DISPLAY: 4
58+
PSR_ICON_COLOR: "#0d6efd"
59+
PSR_TEXT_COLOR: "#212529"
5460
modules:
5561
to_enable:
5662
- ps_linklist
@@ -143,8 +149,8 @@ global_settings:
143149
height: 115
144150
scope: [stores]
145151
default_xs:
146-
width: 120
147-
height: 120
152+
width: 160
153+
height: 160
148154
scope: [products, manufacturers, suppliers, categories]
149155
default_sm:
150156
width: 216
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Empty blockreassurance */
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{**
2+
* For the full copyright and license information, please view the LICENSE
3+
* file that was distributed with this source code.
4+
*}
5+
{if isset($blocks) && !empty($blocks)}
6+
<div class="blockreassurance blockreassurance--{$page.page_name}">
7+
{foreach from=$blocks item=$block key=$key}
8+
{if $block['type_link'] !== $LINK_TYPE_NONE && !empty($block['link'])}
9+
<a class="reassurance reassurance--link" href="{$block['link']|escape:'htmlall':'UTF-8'}">
10+
{else}
11+
<div class="reassurance">
12+
{/if}
13+
14+
<span class="reassurance__image">
15+
{if $block['custom_icon']}
16+
<img {if $block['is_svg']}class="svg img-fluid invisible" {/if}src="{$block['custom_icon']}">
17+
{elseif $block['icon']}
18+
<img class="svg img-fluid invisible" src="{$block['icon']}">
19+
{/if}
20+
</span>
21+
22+
<span class="reassurance__content">
23+
<span class="reassurance__title">{$block['title']|escape:'htmlall':'UTF-8'}</span>
24+
{if !empty($block['description'])}
25+
<br/>
26+
<small class="reassurance__desc">{$block['description'] nofilter}</small>
27+
{/if}
28+
</span>
29+
30+
{if !empty($block['link']) && $block['type_link'] !== $LINK_TYPE_NONE}
31+
</a>
32+
{else}
33+
</div>
34+
{/if}
35+
{/foreach}
36+
</div>
37+
{/if}

modules/blockwishlist/views/templates/components/modals/add-to-wishlist.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
role="dialog"
1515
aria-modal="true"
1616
>
17-
<div class="modal-dialog modal-dialog-centered" role="document">
17+
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable" role="document">
1818
<div class="modal-content">
19-
<div class="modal-header px-3">
20-
<p class="h5 modal-title">{l s='Add to wishlist' d='Modules.Blockwishlist.Shop'}</p>
19+
<div class="modal-header">
20+
<p class="h2 modal-title">{l s='Add to wishlist' d='Modules.Blockwishlist.Shop'}</p>
2121
<button
2222
type="button"
2323
class="btn-close"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Empty productcomments */
813 Bytes
Loading
865 Bytes
Loading
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/* PrestaShop license placeholder */
2+
$(document).ready(function() {
3+
productListingComments.init();
4+
productListingComments.load();
5+
});
6+
7+
var productListingComments = (function () {
8+
9+
var data = {
10+
productIDs: [],
11+
commentsLoadingInProgress: false,
12+
ajaxIDsLimit: 50,
13+
ajaxUrl: ''
14+
}
15+
16+
var DOMStrings = {
17+
productListReviewsContainer: '.product-list-reviews',
18+
productListReviewsNumberOfComments: '.comments-nb',
19+
productListReviewsStarsContainer: '.grade-stars',
20+
productContainer: '.js-product-miniature'
21+
};
22+
23+
var DOMClasses = {
24+
inProgress: 'reviews-loading',
25+
reviewsLoaded: 'reviews-loaded',
26+
hasReviews: 'has-reviews',
27+
productListReviewShow: 'product-list-reviews--show',
28+
};
29+
30+
function setEvents() {
31+
prestashop.on('updateProductList', function() {
32+
addProductsIDs();
33+
});
34+
}
35+
36+
37+
function setAjaxUrl() {
38+
if (data.ajaxUrl !== '')
39+
return;
40+
41+
var url = $(DOMStrings.productListReviewsContainer).first().data('url');
42+
data.ajaxUrl = url;
43+
}
44+
45+
function getNewProductsReviewsElements() {
46+
var $productListReviews = $(DOMStrings.productContainer)
47+
.not('.' + DOMClasses.reviewsLoaded + ', .' + DOMClasses.inProgress)
48+
.addClass(DOMClasses.inProgress)
49+
.find(DOMStrings.productListReviewsContainer);
50+
51+
return $productListReviews;
52+
}
53+
54+
function addProductsIDs() {
55+
56+
var $productsList = getNewProductsReviewsElements(),
57+
seenIds = {};
58+
59+
$productsList.each(function () {
60+
var id = $(this).data('id');
61+
seenIds[id] = true;
62+
});
63+
64+
65+
var IDsArray = Object.keys(seenIds).filter(e => e !== 'undefined');
66+
var prevDataIDs = data.productIDs.splice(0);
67+
data.productIDs = prevDataIDs.concat(IDsArray);
68+
69+
if (!data.commentsLoadingInProgress) {
70+
loadProductsData();
71+
}
72+
}
73+
74+
function loadProductsData() {
75+
if (data.productIDs.length === 0)
76+
return;
77+
78+
data.commentsLoadingInProgress = true;
79+
80+
var dataIDsCopy = data.productIDs.slice(0);
81+
selectedProductIDs = dataIDsCopy.splice(0, data.ajaxIDsLimit);
82+
83+
84+
$.get(data.ajaxUrl, { id_products: selectedProductIDs }, function (jsonData) {
85+
if (jsonData) {
86+
$.each(jsonData.products, function(i, elem) {
87+
var productData = elem;
88+
var $productsReviewsContainer = $('.product-list-reviews[data-id="' + productData.id_product + '"]');
89+
90+
$productsReviewsContainer.each(function () {
91+
var $self = $(this);
92+
93+
if (productData.comments_nb > 0) {
94+
$self.find(DOMStrings.productListReviewsStarsContainer).rating({ grade: productData.average_grade, starWidth: 16 });
95+
$self.find(DOMStrings.productListReviewsNumberOfComments).text('(' + productData.comments_nb + ')');
96+
$self.closest(DOMStrings.productContainer).addClass(DOMClasses.hasReviews);
97+
$self.addClass(DOMClasses.productListReviewShow);
98+
} else if (productData.comments_nb == 0) {
99+
$self.hide();
100+
}
101+
102+
$self.closest(DOMStrings.productContainer).addClass(DOMClasses.reviewsLoaded);
103+
$self.closest(DOMStrings.productContainer).removeClass(DOMClasses.inProgress);
104+
105+
});
106+
data.productIDs.shift();
107+
});
108+
109+
data.commentsLoadingInProgress = false;
110+
if (data.productIDs.length > 0) {
111+
loadProductsData();
112+
}
113+
114+
}
115+
});
116+
}
117+
118+
119+
return {
120+
load: function () {
121+
addProductsIDs();
122+
},
123+
init: function () {
124+
setAjaxUrl();
125+
setEvents();
126+
}
127+
}
128+
})();

modules/productcomments/views/templates/hook/alert-modal.tpl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@
99
<script type="text/javascript">
1010
document.addEventListener("DOMContentLoaded", function() {
1111
const alertModal = $('#{$modal_id}');
12-
alertModal.on('hidden.bs.modal', function () {
12+
alertModal.on('hidden.bs.modal', function() {
1313
alertModal.modal('hide');
1414
});
1515
});
1616
</script>
1717

1818
<div id="{$modal_id}" class="modal fade product-comment-modal" role="dialog" aria-hidden="true">
19-
<div class="modal-dialog" role="document">
19+
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable" role="document">
2020
<div class="modal-content">
2121
<div class="modal-header">
22-
<p class="h2 mb-0">
23-
<i class="material-icons {$icon}" data-icon="{$icon}"></i>
22+
<p class="h2 modal-title">
2423
{$modal_title}
2524
</p>
2625
</div>
27-
26+
2827
<div class="modal-body">
2928
<div class="row">
3029
<div class="col-md-12 col-sm-12" id="{$modal_id}-message">
@@ -33,8 +32,9 @@
3332
</div>
3433
</div>
3534

36-
<div class="modal-footer">
37-
<button type="button" class="btn btn-primary" data-bs-dismiss="modal" aria-label="{l s='OK' d='Modules.Productcomments.Shop'}">
35+
<div class="modal-footer post-comment-buttons">
36+
<button type="button" class="btn btn-primary" data-bs-dismiss="modal"
37+
aria-label="{l s='OK' d='Modules.Productcomments.Shop'}">
3838
{l s='OK' d='Modules.Productcomments.Shop'}
3939
</button>
4040
</div>

modules/productcomments/views/templates/hook/confirm-modal.tpl

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<script type="text/javascript">
1010
document.addEventListener("DOMContentLoaded", function() {
1111
const confirmModal = $('#{$modal_id}');
12-
confirmModal.on('hidden.bs.modal', function () {
12+
confirmModal.on('hidden.bs.modal', function() {
1313
confirmModal.modal('hide');
1414
confirmModal.trigger('modal:confirm', false);
1515
});
@@ -23,12 +23,12 @@
2323
});
2424
</script>
2525

26-
<div id="{$modal_id}" class="modal fade product-comment-modal" role="dialog" aria-hidden="true">
27-
<div class="modal-dialog" role="document">
26+
<div id="{$modal_id}" class="modal fade product-comment-modal" role="dialog"
27+
aria-hidden="true">
28+
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable" role="document">
2829
<div class="modal-content">
2930
<div class="modal-header">
30-
<p class="h2">
31-
<i class="material-icons {$icon}" data-icon="{$icon}"></i>
31+
<p class="h2 modal-title">
3232
{$modal_title}
3333
</p>
3434
</div>
@@ -40,12 +40,16 @@
4040
</div>
4141

4242
<div class="modal-footer">
43-
<button type="button" class="btn btn-outline-primary me-2 refuse-button" data-bs-dismiss="modal" aria-label="{l s='No' d='Modules.Productcomments.Shop'}">
44-
{l s='No' d='Modules.Productcomments.Shop'}
45-
</button>
46-
<button type="button" class="btn btn-primary confirm-button" data-bs-dismiss="modal" aria-label="{l s='Yes' d='Modules.Productcomments.Shop'}">
47-
{l s='Yes' d='Modules.Productcomments.Shop'}
48-
</button>
43+
<div class="post-comment-buttons">
44+
<button type="button" class="btn btn-outline-primary me-2 refuse-button" data-bs-dismiss="modal"
45+
aria-label="{l s='No' d='Modules.Productcomments.Shop'}">
46+
{l s='No' d='Modules.Productcomments.Shop'}
47+
</button>
48+
<button type="button" class="btn btn-primary confirm-button" data-bs-dismiss="modal"
49+
aria-label="{l s='Yes' d='Modules.Productcomments.Shop'}">
50+
{l s='Yes' d='Modules.Productcomments.Shop'}
51+
</button>
52+
</div>
4953
</div>
5054
</div>
5155
</div>

0 commit comments

Comments
 (0)