Changeset 3106210
- Timestamp:
- 06/23/2024 01:30:05 PM (21 months ago)
- Location:
- mstore-api/trunk
- Files:
-
- 7 edited
-
controllers/flutter-booking.php (modified) (3 diffs)
-
controllers/flutter-user.php (modified) (1 diff)
-
controllers/flutter-woo.php (modified) (3 diffs)
-
controllers/helpers/product-management.php (modified) (3 diffs)
-
functions/index.php (modified) (3 diffs)
-
mstore-api.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mstore-api/trunk/controllers/flutter-booking.php
r2926914 r3106210 177 177 } 178 178 179 private function findStaffValue($array, $staff_id) { 180 foreach ( $array as $element ) { 181 if ($element[$staff_id] != null) { 182 return $element[$staff_id]; 183 } 184 } 185 } 186 179 187 public function get_staffs($request) 180 188 { … … 190 198 $sql = $wpdb->prepare("SELECT * FROM $table_name WHERE product_id = %s",$product_id); 191 199 $items = $wpdb->get_results($sql); 200 $qtys = get_post_meta($product_id, '_staff_qtys'); 201 $costs = get_post_meta($product_id, '_staff_base_costs'); 192 202 foreach ($items as $item) { 193 203 $user = get_user_by("ID", $item->staff_id); 204 $quantity = null; 205 $cost = null; 206 if (is_array($qtys)) { 207 $quantity = $this->findStaffValue($qtys, $item->staff_id); 208 } 209 if (is_array($costs)) { 210 $cost = $this->findStaffValue($costs, $item->staff_id); 211 } 194 212 $results[] = array( 195 213 "id" => $user->ID, … … 207 225 "role" => $user->roles, 208 226 "avatar" => get_avatar_url($user->ID), 227 "quantity" => $quantity, 228 "cost" => $cost, 209 229 ); 210 230 } -
mstore-api/trunk/controllers/flutter-user.php
r3089753 r3106210 6 6 { 7 7 8 /** 9 * Endpoint namespace 10 * 11 * @var string 12 */ 13 protected $namespace = 'api/flutter_user'; 14 8 15 public function __construct() 9 16 { 10 $this->namespace = 'api/flutter_user';11 17 } 12 18 -
mstore-api/trunk/controllers/flutter-woo.php
r3094904 r3106210 663 663 } 664 664 665 private function remove_item_in_cart() { 666 $items = WC()->cart->get_cart(); 667 foreach ( $items as $item_key => $item ) { 668 WC()->cart->remove_cart_item($item_key); 669 } 670 } 671 665 672 public function shipping_methods($request) 666 673 { … … 721 728 $shipping_methods = WC()->shipping->calculate_shipping(WC()->cart->get_shipping_packages()); 722 729 $required_shipping = WC()->cart->needs_shipping() && WC()->cart->show_shipping(); 730 $this->remove_item_in_cart(); 723 731 724 732 if(count( $shipping_methods) == 0){ … … 790 798 } 791 799 $payment_methods = WC()->payment_gateways->get_available_payment_gateways(); 800 $this->remove_item_in_cart(); 792 801 $results = []; 793 802 foreach ($payment_methods as $key => $value) { -
mstore-api/trunk/controllers/helpers/product-management.php
r3094904 r3106210 12 12 protected function get_product_item($id) 13 13 { 14 if (!wc_get_product($id)) { 14 $result = wc_get_product($id); 15 if (!$result) { 15 16 return $this->sendError( 16 17 "invalid_product", … … 19 20 ); 20 21 } 21 return wc_get_product($id);22 return $result; 22 23 } 23 24 … … 227 228 if ($user_id) { 228 229 $user = get_userdata($user_id); 229 $is_admin = $user != false ? in_array('administrator', (array)$user->roles) : false;230 $is_admin = $user != false ? (in_array('administrator', (array)$user->roles) || in_array('shop_manager', (array)$user->roles)) : false; 230 231 $vendor_id = absint($user_id); 231 232 } -
mstore-api/trunk/functions/index.php
r3098380 r3106210 390 390 } 391 391 392 function addYITHBadgeToMetaResponse($response, $product){ 393 if (function_exists( 'yith_wcbm_get_product_badges' )) { 394 // Add badge to product. 395 $badges_to_show = yith_wcbm_get_product_badges( $product ); 396 $badges_to_show = apply_filters( 'yith_wcbm_badges_to_show_on_product', $badges_to_show, $product ); 397 398 $badges = array(); 399 400 foreach ( $badges_to_show as $badge_id ) { 401 $badge_id = yith_wcbm_wpml_translate_badge_id( $badge_id ); 402 $badge = yith_wcbm_get_badge_object( $badge_id ); 403 404 if ( $badge && $badge->is_enabled() ) { 405 $data = $badge->get_data(); 406 // If badge is image, get image url. 407 if ( $badge->get_type() === 'image' ) { 408 $image_url = $badge->get_image_url(); 409 if (strpos($image_url, 'http') == false) { 410 $is_https = strpos(home_url(), 'https') == true ; 411 $image_url = ($is_https ? 'https:' : 'http:').$image_url; 412 } 413 $data['image_url'] = $image_url; 414 } 415 $badges[] = $data; 416 } 417 } 418 419 $meta_data = $response->data['meta_data']; 420 $meta_data[] = array( 421 'id' => '_yith_wcbm_badges', 422 'key' => '_yith_wcbm_badges', 423 'value' => $badges, 424 ); 425 426 $response->data['meta_data'] = $meta_data; 427 428 return $response; 429 } 430 } 431 392 432 function customProductResponse($response, $object, $request) 393 433 { … … 535 575 if ($terms != false && count($terms) > 0 && $terms[0]->name == 'appointment') { 536 576 $response->data['type'] = 'appointment'; 577 $response->data['appointment_duration'] = $product->get_duration(); 578 $response->data['appointment_duration_unit'] = $product->get_duration_unit(); 537 579 } 538 580 } … … 555 597 /* YITH WooCommerce Barcodes and QR Codes Premium */ 556 598 $response = addQRCodeUrlToMetaResponse($response); 599 600 /* YITH WooCommerce Badge Management Premium */ 601 $response = addYITHBadgeToMetaResponse($response, $product); 557 602 558 603 $blackListKeys = ['yoast_head','yoast_head_json','_links']; -
mstore-api/trunk/mstore-api.php
r3098380 r3106210 4 4 * Plugin URI: https://github.com/inspireui/mstore-api 5 5 * Description: The MStore API Plugin which is used for the FluxBuilder and FluxStore Mobile App 6 * Version: 4.14. 46 * Version: 4.14.5 7 7 * Author: FluxBuilder 8 8 * Author URI: https://fluxbuilder.com … … 56 56 class MstoreCheckOut 57 57 { 58 public $version = '4.14. 4';58 public $version = '4.14.5'; 59 59 60 60 public function __construct() -
mstore-api/trunk/readme.txt
r3098380 r3106210 4 4 Requires at least: 4.4 5 5 Tested up to: 6.5.3 6 Stable tag: 4.14. 46 Stable tag: 4.14.5 7 7 License: GPL-2.0 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 49 49 50 50 == Changelog == 51 = 4.14.5 = 52 * Support YITH WooCommerce Badge Management Premium plugin 53 51 54 = 4.14.4 = 52 55 * Push notification to admin when has new order
Note: See TracChangeset
for help on using the changeset viewer.