diff --git a/admin/header.php b/admin/header.php new file mode 100644 index 0000000..020fd67 --- /dev/null +++ b/admin/header.php @@ -0,0 +1,561 @@ + + + + \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index df56492..814484e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -48,13 +48,11 @@ if($_SESSION["user_type"]!="admin"){ - -
- - - - + + + +
@@ -65,13 +63,21 @@ if($_SESSION["user_type"]!="admin"){
-
+
+
+ + +
+
+
    diff --git a/admin/left-main-sidebar.php b/admin/left-main-sidebar.php index 9f13f0b..ecffa77 100644 --- a/admin/left-main-sidebar.php +++ b/admin/left-main-sidebar.php @@ -103,7 +103,7 @@
  • - + Products diff --git a/admin/product-edit.php b/admin/product-edit.php index 4ec941c..81cfeb2 100644 --- a/admin/product-edit.php +++ b/admin/product-edit.php @@ -1130,10 +1130,10 @@ $vendorId = $_SESSION["vendorId"]; promises.push(promise); } - + // 03-14-2024 Jun Jihad modified this block of code to properly upload images with comma in the filename Promise.all(promises) .then(filenames => { - const updatedImages = existingImages.concat(filenames.map(filename => `https:///images/storage/product_uploads/${filename}`)); + const updatedImages = existingImages.concat(filenames.map(filename => `https:///images/storage/product_uploads/${encodeURIComponent(filename)}`)); if (!Array.isArray(updatedImages)) { console.error('Updated images is not an array:', updatedImages); @@ -1154,6 +1154,7 @@ $vendorId = $_SESSION["vendorId"]; body: JSON.stringify(payload) }); }) + // 03-14-2024 Jun Jihad modified this block of code to properly upload images with comma in the filename .then(response => { if (response.ok) { console.log('Images uploaded successfully'); diff --git a/admin/user-card.php b/admin/user-card.php index 228c3a3..4826885 100644 --- a/admin/user-card.php +++ b/admin/user-card.php @@ -83,560 +83,8 @@ $users = getUsers();
    - - + +
    diff --git a/admin/vendor-card.php b/admin/vendor-card.php index d8ab00d..79fea72 100644 --- a/admin/vendor-card.php +++ b/admin/vendor-card.php @@ -4,7 +4,7 @@ include "../functions.php"; $_SESSION["url"] = $_SERVER['REQUEST_URI']; if ($_SESSION["userId"] <> "") { $_SESSION["isLoggedIn"] = true; - $customer_data = getCustomerbyLoginId($_SESSION["userId"]); + //$customer_data = getCustomerbyLoginId($_SESSION["userId"]); } else { $_SESSION["isLoggedIn"] = false; header("location: login.php"); @@ -14,8 +14,6 @@ if ($_SESSION["user_type"] != "admin") { header("location: login.php?alert=Only admins allowed here!"); } $products = productList(); - -$vendorSearchResult = $_SESSION["vendorSearchResult"]; ?> @@ -66,8 +64,7 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"]; - - + @@ -92,22 +89,17 @@ $vendorSearchResult = $_SESSION["vendorSearchResult"]; - -
    -
    -
    - - -
    -
    +
    + + +
      -
      -
      - +
    • + + + + + + + + oBanana B2B - Admin Dashboard + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + + + + + +
      + + + + + + + +
      +
      +
      Vendor Search Results
      +
      + +
      +
      +
      +
      + +
      +
      + "> + + +
      +
      +
      +
      +
      Seller Products
      + +

      +
      +
      +
      +
      +
      Seller since
      +

      +
      +
      +
      + +
      +
      +
      + +
      +
      +
      + + + + +
      +
      +
      + $productListVendor) { + // echo "$product .":" . $productListVendor"; + // $vendorOfProduct = getVendorbyId($product['vendor_api_id']); + + $products = productListVendor($vendorId); + $totalProducts = count($products); + + + for ($i = 0; $i <= $totalProducts - 1; $i++) { + $product = $products[$i]; + ?> +
      +
      +
      +
      +
      + + edit + + edit + +
      +
      +
      +

      +

      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/admin/vendor-profile.php b/admin/vendor-profile.php index 2553644..f923609 100644 --- a/admin/vendor-profile.php +++ b/admin/vendor-profile.php @@ -68,636 +68,7 @@ $array = json_decode($vendor,true);
      - +
      @@ -789,7 +160,17 @@ $array = json_decode($vendor,true);
      -
      +
      +
      +
      + +
      +
      +

      Payments

      + +
      + +
      +
      + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      MethodAmountStatusPayoutDescriptionDate
      ObananaPay₱230 + Paid + No + Coach Swagger + Oct 20, 2018 + +
      ObananaPay₱550 + Paid + No + Toddler Shoes, Gucci Watch + Nov 15, 2018 + +
      ObananaPay₱325 + Paid + No + Hat Black Suits + Nov 18, 2018 + +
      PayMongo₱200 + Paid + No + T100 Power Bank + Nov 20, 2018 + +
      ObananaPay₱150 + Paid + Yes + Vodka Milk Tea + Dec 11, 2018 + +
      +
      +
      +
      +
      + +
      +
      + +
      +
      + +
      +
      +
      +
      + +
      +
      +

      Payouts

      + +
      + +
      +
      + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      AmountBankAccountNameDateStatus
      ₱1,230EastWest**** **** 1234Jon-Jon ManaayOct 20, 2018 + Deposited + + +
      ₱2,340EastWest**** **** 1234Jon-Jon ManaayOct 27, 2018 + Processing + + +
      +
      +
      +
      +
      +
      +
      + +
      diff --git a/catalog-single-vendor-action.php b/catalog-single-vendor-action.php new file mode 100644 index 0000000..d9812af --- /dev/null +++ b/catalog-single-vendor-action.php @@ -0,0 +1,30 @@ + "") { } else { $_SESSION["isLoggedIn"] = false; } +$products = productListVendor($_GET["id"]); + +$filteredProducts = []; + +if (!empty($_GET['minPrice']) || !empty($_GET['maxPrice']) || !empty($_GET['category'])) { + $filteredProducts = []; + $minPrice = isset($_GET['minPrice']) && $_GET['minPrice'] !== '' ? floatval($_GET['minPrice']) : null; + $maxPrice = isset($_GET['maxPrice']) && $_GET['maxPrice'] !== '' ? floatval($_GET['maxPrice']) : null; + + // echo "Min Price: " . ($minPrice !== null ? $minPrice : "null") . "
      "; + // echo "Max Price: " . ($maxPrice !== null ? $maxPrice : "null") . "
      "; + + $selectedCategories = isset($_GET['category']) ? $_GET['category'] : []; + + if (!empty($selectedCategories) && (($minPrice == null) && ($maxPrice == null))) { + // var_dump("filtering categories without price"); + foreach ($selectedCategories as $selectedCategory) { + $category = strtolower(trim($selectedCategory)); + foreach ($products as $result) { + $product = $result; + + $productCategory = strtolower(trim($product['product_category'])); + + if ( + $productCategory == $category + ) { + $filteredProducts[] = $result; + } + } + } + } elseif (!empty($selectedCategories) && (!empty($minPrice) || !empty($maxPrice))) { + // var_dump("filtering categories and price"); + if ($minPrice === null) { + $minPrice = 0; + } + if ($maxPrice === null) { + $maxPrice = PHP_FLOAT_MAX; + } + foreach ($selectedCategories as $selectedCategory) { + $category = strtolower(trim($selectedCategory)); + foreach ($products as $result) { + $product = $result; + $productPrice = isset($product['sale_price']) ? $product['sale_price'] : $product['regular_price']; + $productCategory = strtolower(trim($product['product_category'])); + if ( + $productCategory = $category && (($productPrice >= $minPrice) && + ($productPrice <= $maxPrice)) + ) { + $filteredProducts[] = $result; + } + } + } + } + else { + foreach ($products as $result) { + // var_dump("filtering"); + $product = $result; + $productPrice = isset($product['sale_price']) ? $product['sale_price'] : $product['regular_price']; + // var_dump( $minPrice); + // var_dump( $productPrice); + // var_dump( $productPrice >= $minPrice); + + + + if ($minPrice === null) { + $minPrice = 0; + } + + if ($maxPrice === null) { + $maxPrice = PHP_FLOAT_MAX; + } + if (($minPrice === null || $productPrice >= $minPrice) && + ($maxPrice === null || $productPrice <= $maxPrice) + ) { + $filteredProducts[] = $result; + // var_dump("filtering heree"); + + } + } + } +} else { + $filteredProducts = $products; +} ?> @@ -268,7 +351,6 @@ if ($_SESSION["userId"] <> "") {
      Seller Products

      Products

      @@ -334,7 +416,7 @@ if ($_SESSION["userId"] <> "") {
      "") { } } else { ?> - edit + edit @@ -489,64 +571,83 @@ if ($_SESSION["userId"] <> "") {
      -
      -

      Category

      -
      -
      - + + +
      -
      x diff --git a/functions.php b/functions.php index 23f6d72..ed25bb6 100644 --- a/functions.php +++ b/functions.php @@ -6,7 +6,7 @@ function simpleProducts($category) { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -32,7 +32,7 @@ function simpleProducts($category) function sddProducts() { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/products"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( //CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/6527b593f79b5deac5ad6cb8', @@ -51,7 +51,7 @@ function sddProducts() curl_close($curl); $json = json_decode($response, true); $products = array_filter($json, function ($var) { - return ($var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == '' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'simple' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'variable' ); + return ($var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == '' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'simple' || $var['promo'][0]['same-day-delivery'] === "Yes" && $var['product_type'] == 'variable'); }); $products = array_values($products); return $products; @@ -90,7 +90,7 @@ function sddProducts() function searchProducts($query) { $query = str_replace(" ", "+", $query); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/search?q=$query"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/products/search?q=$query"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -140,7 +140,7 @@ $result = searchProducts($query); function searchVendor($query) { $query = str_replace(" ", "+", $query); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$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( @@ -202,7 +202,7 @@ $result = searchProducts($query); function getProduct($product) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/$product"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/products/$product"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -226,7 +226,7 @@ function productList() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -248,7 +248,7 @@ function productList() function productListVendor($vendorId) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/" . $vendorId; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/products/vendor/" . $vendorId; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( //CURLOPT_URL => 'https://".$_SESSION["data_endpoint"]."/api/v1/products/vendor/6527b593f79b5deac5ad6cb8', @@ -278,7 +278,7 @@ function getProductVariations($parent_id) { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -314,7 +314,7 @@ function register($username, $password) $json = json_encode($array); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/register", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/register", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -342,7 +342,7 @@ function login($username, $password) $json = json_encode($array); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/login", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/login", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -362,7 +362,7 @@ function login($username, $password) } function forgot_password($email) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $email = $_SESSION["test_email_rcpt"]; } $curl = curl_init(); @@ -372,7 +372,7 @@ function forgot_password($email) $json = json_encode($array); curl_setopt($curl, CURLOPT_POSTFIELDS, $json); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/forgot-password", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/forgot-password", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -392,7 +392,7 @@ function forgot_password($email) function getCustomerbyLoginId($id) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/login_id/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers/login_id/$id"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -416,7 +416,7 @@ function getCustomerbyLoginId($id) function getCustomer($id) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers/$id"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -440,7 +440,7 @@ function getCustomer($id) function getVendorbyLoginId($id) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/login_id/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/login_id/$id"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -464,7 +464,7 @@ function getVendorbyLoginId($id) function customerExists($email) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/search?q=$email"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers/search?q=$email"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => true, @@ -492,7 +492,7 @@ function customerExists($email) function vendorExists($email) { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$email"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/search?q=$email"; curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => true, @@ -520,7 +520,7 @@ function vendorExists($email) function sendEmail_obanana($fName, $lName, $email, $phone, $message) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $email = $_SESSION["test_email_rcpt"]; } $salesEmail = $_SESSION["sales_email"]; @@ -639,7 +639,7 @@ function sendEmail_customer($fName, $lName, $email) function contact_Seller($cstm_email, $prd_name, $prd_qnty, $message) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $cstm_email = $_SESSION["test_email_rcpt"]; } $salesEmail = $_SESSION["sales_email"]; @@ -699,7 +699,7 @@ function contact_Seller($cstm_email, $prd_name, $prd_qnty, $message) function contact_Inquirer($cstm_email) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $cstm_email = $_SESSION["test_email_rcpt"]; } $msgto_inquirer = " @@ -760,7 +760,7 @@ function contact_Inquirer($cstm_email) function sendOTP($email) { - if($_SESSION["is_test"]==true && $_SESSION["test_email_rcpt"]!=""){ + if ($_SESSION["is_test"] == true && $_SESSION["test_email_rcpt"] != "") { $email = $_SESSION["test_email_rcpt"]; } $curl = curl_init(); @@ -836,7 +836,7 @@ function createCustomer($email, $phone, $firstname, $lastname, $loginId, $token) curl_setopt($curl, CURLOPT_POSTFIELDS, $array); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/customers", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -855,7 +855,7 @@ function createCustomer($email, $phone, $firstname, $lastname, $loginId, $token) function updateCustomer($customerId, $phone, $firstname, $lastname, $loginId, $token) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/customers/$customerId"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/customers/$customerId"; $array = '{ "last_name": "' . $lastname . '", "login_id": "' . $loginId . '", @@ -892,7 +892,7 @@ function profile($token) $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/profile", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/profile", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -967,7 +967,7 @@ function profile($token) // } function updateVendor($vendorId, $phone, $userlogin, $firstname, $lastname, $loginId, $token) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/$vendorId"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/$vendorId"; $array = '{ "login_id": "' . $loginId . '", "user_login": "' . $userlogin . '", @@ -1010,7 +1010,7 @@ function createVendor($email, $phone, $userlogin, $firstname, $lastname, $loginI ); curl_setopt($curl, CURLOPT_POSTFIELDS, $array); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1105,7 +1105,7 @@ function vendorList() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1128,7 +1128,7 @@ function simpleVendors() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1157,7 +1157,7 @@ function productListVendors($vendorIds) $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products?vendor_ids=" . $vendorIdsString, + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products?vendor_ids=" . $vendorIdsString, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1180,7 +1180,7 @@ function simpleVendorsWithProducts() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1243,7 +1243,7 @@ function simpleVendorsWithProducts() function getVendorbyId($id) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1267,7 +1267,7 @@ function getVendorbyId($id) function searchVendorByLoginId($id) { $id = str_replace(" ", "+", $id); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/vendors/search?q=$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors/search?q=$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1289,7 +1289,7 @@ function searchVendorByLoginId($id) function getOrder($order) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/$order"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/$order"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1313,7 +1313,7 @@ function getAllOrder() { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/orders", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1341,7 +1341,7 @@ function getAllOrder() function getOrderbyCustomerId($id) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/customer/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/customer/$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1363,7 +1363,7 @@ function getOrderbyCustomerId($id) } function getOrderbyVendorId($id) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/vendor/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/vendor/$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1399,11 +1399,10 @@ function editOrderStatus($orderId, $status, $currentStatus, $trackingNumber, $co // $data['tracking_number'] = $trackingNumber; $data['payment']['status'] = $paymentStatus; $data['payment']['reference_number'] = $paymentReference; - } $params3 = json_encode($data); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/orders/" . $orderId, + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/" . $orderId, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1454,7 +1453,7 @@ function editOrderStatus($orderId, $status, $currentStatus, $trackingNumber, $co function deleteOrderbyId($id) { - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/orders/$id"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/orders/$id"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt_array($curl, array( @@ -1508,7 +1507,7 @@ function addProduct( ); curl_setopt($curl, CURLOPT_POSTFIELDS, $array); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1552,6 +1551,7 @@ function editProduct( $color, $material, $size, + $priceMatrix, $token ) { $curl = curl_init(); @@ -1572,9 +1572,12 @@ function editProduct( 'shipping_fee' => $productSf, 'status' => $productStatus, 'promo' => array( - 'next-day-delivery' => $ndd , - 'same-day-delivery' => $sdd , - 'free-shipping' => $freeSf + 'next-day-delivery' => $ndd, + 'same-day-delivery' => $sdd, + 'free-shipping' => $freeSf + ), + 'price_matrix' => array( + $priceMatrix ), 'parent_id' => $parentId, 'minimum_order' => $minimumOrder, @@ -1614,7 +1617,7 @@ function editProduct( $params3 = json_encode($data); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/products/" . $productId, + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/products/" . $productId, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1717,7 +1720,7 @@ function addVendor( $params2 = json_encode($data); curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/vendors", + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/vendors", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1742,7 +1745,7 @@ function addVendor( function getUsers() { $curl = curl_init(); - $url = "https://".$_SESSION["data_endpoint"]."/api/v1/users"; + $url = "https://" . $_SESSION["data_endpoint"] . "/api/v1/users"; curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, @@ -1809,7 +1812,7 @@ function editUsers($id, $username, $userType, $token) $jsonPayload = json_encode($data); // Convert the array to JSON format curl_setopt_array($curl, array( - CURLOPT_URL => "https://".$_SESSION["data_endpoint"]."/api/v1/users/" . $id, + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/users/" . $id, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, @@ -1830,4 +1833,28 @@ function editUsers($id, $username, $userType, $token) echo $response; return $response; -} \ No newline at end of file +} + +function getAllPayout($token) +{ + $curl = curl_init(); + curl_setopt_array($curl, array( + CURLOPT_URL => "https://" . $_SESSION["data_endpoint"] . "/api/v1/payouts", + 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}}', + 'Content-Type: application/json', + 'Authorization: Bearer ' . $token + ), + )); + $response = curl_exec($curl); + curl_close($curl); + + return $response; +} diff --git a/product-left-sidebar.php b/product-left-sidebar.php index 7316195..512d2a2 100644 --- a/product-left-sidebar.php +++ b/product-left-sidebar.php @@ -505,7 +505,7 @@ if (isset($_GET['id'])) { echo '" id="qty-input" />'; echo '
      +
      '; // echo '
      '; - echo '
      '; + echo '
      '; echo '
      '; diff --git a/user-history.php b/user-history.php index e2ac230..7f6f97f 100644 --- a/user-history.php +++ b/user-history.php @@ -38,6 +38,9 @@ if ($_SESSION["userId"] <> "") { + + + @@ -45,15 +48,58 @@ if ($_SESSION["userId"] <> "") { + + + +
      diff --git a/user-profile.php b/user-profile.php index 71eca38..e3ae4f4 100644 --- a/user-profile.php +++ b/user-profile.php @@ -114,7 +114,7 @@ if ($_SESSION["userId"] <> "") { - +
      @@ -168,7 +168,7 @@ if ($_SESSION["userId"] <> "") {
      -
      + diff --git a/user-refund-history.php b/user-refund-history.php index 95a6416..8bfcbcc 100644 --- a/user-refund-history.php +++ b/user-refund-history.php @@ -49,7 +49,7 @@ if ($_SESSION["userId"] <> "") { + + + + +
      +
      +
      +
      +
      +
      +
      +
      + + + + + + + + + + +
      +
      +
      +
      +
      +
      +

      User History

      +
      +
      + +
        +
      • Home
      • +
      • History
      • +
      + +
      +
      +
      +
      +
      +
      + + + + + + + + + + + + +
      +
      +
      +
      + +
      +
      + 3 +
      +
      + +
      +
      + 4 +
      +
      + +
      + +
      +
      +
      + + + + + + + + + + + + + + + + +
      +
      +
      +

      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 +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor-payouts.php b/vendor-payouts.php new file mode 100644 index 0000000..970d1a4 --- /dev/null +++ b/vendor-payouts.php @@ -0,0 +1,640 @@ + "") { + $_SESSION["isLoggedIn"] = true; + // $customer_data = getCustomerbyLoginId($_SESSION["userId"]); + $vendorLoginId = searchVendorbyLoginId($_SESSION["userId"]); + $vendorLoginIdjson = json_decode($vendorLoginId, true); + if (isset($vendorLoginIdjson['results'][0])) { + $vendorData = $vendorLoginIdjson['results'][0]; + $vendorId = $vendorData['_id']; + $_SESSION["LoggedInVendorId"] = $vendorId; + } + // $vendor= getVendorbyId($vendorLoginIdjson['results'][0]['_id']); + // // var_dump($vendor); + // $array = json_decode($vendor,true); + // var_dump($array); + $response = getAllPayout($_SESSION['token']); + $vendorPayoutData = json_decode($response, true); +} else { + $_SESSION["isLoggedIn"] = false; + header("location: login.php"); +} +?> + + + + + + + + + oBanana B2B - Elevate Your Business + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      +
      +
      +
      +
      +
      + + + + + + + + + + + + + +
      +
      +
      +
      +
      +
      +

      Vendor Settings

      +
      +
      + +
        +
      • Home
      • +
      • Settings
      • +
      + +
      +
      +
      +
      +
      +
      + + + +
      +
      +
      + +
      +
      + +
      +
      + + +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      Upcoming Payout
      +
      +
      +
      +

      +
      + + ₱ 0.00 + +
      +

      +
      + Payout Generation: Tue, Mar 19, 2024 +
      +
      + Receive Payout on or before: Wed, Mar 20, 2024 +
      +
      + Receipient: Philippine National Bank (PNB) Account ending in 6685 +
      +
      +
      +
      +
      +
      +
      +
      +
      Payout Generation Schedule
      +
      +
      +
      +

      +
      + + + Weekly + +
      +

      +
      +
      + Every Tuesday +
      +
      +
      + Payouts that will fall on holiday will be processed the next banking day +
      +
      +
      +
      +
      +
      +
      +
      +
      Next Payout
      +
      +
      +
      +

      +
      + + ₱ 0.00 + +
      +

      +
      + Payout Generation: Tue, Mar 25, 2024 +
      +
      + Receive Payout on or before: Wed, Mar 26, 2024 +
      +
      + Receipient: Philippine National Bank (PNB) Account ending in 6685 +
      +
      +
      +
      +
      +
      +
      Payout History
      +
      + + + + + + + + + + + + + + $val) { + $vendorIdCheck = $val['vendor_details'][0]['vendor_id']; + if ((empty($vendorIdCheck) == false) && ($vendorIdCheck == $vendorId) && ($val['status'] == "DEPOSITED")) { + echo ""; + echo ""; + if (empty($val['bank_information'][0]['bank_name']) == false) { + echo ""; + // echo ""; + } else { + echo ''; + } + if (empty($val['bank_information'][0]['bank_account_number']) == false) { + $accNum = $val['bank_information'][0]['bank_account_number']; + // Replace characters with asterisks for all characters except the last three segments + $maskedAccNum = substr_replace($accNum, str_repeat('*', strlen($accNum) - 3), 0, -3); + echo ""; + // echo ""; + } else { + echo ''; + }; + echo ""; + echo ""; + echo ""; + echo ""; + } + } + ?> + + +
      AmountBankAccount NumberPayout GenerationStatusAction
      " . "₱ " . $val['net_amount'] . "" . $val['bank_information'][0]['bank_name'] . "" . $val['bank_information'][0]['account_number'] . "N/A" . $maskedAccNum . "" . $val['bank_information'][0]['bank_account_number'] . "N/ADecember 08, 2024" . $val['status'] . "" . + "" . + "
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      +

      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 +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor-settings.php b/vendor-settings.php index 33e9324..0907767 100644 --- a/vendor-settings.php +++ b/vendor-settings.php @@ -233,6 +233,34 @@ if ($_SESSION["userId"] <> "") {
      + +
      +
      Bank Information
      + +
      +
      +
      + + + + + + + + + + + + + + + +
      Bank Name
      Account Number
      Account Name
      + + +
      +
      +
      @@ -350,6 +378,71 @@ if ($_SESSION["userId"] <> "") {
      + + + diff --git a/vendor-uploads-edit-product-action.php b/vendor-uploads-edit-product-action.php index 4aca644..6b58249 100644 --- a/vendor-uploads-edit-product-action.php +++ b/vendor-uploads-edit-product-action.php @@ -40,6 +40,18 @@ $material = $_POST['material']; //echo '$material: '.$material.'
      '; $token = $_SESSION["token"]; +$quantities = $_POST['quantity']; +$prices = $_POST['price']; + +// Constructing the price matrix +$priceMatrix = array(); +for ($i = 0; $i < count($quantities); $i++) { + $priceMatrix[] = array( + 'quantity' => $quantities[$i], + 'price' => $prices[$i] + ); +} + $response = editProduct( $productId, @@ -66,6 +78,7 @@ $response = editProduct( $color, $material, $size, + $priceMatrix, $token); $array = json_decode($response,true); $_SESSION['newProdictId'] = $array['_id']; diff --git a/vendor-uploads.php b/vendor-uploads.php index b2639a8..a60d129 100644 --- a/vendor-uploads.php +++ b/vendor-uploads.php @@ -118,14 +118,16 @@ $array = json_decode($result, true);
      -
      - -
      + if (!empty($vendorData['vendor_banner'])) { ?> +
      + +
      - +
      - + @@ -134,7 +136,7 @@ $array = json_decode($result, true); vendor image
      -
      +
      +
      + + + + + + + + + + + $pair) : ?> + + + + + + + + +
      QuantityPrice (PHP)
      + +
      +
      -
      +
      - style="background-color: blue;"> - -
      -
      -
      -
      - style="background-color: blue;"> - + style="background-color: blue;"> +
      - style="background-color: blue;"> - + style="background-color: blue;"> + +
      +
      +
      +
      + style="background-color: blue;"> +
      @@ -473,7 +500,7 @@ $array = json_decode($result, true);