summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-11-12 12:13:25 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-11-12 12:13:25 +0700
commit9cbbe5e12f97af023e2f53e4add4c5e5fd9b4667 (patch)
tree51c0f584865a5d24f1e2e244568fd076bde46e76
parent6b4c47641315d0b7de5ca2c3d029c69068f7cac8 (diff)
<Miqddad> fix merchant temp
-rw-r--r--src/pages/google_merchant/products/index.js33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/pages/google_merchant/products/index.js b/src/pages/google_merchant/products/index.js
index d3cdc514..b6c7bfef 100644
--- a/src/pages/google_merchant/products/index.js
+++ b/src/pages/google_merchant/products/index.js
@@ -1,31 +1,32 @@
-import productSearchApi from '@/lib/product/api/productSearchApi'
-import variantSearchApi from '@/lib/product/api/variantSearchApi'
-import _ from 'lodash-contrib'
+import productSearchApi from '@/lib/product/api/productSearchApi';
+import variantSearchApi from '@/lib/product/api/variantSearchApi';
+import _ from 'lodash-contrib';
-const limit = 5000
+const limit = 5000;
export async function getServerSideProps() {
const queries = {
limit: 1,
priceFrom: 1,
- fq: 'image_s:["" TO *]'
- }
- const products = await variantSearchApi({ query: _.toQuery(queries) })
- const { numFound } = products.response
- const pageTotal = Math.ceil(numFound / limit)
+ fq: 'image_s:["" TO *] AND publish_b:true',
+ };
+ const products = await variantSearchApi({ query: _.toQuery(queries) });
+ const { numFound } = products.response;
+ const pageTotal = Math.ceil(numFound / limit);
- return { props: { pageTotal, numFound } }
+ return { props: { pageTotal, numFound } };
}
export default function GoogleMerchantPage({ pageTotal, numFound }) {
- const numberArray = Array.from({ length: pageTotal }, (_, index) => index)
+ const numberArray = Array.from({ length: pageTotal }, (_, index) => index);
return (
<div className='grid grid-cols-1 gap-y-3 p-4'>
<h1 className='text-h-lg font-semibold mb-3'>Google Merchant:</h1>
{numberArray.map((number) => {
- const currentPage = number + 1
- const remainingProducts = numFound - limit * number
- const productCount = currentPage == pageTotal ? remainingProducts : limit
+ const currentPage = number + 1;
+ const remainingProducts = numFound - limit * number;
+ const productCount =
+ currentPage == pageTotal ? remainingProducts : limit;
return (
<a
key={number}
@@ -36,8 +37,8 @@ export default function GoogleMerchantPage({ pageTotal, numFound }) {
>
Page {currentPage} - ({productCount}) Products
</a>
- )
+ );
})}
</div>
- )
+ );
}