Skip to content

Commit

Permalink
Merge pull request #1313 from macmastermike/fix_frontend_view_dropdowns
Browse files Browse the repository at this point in the history
Fixes the category items-per-page dropdown in the frontend (didn't wo…
  • Loading branch information
dpfaffenbauer authored Mar 5, 2020
2 parents e02653d + fa67577 commit dfa48b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $(document).ready(function () {
shop.initChangeAddress();
shop.initCartShipmentCalculator();
shop.initQuantityValidator();
shop.initCategorySelect();

$('#paymentProvider').handlePrototypes({
'prototypePrefix': 'paymentProvider',
Expand All @@ -16,6 +17,22 @@ $(document).ready(function () {
});
};

shop.initCategorySelect = function () {
function updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, '$1' + key + "=" + value + '$2');
}
else {
return uri + separator + key + "=" + value;
}
}
$(".site-reload").change(function() {
location.href= updateQueryStringParameter( window.location.href, this.name, this.value );
});
};

shop.initQuantityValidator = function () {
$.coreshopQuantitySelector({
buttondown_class: 'btn btn-secondary',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
</div>
<div class="col-md-2 text-right">
<select class="form-control site-reload" name="perPage">
{% for perPage in perPageAllowed %}
<option value="{{ perPage }}" {% if perPage == perPage %} selected="selected" {% endif %}>{{ perPage }}</option>
{% for perPageList in perPageAllowed %}
<option value="{{ perPageList }}" {% if perPageList == perPage %} selected="selected" {% endif %}>{{ perPageList }}</option>
{% endfor %}
</select>
</div>
Expand Down

0 comments on commit dfa48b8

Please sign in to comment.