max price issue in category

This commit is contained in:
rahulshukla-home 2020-04-28 14:40:08 +05:30
parent 837c5d44fa
commit abac3a297f
2 changed files with 9 additions and 3 deletions

View File

@ -6,11 +6,14 @@
<?php
$filterAttributes = [];
$maxPrice = 0;
if (isset($category)) {
$products = $productRepository->getAll($category->id);
$filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
$maxPrice = core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category));
}
if (! count($filterAttributes) > 0) {
@ -161,7 +164,7 @@
props: ['index', 'attribute', 'appliedFilterValues'],
data: function() {
let maxPrice = '{{ core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category)) }}';
let maxPrice = @json($maxPrice);
maxPrice = maxPrice ? ((parseInt(maxPrice) !== 0 || maxPrice) ? parseInt(maxPrice) : 500) : 500;

View File

@ -4,12 +4,15 @@
<?php
$filterAttributes = [];
$maxPrice = 0;
if (isset($category)) {
$products = $productRepository->getAll($category->id);
$filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
}
$maxPrice = core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category));
}
if (! count($filterAttributes) > 0) {
$filterAttributes = $attributeRepository->getFilterAttributes();
@ -181,7 +184,7 @@
],
data: function() {
let maxPrice = '{{ core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category)) }}';
let maxPrice = @json($maxPrice);
maxPrice = maxPrice ? ((parseInt(maxPrice) !== 0 || maxPrice) ? parseInt(maxPrice) : 500) : 500;