Plugin Directory

Changeset 3321453


Ignore:
Timestamp:
07/02/2025 08:59:54 PM (9 months ago)
Author:
olivery
Message:

version 1.0.24
support paid in settings

Location:
connect-plus-for-woocommerce
Files:
38 added
7 edited

Legend:

Unmodified
Added
Removed
  • connect-plus-for-woocommerce/trunk/README.txt

    r3300805 r3321453  
    99Tested up to: 6.8
    1010
    11 Stable tag: 1.0.23
     11Stable tag: 1.0.24
    1212
    1313Requires PHP: 7.0
  • connect-plus-for-woocommerce/trunk/admin/cpfw-connect-admin.php

    r3300644 r3321453  
    269269            'sanitize_callback' => 'absint',
    270270            'default' => 1,
     271        ]);
     272
     273        register_setting('olivery_options_group', 'olivery_connect_paid_methods', [
     274            'type' => 'array',
     275            'sanitize_callback' => function ($input) {
     276                return array_map('sanitize_text_field', $input);
     277            },
     278        ]);
     279
     280        register_setting('olivery_options_group', 'olivery_connect_paid_methods', [
     281            'sanitize_callback' => function($input) {
     282                return is_array($input) ? array_map('sanitize_text_field', $input) : [];
     283            },
    271284        ]);
    272285       
  • connect-plus-for-woocommerce/trunk/admin/css/cpfw-connect-admin.css

    r3163352 r3321453  
    7272    max-width: inherit;
    7373}
     74/* Shared wrapper grid layout */
     75.cpfw-grid-wrapper {
     76    display: grid;
     77    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
     78    gap: 10px;
     79    margin-top: 10px;
     80    max-width: 600px;
     81}
     82
     83/* Shared item box style */
     84.cpfw-option-box {
     85    background: #fff;
     86    border: 1px solid #ccd0d4;
     87    padding: 8px 12px;
     88    border-radius: 4px;
     89    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
     90    display: flex;
     91    align-items: center;
     92    font-size: 14px;
     93}
     94
     95/* Input inside each item */
     96.cpfw-option-box input {
     97    margin-right: 8px;
     98}
     99
     100.description{
     101    margin-top: 10px;
     102}
  • connect-plus-for-woocommerce/trunk/admin/views/cpfw-connect-admin-settings.php

    r3300805 r3321453  
    5353    "Completed Returned" => __("Completed Returned", 'connect-plus-for-woocommerce'),
    5454];
     55
     56$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
     57$current_paid_methods = get_option('olivery_connect_paid_methods', []);
     58
    5559?>
    5660
     
    111115                    </th>
    112116                    <td>
    113                         <fieldset>
    114                             <label for="olivery_add_connect_sequence_note">
     117                        <div class="cpfw-grid-wrapper">
     118                            <label class="cpfw-option-box" for="olivery_add_connect_sequence_note">
    115119                                <input type="checkbox" id="olivery_add_connect_sequence_note" name="olivery_add_connect_sequence_note"
    116120                                    value="1" <?php checked(get_option('olivery_add_connect_sequence_note', 1), 1); ?>>
    117                                 <?php esc_html_e('Add Connect plus Sequence', 'connect-plus-for-woocommerce'); ?>
    118                             </label>
    119                             <br>
    120                             <label for="olivery_add_delivery_sequence_note">
     121                                <?php esc_html_e('Add Connect Plus Sequence', 'connect-plus-for-woocommerce'); ?>
     122                            </label>
     123                            <label class="cpfw-option-box" for="olivery_add_delivery_sequence_note">
    121124                                <input type="checkbox" id="olivery_add_delivery_sequence_note" name="olivery_add_delivery_sequence_note"
    122125                                    value="1" <?php checked(get_option('olivery_add_delivery_sequence_note', 1), 1); ?>>
    123126                                <?php esc_html_e('Add Delivery Sequence', 'connect-plus-for-woocommerce'); ?>
    124127                            </label>
    125                         </fieldset>
     128                        </div>
    126129                        <p class="description">
    127130                            <?php esc_html_e('Choose which sequences should be added to order notes.', 'connect-plus-for-woocommerce'); ?>
     
    132135        </div>
    133136
     137        <div class="connect-plus-settings-section">
     138            <table class="form-table">
     139                <tr>
     140                    <th scope="row">
     141                        <label><?php esc_html_e('Paid Payment Methods:', 'connect-plus-for-woocommerce'); ?></label>
     142                    </th>
     143                    <td>
     144                        <div class="cpfw-grid-wrapper">
     145                            <?php foreach ($available_gateways as $gateway_id => $gateway): ?>
     146                                <label class="cpfw-option-box">
     147                                    <input type="checkbox" name="olivery_connect_paid_methods[]"
     148                                        value="<?php echo esc_attr($gateway_id); ?>"
     149                                        <?php checked(in_array($gateway_id, (array) $current_paid_methods)); ?>>
     150                                    <?php echo esc_html($gateway->get_title()); ?>
     151                                </label>
     152                            <?php endforeach; ?>
     153
     154                            <label class="cpfw-option-box">
     155                                <input type="checkbox" name="olivery_connect_paid_methods[]"
     156                                    value="N/A" <?php checked(in_array('N/A', (array) $current_paid_methods)); ?>>
     157                                <?php esc_html_e('N/A', 'connect-plus-for-woocommerce'); ?>
     158                            </label>
     159
     160                            <label class="cpfw-option-box">
     161                                <input type="checkbox" name="olivery_connect_paid_methods[]"
     162                                    value="Other" <?php checked(in_array('Other', (array) $current_paid_methods)); ?>>
     163                                <?php esc_html_e('Other', 'connect-plus-for-woocommerce'); ?>
     164                            </label>
     165                        </div>
     166                        <p class="description" style="margin-top: 10px;">
     167                            <?php esc_html_e('Select all payment methods that you want to consider as paid when sending orders to Connect Plus.', 'connect-plus-for-woocommerce'); ?>
     168                        </p>
     169                    </td>
     170                </tr>
     171            </table>
     172        </div>
     173       
    134174        <div class="connect-plus-settings-section">
    135175            <h2><?php esc_html_e('Delviery Status Mapping', 'connect-plus-for-woocommerce'); ?></h2>
     
    165205            </table>
    166206        </div>
     207
    167208        <?php submit_button(__('Save Settings', 'connect-plus-for-woocommerce')); ?>
    168209    </form>
  • connect-plus-for-woocommerce/trunk/connect-plus-for-woocommerce.php

    r3300805 r3321453  
    1717 * Plugin URI:        https://website.olivery.app/
    1818 * Description:       Plugin to help you connect WooCommerce with Connect Plus application
    19  * Version:           1.0.23
     19 * Version:           1.0.24
    2020 * Author:            Olivery dev
    2121 * Text Domain:       connect-plus-for-woocommerce
     
    4040define('CPFW_PLUGIN_DIR', __DIR__);
    4141
    42 define('PLUGIN_VERSION','1.0.23');
     42define('PLUGIN_VERSION','1.0.24');
    4343/**
    4444 * The code that runs during plugin activation.
  • connect-plus-for-woocommerce/trunk/includes/services/cpfw-connect-api.php

    r3277959 r3321453  
    145145        // for paid
    146146        $cpfw_is_paid = false;
    147         $cpfw_payment_method = $cpfw_the_order->get_payment_method();
    148         $cpfw_payment_method_title = $cpfw_the_order->get_payment_method_title();
    149         if (strpos($cpfw_payment_method, "montypay_payment_gateway") !== false ) {
     147        $cpfw_payment_method = strtolower(trim($cpfw_the_order->get_payment_method())); // slug
     148        $cpfw_payment_method_title = strtolower(trim($cpfw_the_order->get_payment_method_title())); //title
     149        $paid_methods = get_option('olivery_connect_paid_methods', []);
     150        $paid_methods_lower = array_map('strtolower', $paid_methods);
     151
     152        // 1. Special handling for MontyPay
     153        if (strpos($cpfw_payment_method, 'montypay_payment_gateway') !== false) {
    150154            $cpfw_is_paid = true;
     155        // 2. If both slug and title are empty (possible N/A)
     156        } elseif ($cpfw_payment_method === '' && $cpfw_payment_method_title === '') {
     157            if (in_array('n/a', $paid_methods_lower, true)) {
     158                $cpfw_is_paid = true;
     159            }
     160        // 3. Exact match by slug
     161        } elseif (in_array($cpfw_payment_method, $paid_methods_lower, true)) {
     162            $cpfw_is_paid = true;
     163        // 4. Exact match by title
     164        } elseif (in_array($cpfw_payment_method_title, $paid_methods_lower, true)) {
     165            $cpfw_is_paid = true;
     166        // 5. Loose title match
     167        } else {
     168            foreach ($paid_methods_lower as $method_slug_or_title) {
     169                if (strpos($cpfw_payment_method_title, $method_slug_or_title) !== false) {
     170                    $cpfw_is_paid = true;
     171                    break;
     172                }
     173            }
    151174        }
    152175
  • connect-plus-for-woocommerce/trunk/languages/connect-plus-for-woocommerce.pot

    r3300805 r3321453  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Connect Plus for WooCommerce 1.0.23\n"
     5"Project-Id-Version: Connect Plus for WooCommerce 1.0.24\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/connect-plus-for-woocommerce\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
Note: See TracChangeset for help on using the changeset viewer.