@riosst100/pwa-marketplace 2.3.7 → 2.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySea
|
|
|
14
14
|
import { useCustomSort } from '@riosst100/pwa-marketplace/src/hooks/useCustomSort';
|
|
15
15
|
import Breadcrumbs from '@magento/venia-ui/lib/components/Breadcrumbs';
|
|
16
16
|
import { useLocation } from 'react-router-dom';
|
|
17
|
+
import { getFiltersFromSearch } from '@magento/peregrine/lib/talons/FilterModal/helpers';
|
|
17
18
|
|
|
18
19
|
const SetsData = props => {
|
|
19
20
|
const { categoryId } = props
|
|
@@ -232,10 +233,37 @@ const SetsData = props => {
|
|
|
232
233
|
setSearchQuery('')
|
|
233
234
|
}
|
|
234
235
|
|
|
236
|
+
const activeFilters = [];
|
|
237
|
+
|
|
238
|
+
const allActiveFilters = getFiltersFromSearch(search);
|
|
239
|
+
|
|
240
|
+
if (allActiveFilters && allActiveFilters.size > 0) {
|
|
241
|
+
allActiveFilters.forEach((value, key) => {
|
|
242
|
+
value.forEach((value) => {
|
|
243
|
+
const filterArr = value.split(',');
|
|
244
|
+
|
|
245
|
+
const label = filterArr[0];
|
|
246
|
+
const optionId = filterArr[1];
|
|
247
|
+
if (label == "Singles") {
|
|
248
|
+
isSingles = true;
|
|
249
|
+
}
|
|
250
|
+
if (key == "card_game" || key == "product_line" && urlKey == "brands" || key == "product_line" && urlKey == "franchise" || key == "franchise" && urlKey == "brands" || key == "franchise" && urlKey == "franchise" || key == "brands" && urlKey == "franchise" || key == "brands" && urlKey == "brands" || virtualCategoryFilters && virtualCategoryFilters.includes(key)) {
|
|
251
|
+
activeFilters.push(
|
|
252
|
+
{
|
|
253
|
+
'label': label,
|
|
254
|
+
'code': key,
|
|
255
|
+
'option_id': optionId
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
})
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
235
263
|
return (
|
|
236
264
|
<Fragment>
|
|
237
265
|
<StoreTitle>{title}</StoreTitle>
|
|
238
|
-
<Breadcrumbs categoryId={categoryId} customPage={shopby == "singles" ? "Mini-Figures" : title} />
|
|
266
|
+
<Breadcrumbs categoryId={categoryId} currentFilter={activeFilters} customPage={shopby == "singles" ? "Mini-Figures" : title} />
|
|
239
267
|
{/* <ul className={classes.nav}>
|
|
240
268
|
<li className={classes.nav_item}>
|
|
241
269
|
<button
|
|
@@ -199,14 +199,19 @@ const CategoryContent = props => {
|
|
|
199
199
|
<ProductListTabShimmer />
|
|
200
200
|
) : null;
|
|
201
201
|
|
|
202
|
+
const formatNumber = (num) => {
|
|
203
|
+
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
204
|
+
}
|
|
205
|
+
|
|
202
206
|
const categoryResultsHeading =
|
|
203
207
|
galleryItems.length > 0 ? (
|
|
204
208
|
<FormattedMessage
|
|
205
|
-
id={'categoryContent.
|
|
209
|
+
id={'categoryContent.resultAndTotalCount'}
|
|
206
210
|
values={{
|
|
207
|
-
count: galleryItems.length
|
|
211
|
+
count: galleryItems.length,
|
|
212
|
+
total_count: formatNumber(totalCount)
|
|
208
213
|
}}
|
|
209
|
-
defaultMessage={
|
|
214
|
+
defaultMessage={"Showing {count} of {total_count} products"}
|
|
210
215
|
/>
|
|
211
216
|
) : isLoading ? (
|
|
212
217
|
<Shimmer width={5} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment, useMemo } from 'react';
|
|
1
|
+
import React, { Fragment, useMemo, useRef } from 'react';
|
|
2
2
|
import { FormattedMessage } from 'react-intl';
|
|
3
3
|
import { string } from 'prop-types';
|
|
4
4
|
import { Link } from 'react-router-dom';
|
|
@@ -78,6 +78,35 @@ const Breadcrumbs = props => {
|
|
|
78
78
|
|
|
79
79
|
const lastIndex = currentFilter ? currentFilter.length - 1 : 0;
|
|
80
80
|
// const filterpath = ;
|
|
81
|
+
|
|
82
|
+
const { search } = useLocation();
|
|
83
|
+
|
|
84
|
+
// const previousSearch = useRef(search);
|
|
85
|
+
|
|
86
|
+
console.log('search')
|
|
87
|
+
console.log(search)
|
|
88
|
+
|
|
89
|
+
const removeShopbyParam = (url) => {
|
|
90
|
+
const urlParts = url.split("?"); // Pisahkan URL sebelum dan sesudah tanda tanya
|
|
91
|
+
if (urlParts.length < 2) return url; // Jika tidak ada query string, kembalikan URL asli
|
|
92
|
+
|
|
93
|
+
const baseUrl = urlParts[0]; // Bagian URL sebelum query string
|
|
94
|
+
const queryString = urlParts[1]; // Bagian query string
|
|
95
|
+
|
|
96
|
+
// Pisahkan parameter menjadi array
|
|
97
|
+
const params = queryString.split("&").filter(param => !param.startsWith("shopby="));
|
|
98
|
+
|
|
99
|
+
// Gabungkan kembali parameter tanpa "shopby"
|
|
100
|
+
const newQueryString = params.join("&");
|
|
101
|
+
|
|
102
|
+
// Gabungkan URL dasar dengan query string yang telah dimodifikasi
|
|
103
|
+
return newQueryString ? `${baseUrl}?${newQueryString}` : baseUrl;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const params = removeShopbyParam(search);
|
|
107
|
+
|
|
108
|
+
console.log("paramsparamsparams")
|
|
109
|
+
console.log(params)
|
|
81
110
|
|
|
82
111
|
currentFilter && currentFilter.length && currentFilter.map((filter, index) => {
|
|
83
112
|
currentProduct ? (
|
|
@@ -102,7 +131,7 @@ const Breadcrumbs = props => {
|
|
|
102
131
|
<Link
|
|
103
132
|
key={index}
|
|
104
133
|
className={classes.link}
|
|
105
|
-
to={resourceUrl('/'+currentCategoryPath)}
|
|
134
|
+
to={resourceUrl('/'+currentCategoryPath+params)}
|
|
106
135
|
onClick={handleClick}
|
|
107
136
|
>
|
|
108
137
|
{filter.label}
|
|
@@ -119,7 +148,7 @@ const Breadcrumbs = props => {
|
|
|
119
148
|
<Link
|
|
120
149
|
key={index}
|
|
121
150
|
className={classes.link}
|
|
122
|
-
to={resourceUrl('/'+currentCategoryPath+
|
|
151
|
+
to={resourceUrl('/'+currentCategoryPath+params)}
|
|
123
152
|
onClick={handleClick}
|
|
124
153
|
>
|
|
125
154
|
{filter.label}
|