From ab808d522809b00c99b7f6f3816ad6fd15d4dff4 Mon Sep 17 00:00:00 2001 From: Jun Barroga Date: Thu, 22 Feb 2024 13:14:39 +0800 Subject: [PATCH 1/2] Vendor Search --- functions.php | 34 ++++++++++++++++++++++++++++++ more-vendors.php | 1 + search_product_action.php | 5 +++++ shop-list-left-sidebar.php | 42 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 more-vendors.php diff --git a/functions.php b/functions.php index 28a9656..c752408 100644 --- a/functions.php +++ b/functions.php @@ -136,7 +136,41 @@ function searchProducts($query) $query = 'asus'; $result = searchProducts($query); +function searchVendor($query) +{ + $query = str_replace(" ", "+", $query); + $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$query"; + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt_array($curl, array( + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => '', + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 0, + CURLOPT_FOLLOWLOCATION => true, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'GET', + CURLOPT_HTTPHEADER => array( + 'X-Api-Key: {{apiKey}}' + ), + )); + $response = curl_exec($curl); + curl_close($curl); + $data = json_decode($response, true); + // Check if there are no results + if (empty($data['results'])) { + // $data['message'] = 'No products available for the given query.'; + $data['results'] = []; + } + + return json_encode($data); +} + + +// Example usage: +$query = 'asus'; +$result = searchProducts($query); // function searchProducts($query) // { diff --git a/more-vendors.php b/more-vendors.php new file mode 100644 index 0000000..49933b3 --- /dev/null +++ b/more-vendors.php @@ -0,0 +1 @@ +This is more vendors page \ No newline at end of file diff --git a/search_product_action.php b/search_product_action.php index a6b0ba8..bc5c0a1 100644 --- a/search_product_action.php +++ b/search_product_action.php @@ -16,10 +16,15 @@ $result = searchProducts( $category); } else { $result = searchProducts($_GET["searchText"]); + $result2 = searchVendor($_GET["searchText"]); } $array = json_decode($result,true); + $array2 = json_decode($result2,true); + $_SESSION["productSearchResult"] = $array; + $_SESSION["vendorSearchResult"] = $array2; + header("location: shop-list-left-sidebar.php"); diff --git a/shop-list-left-sidebar.php b/shop-list-left-sidebar.php index a5b085f..b0efec5 100644 --- a/shop-list-left-sidebar.php +++ b/shop-list-left-sidebar.php @@ -9,6 +9,10 @@ if ($_SESSION["userId"] <> "") { $_SESSION["isLoggedIn"] = false; } $productSearchResult = $_SESSION["productSearchResult"]; +$vendorSearchResult = $_SESSION["vendorSearchResult"]; + + + // 02-19-2024 Jun Jihad Search Filter $filteredProducts = []; if ($_SERVER["REQUEST_METHOD"] == "POST") { @@ -257,7 +261,45 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate + + +
+
+
Vendor Search Results
+
+ +
+
+
+
+ + + View Details +
+
+
+ +
+ 2) : ?> + + +
+
+ + +
From b0d8cb1bd1797b40e008b1ec60d8a76d801bc76a Mon Sep 17 00:00:00 2001 From: Jun Barroga Date: Thu, 22 Feb 2024 18:28:33 +0800 Subject: [PATCH 2/2] Vendor Search --- functions.php | 2 + more-vendors.php | 466 ++++++++++++++++++++++++++++++++++++- shop-list-left-sidebar.php | 97 +++++--- 3 files changed, 530 insertions(+), 35 deletions(-) diff --git a/functions.php b/functions.php index c752408..cffbd8a 100644 --- a/functions.php +++ b/functions.php @@ -136,6 +136,7 @@ function searchProducts($query) $query = 'asus'; $result = searchProducts($query); +// function searchVendor($query) { $query = str_replace(" ", "+", $query); @@ -166,6 +167,7 @@ function searchVendor($query) return json_encode($data); } +// // Example usage: diff --git a/more-vendors.php b/more-vendors.php index 49933b3..4048719 100644 --- a/more-vendors.php +++ b/more-vendors.php @@ -1 +1,465 @@ -This is more vendors page \ No newline at end of file + + "") { + $_SESSION["isLoggedIn"] = true; + $customer_data = getCustomerbyLoginId($_SESSION["userId"]); +} else { + $_SESSION["isLoggedIn"] = false; +} +$productSearchResult = $_SESSION["productSearchResult"]; +$vendorSearchResult = $_SESSION["vendorSearchResult"]; + +?> + + + + + + + + + oBanana B2B - Elevate Your Business + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+

Shop

+
+
+ + + +
+
+
+
+
+
+ + + +
+
+
+ +
+
+ + + + + + + + +
+
+
+
+ +
+
+ 3 +
+
+ +
+
+ 4 +
+
+ +
+ +
+
+
+ + + +
+ payment image +
+

Someone in new just bought

+
stylish baby shoes
+

10 Minutes ago

+
+ × +
+ + + + + + + + + + + +
+
+
+

Features

+
+ + icon + +
+
+

Color Scheme

+
    +
  • +
  • +
  • +
  • +
  • +
+
+
+

Backgrounds

+ +
+
+

Full Screen mode

+
+
+
Mode
+
On
+
Off
+
+
+
+
+

Dark mode

+
+
+
Mode
+
On
+
Off
+
+
+
+
+

RTL mode

+
+
+
Rtl
+
On
+
Off
+
+
+
+
+

Clear local storage

+ Clear Cache & Default +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/shop-list-left-sidebar.php b/shop-list-left-sidebar.php index b0efec5..f8dad2f 100644 --- a/shop-list-left-sidebar.php +++ b/shop-list-left-sidebar.php @@ -263,43 +263,72 @@ if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['cate -
-
-
Vendor Search Results
-
- -
-
-
-
- - - View Details +
+
+
Vendor Search Results
+ + +
+ +
+
+
+
+
+ + <?php echo $vendor['user_login']; ?> + + + +
+ +
+
+
Seller Products
+ +

+
+
+
+
+
Seller since
+

+
+
+
+ +
+
+
+ +
-
- -
- 2) : ?> - - -
-
- - - + +