Plugin Directory

Changeset 3181851


Ignore:
Timestamp:
11/04/2024 11:40:02 PM (17 months ago)
Author:
inspireui
Message:

version 4.15.6

Location:
mstore-api
Files:
487 added
7 edited

Legend:

Unmodified
Added
Removed
  • mstore-api/trunk/controllers/flutter-b2bking.php

    r3132501 r3181851  
    393393                $now_price = $value;
    394394                $discount = ($original_user_price-$now_price)/$original_user_price*100;
    395                 $tired_prices[] = ['quantity' => $index, 'discount' => round($discount), 'price'=>round($now_price)];
     395                $tired_prices[] = ['quantity' => $index, 'discount' => round($discount), 'price'=>round($now_price, 2)];
    396396            }
    397397            return $tired_prices;
  • mstore-api/trunk/controllers/flutter-order.php

    r3166875 r3181851  
    4848                    'callback' => array($this, 'update_item'),
    4949                    'permission_callback' => array($this, 'custom_update_item_permissions_check'),
    50                     'args' => $this->get_endpoint_args_for_item_schema(WP_REST_Server::CREATABLE),
     50                    'args' => $this->get_endpoint_args_for_item_schema(WP_REST_Server::EDITABLE),
    5151                ),
    5252                'schema' => array($this, 'get_public_item_schema'),
     
    128128            return true;
    129129        } else {
    130             $params["customer_id"] = 0;
    131             $request->set_body_params($params);
    132             return true;
     130            return false;
    133131        }
    134132    }
  • mstore-api/trunk/controllers/flutter-user.php

    r3147900 r3181851  
    402402        $userLoginReq = $params["user_login"];
    403403        $userEmailReq = $params["user_email"];
    404         $referralCodeReq = $params["referral_code"];
     404
     405        if (array_key_exists('referral_code', $params)) {
     406            $referralCodeReq = $params["referral_code"];
     407        }
    405408
    406409        if(array_key_exists('role', $params)){
     
    474477
    475478                //
    476                 if ($referralCodeReq) {
     479                if (isset($referralCodeReq) && $referralCodeReq) {
    477480                    $_COOKIE['woo_wallet_referral'] = sanitize_text_field( wp_unslash( $referralCodeReq ) );
    478481                }
  • mstore-api/trunk/functions/index.php

    r3166875 r3181851  
    438438function customProductResponse($response, $object, $request)
    439439{
    440     global $woocommerce_wpml;
     440    global $woocommerce_wpml, $product;
    441441
    442442    // Will load the product variations if this request is for a specific
     
    559559    }
    560560   
    561     /* Product Add On */
     561   
     562    // /* Product Add On */
    562563    if(class_exists('WC_Product_Addons_Helper')){
     564        if(class_exists('WeDevs_Dokan') && dokan()->is_pro_exists()){
     565            global $post;
     566            wp_cache_delete('all_products', 'global_product_addons');
     567            $post = get_post($response->data['id']);
     568        }
     569
    563570        $add_ons_list =  [];
    564571        $product_addons = WC_Product_Addons_Helper::get_product_addons( $response->data['id'], false );
     
    593600        $response->data['meta_data'] = $new_meta_data;
    594601    }
    595    
     602
    596603
    597604    /* Product Booking */
     
    683690    $meta_query_sql  = $meta_query->get_sql('post', $wpdb->posts, 'ID');
    684691    $tax_query_sql   = $tax_query->get_sql($wpdb->posts, 'ID');
     692    $term_ids_condition = !empty($term_ids) ? "AND terms.term_id IN (" . implode(',', array_map('absint', $term_ids)) . ")" : "";
    685693
    686694    // Generate query
     
    697705            AND {$wpdb->posts}.post_status = 'publish'
    698706            " . $tax_query_sql['where'] . $meta_query_sql['where'] . "
    699             AND terms.term_id IN (" . implode(',', array_map('absint', $term_ids)) . ")
     707            $term_ids_condition
    700708        ";
    701709    $query['group_by'] = "GROUP BY terms.term_id";
  • mstore-api/trunk/mstore-api.php

    r3166875 r3181851  
    44 * Plugin URI: https://github.com/inspireui/mstore-api
    55 * Description: The MStore API Plugin which is used for the FluxBuilder and FluxStore Mobile App
    6  * Version: 4.15.5
     6 * Version: 4.15.6
    77 * Author: FluxBuilder
    88 * Author URI: https://fluxbuilder.com
     
    5757class MstoreCheckOut
    5858{
    59     public $version = '4.15.5';
     59    public $version = '4.15.6';
    6060
    6161    public function __construct()
     
    6868         */
    6969        add_action('template_redirect', 'flutter_prepare_checkout');
     70
     71        add_action( 'pre_get_posts', 'set_author_in_for_vendor_staff' );
    7072
    7173        include_once(ABSPATH . 'wp-admin/includes/plugin.php');
     
    356358    }
    357359
    358     //new order or update order via API
     360    // New order or update order via API
    359361    function track_api_new_order($object, $request, $creating)
    360362    {
    361363        if ($creating) {
    362             trackNewOrder($object->id);
     364            trackNewOrder($object->get_id());
    363365
    364366            // Update order attributes. Requires WooCommerce 8.5.0 or later.
     
    10421044}
    10431045
     1046function set_author_in_for_vendor_staff( $query ) {
     1047    global $post;
     1048    if ( class_exists('WeDevs_Dokan') && dokan()->is_pro_exists() && isset( $query->query['post_type'] ) && $query->query['post_type'] === 'global_product_addon' && $post != null ) {
     1049        $vendor        = dokan_get_vendor_by_product( $post->ID );
     1050
     1051        // Check if $vendor is valid before proceeding
     1052        if (!$vendor) {
     1053            return;
     1054        }
     1055
     1056        $vendor_staffs = dokan_get_vendor_staff( $vendor->get_id() );
     1057        if ( ! in_array( $vendor->get_id(), $vendor_staffs, true ) ) {
     1058            return;
     1059        }
     1060        $query->set( 'author__in', $vendor_staffs );
     1061    }
     1062}
     1063
    10441064// Add product image to order
    10451065add_filter('woocommerce_rest_prepare_shop_order_object', 'custom_woocommerce_rest_prepare_shop_order_object', 10, 1);
  • mstore-api/trunk/readme.txt

    r3166875 r3181851  
    44Requires at least: 4.4
    55Tested up to:      6.5.3
    6 Stable tag:        4.15.5
     6Stable tag:        4.15.6
    77License:           GPL-2.0
    88License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    4949
    5050== Changelog ==
     51= 4.15.6 =
     52  * Fix to load Add-Ons for Dokan
     53
    5154= 4.15.5 =
    5255  * Support Variation Swatches plugin
  • mstore-api/trunk/templates/admin/mstore-api-admin-dashboard.php

    r3089753 r3181851  
    22<?php include_once(plugin_dir_path(dirname(dirname(__FILE__))) . 'functions/index.php'); ?>
    33<?php include_once(plugin_dir_path(dirname(dirname(__FILE__))) . 'controllers/helpers/firebase-message-helper.php'); ?>
    4 
     4<!--
    55    <div class="wrap">
    66        <div class="thanks">
     
    1616            ?>
    1717        </div>
    18     </div>
     18    </div> -->
    1919<?php
    2020$verified = isPurchaseCodeVerified();
     
    2222    ?>
    2323    <form action="" enctype="multipart/form-data" method="post" style="margin-bottom:50px">
    24         <?php
     24        <!-- <?php
    2525        if (isset($_POST['but_verify'])) {
    2626            $verified = verifyPurchaseCode(sanitize_text_field($_POST['code']));
     
    3737            }
    3838        }
    39         ?>
     39        ?> -->
    4040
    4141        <input type="text" class="mstore-input-class" placeholder="Enter Purchase Code" name="code">
Note: See TracChangeset for help on using the changeset viewer.