@riosst100/pwa-marketplace 2.3.6 → 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/i18n/id_ID.json +510 -508
- package/package.json +1 -1
- package/src/components/SetsData/setsData.js +44 -6
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +8 -3
- package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +32 -3
- package/src/talons/SetsData/setsData.gql.js +1 -0
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
|
|
@@ -127,17 +128,27 @@ const SetsData = props => {
|
|
|
127
128
|
|
|
128
129
|
if (sets.length) {
|
|
129
130
|
sets.map((set, index) => {
|
|
130
|
-
const { set_name, option_id, release_year } = set;
|
|
131
|
+
const { products_count, set_name, option_id, release_year } = set;
|
|
132
|
+
|
|
133
|
+
console.log(products_count)
|
|
131
134
|
|
|
132
135
|
const categoryUrl = resourceUrl(
|
|
133
136
|
`/${category?.url_path}${categoryUrlSuffix || ''}${filterSearch || ''}&${attributeCode}[filter]=${set_name},${option_id}`
|
|
134
137
|
);
|
|
135
138
|
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
{
|
|
139
|
-
|
|
139
|
+
if (parseInt(products_count) > 0) {
|
|
140
|
+
setsResult.push(<li className='list-none'>
|
|
141
|
+
<Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-0">
|
|
142
|
+
{set_name} <span className='text-[12px]'>({products_count})</span>
|
|
143
|
+
</Link>
|
|
144
|
+
</li>)
|
|
145
|
+
} else {
|
|
146
|
+
setsResult.push(<li className='list-none'>
|
|
147
|
+
<span className="text-[#8f8f8f] w-full block text-[14px] py-[2px] px-0">
|
|
148
|
+
{set_name} <span className='text-[12px]'>({products_count})</span>
|
|
149
|
+
</span>
|
|
140
150
|
</li>)
|
|
151
|
+
}
|
|
141
152
|
})
|
|
142
153
|
}
|
|
143
154
|
|
|
@@ -222,10 +233,37 @@ const SetsData = props => {
|
|
|
222
233
|
setSearchQuery('')
|
|
223
234
|
}
|
|
224
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
|
+
|
|
225
263
|
return (
|
|
226
264
|
<Fragment>
|
|
227
265
|
<StoreTitle>{title}</StoreTitle>
|
|
228
|
-
<Breadcrumbs categoryId={categoryId} customPage={shopby == "singles" ? "Mini-Figures" : title} />
|
|
266
|
+
<Breadcrumbs categoryId={categoryId} currentFilter={activeFilters} customPage={shopby == "singles" ? "Mini-Figures" : title} />
|
|
229
267
|
{/* <ul className={classes.nav}>
|
|
230
268
|
<li className={classes.nav_item}>
|
|
231
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}
|