summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-11-18 11:31:39 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-11-18 11:31:39 +0700
commit9d99b291bb347f045b03b2de6ee51a8fbc248721 (patch)
tree0f6941ba3a5b68bc9ad93d3850e54dd88b017897 /src
parent0f7ce7842c70bc1fee1ae6f3cff0ccf7be8eaa6f (diff)
parentbde516b6b39cccfe8ac3248cd7f85592e6298d7a (diff)
Merge branch 'new-release' into CR/website-improvement
Diffstat (limited to 'src')
-rw-r--r--src/core/components/elements/Footer/BasicFooter.jsx2
-rw-r--r--src/core/components/elements/Footer/SimpleFooter.jsx2
-rw-r--r--src/lib/checkout/components/Checkout.jsx16
-rw-r--r--src/lib/flashSale/components/FlashSale.jsx2
-rw-r--r--src/lib/flashSale/components/FlashSaleNonDisplay.jsx2
-rw-r--r--src/pages/_document.jsx13
-rw-r--r--src/pages/api/shop/search.js31
7 files changed, 53 insertions, 15 deletions
diff --git a/src/core/components/elements/Footer/BasicFooter.jsx b/src/core/components/elements/Footer/BasicFooter.jsx
index 4688b15b..05dc4d8c 100644
--- a/src/core/components/elements/Footer/BasicFooter.jsx
+++ b/src/core/components/elements/Footer/BasicFooter.jsx
@@ -264,7 +264,7 @@ const InformationCenter = () => (
<li className='text-gray_r-12/80 flex items-center'>
<PhoneArrowUpRightIcon className='w-[18px] mr-2' />
<a href='tel:02129338828' target='_blank' rel='noreferrer'>
- (021) 2933-8828
+ (021) 29338828
</a>
</li>
<li className='text-gray_r-12/80 flex items-center'>
diff --git a/src/core/components/elements/Footer/SimpleFooter.jsx b/src/core/components/elements/Footer/SimpleFooter.jsx
index 371b1652..1f5e13e7 100644
--- a/src/core/components/elements/Footer/SimpleFooter.jsx
+++ b/src/core/components/elements/Footer/SimpleFooter.jsx
@@ -13,7 +13,7 @@ const SimpleFooter = () => (
<ul className='flex flex-col gap-y-2'>
<li className='text-gray_r-12/80 flex items-center'>
<PhoneArrowUpRightIcon className='w-[18px] mr-2' />
- <a href='tel:02129338828'>(021) 2933-8828 / 29</a>
+ <a href='tel:02129338828'>(021) 29338828</a>
</li>
<li className='text-gray_r-12/80 flex items-center'>
<EnvelopeIcon className='w-[18px] mr-2' />
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index afbf1e6c..6fb5cdb4 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -37,6 +37,18 @@ const SELF_PICKUP_ID = 32;
const { checkoutApi } = require('../api/checkoutApi');
const { getProductsCheckout } = require('../api/checkoutApi');
+function convertToInternational(number) {
+ if (typeof number !== 'string') {
+ throw new Error("Input harus berupa string");
+ }
+
+ if (number.startsWith('08')) {
+ return '+62' + number.slice(2);
+ }
+
+ return number;
+}
+
const Checkout = () => {
const router = useRouter();
const query = router.query.source ?? null;
@@ -491,9 +503,11 @@ const Checkout = () => {
gtag('set', 'user_data', {
email: auth.email,
- phone_number: auth.mobile ?? auth.phone,
+ phone_number: convertToInternational(auth.mobile) ?? convertToInternational(auth.phone),
});
+ gtag('config', 'AW-954540379', { ' allow_enhanced_conversions':true } ) ;
+
for (const product of products) deleteItemCart({ productId: product.id });
if (grandTotal > 0) {
const payment = await axios.post(
diff --git a/src/lib/flashSale/components/FlashSale.jsx b/src/lib/flashSale/components/FlashSale.jsx
index 89c46de4..8be1d7a6 100644
--- a/src/lib/flashSale/components/FlashSale.jsx
+++ b/src/lib/flashSale/components/FlashSale.jsx
@@ -69,7 +69,7 @@ const FlashSaleProduct = ({ flashSaleId }) => {
useEffect(() => {
const loadProducts = async () => {
const dataProducts = await productSearchApi({
- query: `fq=flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=500&orderBy=flashsale-price-asc`,
+ query: `fq=flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=500&orderBy=flashsale-price-asc&source=similar`,
operation: 'AND',
});
setProducts(dataProducts.response);
diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
index c91de2be..4b420fac 100644
--- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
+++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx
@@ -56,7 +56,7 @@ const FlashSaleProduct = ({ flashSaleId }) => {
useEffect(() => {
const loadProducts = async () => {
const dataProducts = await productSearchApi({
- query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=25&orderBy=flashsale-discount-desc`,
+ query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=25&orderBy=flashsale-discount-desc&source=similar`,
operation: 'AND',
});
setProducts(dataProducts.response);
diff --git a/src/pages/_document.jsx b/src/pages/_document.jsx
index 6af6294f..4b67c3f9 100644
--- a/src/pages/_document.jsx
+++ b/src/pages/_document.jsx
@@ -115,6 +115,19 @@ export default function MyDocument() {
}}
/>
+ <Script
+ async
+ id='gtag-config'
+ strategy='afterInteractive'
+ dangerouslySetInnerHTML={{
+ __html: `
+ gtag('config', 'AW-954540379/fCU8CI3Y8OoZENvClMcD', {
+ 'phone_conversion_number': '(021) 29338828'
+ });
+ `,
+ }}
+ />
+
{/* <Script
id='tawk-script-tag'
strategy='afterInteractive'
diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js
index 1f0ff504..65927bbc 100644
--- a/src/pages/api/shop/search.js
+++ b/src/pages/api/shop/search.js
@@ -19,6 +19,10 @@ export default async function handler(req, res) {
source = '',
} = req.query;
+
+
+ console.log('fq new', fq);
+
let { stock = '' } = req.query;
let paramOrderBy = '';
@@ -73,8 +77,9 @@ export default async function handler(req, res) {
const formattedQuery = `(${newQ
.split(' ')
- .map((term) => `${term}*`)
+ .map((term) => (term.length < 2 ? term : `${term}*`)) // Tambahkan '*' hanya jika panjang kata >= 2
.join(' ')})`;
+
const mm =
checkQ.length > 2
? checkQ.length > 5
@@ -88,12 +93,24 @@ export default async function handler(req, res) {
'price_tier1_v2_f:[1 TO *]',
];
- if (fq && source != 'similar') {
+
+ if (fq && source != 'similar' && typeof fq != 'string') {
// filterQueries.push(fq);
fq.push(...filterQueries);
}
const fq_ = filterQueries.join(' AND ');
+ let keywords = newQ;
+ if (source === 'similar' || checkQ.length < 3) {
+ if (checkQ.length < 2 || checkQ[1].length < 2) {
+ keywords = newQ ;
+ } else {
+ keywords = newQ + '*';
+ }
+ } else {
+ keywords = formattedQuery;
+ }
+
let offset = (page - 1) * limit;
let parameter = [
'facet.field=manufacture_name_s',
@@ -102,13 +119,7 @@ export default async function handler(req, res) {
'indent=true',
`facet.query=${escapeSolrQuery(q)}`,
`q.op=OR`,
- `q=${
- source == 'similar' || checkQ.length < 3
- ? checkQ.length < 2
- ? newQ
- : newQ + '*'
- : formattedQuery
- }`,
+ `q=${keywords}`,
`defType=edismax`,
'qf=name_s description_clean_t category_name manufacture_name_s variants_code_t variants_name_t category_id_ids default_code_s manufacture_id_i category_id_i ',
`start=${parseInt(offset)}`,
@@ -153,7 +164,7 @@ export default async function handler(req, res) {
if (stock) parameter.push(`fq=stock_total_f:{1 TO *}`);
// Single fq in url params
- // if (typeof fq === 'string') parameter.push(`fq=${encodeURIComponent(fq)}`);
+ if (typeof fq === 'string') parameter.push(`fq=${encodeURIComponent(fq)}`);
// Multi fq in url params
if (Array.isArray(fq))
parameter = parameter.concat(