Plugin Directory

Changeset 2629209


Ignore:
Timestamp:
11/13/2021 07:28:31 PM (4 years ago)
Author:
casepress
Message:

wooms 8.4

Location:
wooms/trunk
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • wooms/trunk/functions.php

    r2418704 r2629209  
    140140  }
    141141}
     142
     143/**
     144 * Checking if wooms meta is unique and deleting if it is duplicated in save_post action
     145 *
     146 * @param int     $post_ID Post ID.
     147 * @param WP_Post $post    Post object.
     148 * @param bool    $update  Whether this is an existing post being updated.
     149 *
     150 * @return void
     151 *
     152 * @link https://github.com/wpcraft-ru/wooms/issues/409
     153 */
     154function wooms_id_check_if_unique($post_ID, $post = '', $update = '') {
     155
     156    if (!$post_ID || !is_numeric($post_ID)) {
     157        return;
     158    }
     159
     160    $uuid = get_post_meta($post_ID, 'wooms_id', true);
     161
     162    if (!$uuid) {
     163        return;
     164    }
     165
     166    $basic_args = array(
     167        'post_type'              => array('product', 'product_variation'),
     168        'numberposts'            => -1,
     169        'post_status'            => 'any',
     170        'orderby'                => 'ID',
     171        'order'                  => 'ASC',
     172        'update_post_term_cache' => false,
     173        'update_post_meta_cache' => false,
     174        'cache_results'          => false,
     175    );
     176
     177    $products_args = array(
     178        'meta_key'   => 'wooms_id',
     179        'meta_value' => $uuid
     180    );
     181
     182    $args = array_merge($basic_args, $products_args);
     183
     184    $products = get_posts($args);
     185
     186    $ids = [];
     187
     188    if (count($products) > 1) {
     189
     190        foreach ($products as $key => $product) {
     191
     192            if ($key > 0) {
     193
     194                $ids[] = $product->ID;
     195            }
     196        }
     197    }
     198
     199    if (empty($ids)) {
     200        return;
     201    }
     202   
     203    /* Selecting all child variations */
     204    $variations_args = array(
     205        'post_parent__in' => $ids,
     206    );
     207
     208    $args = array_merge($basic_args, $variations_args);
     209
     210    $variations = get_posts($args);
     211
     212    foreach ($variations as $variation) {
     213
     214        $ids[] = $variation->ID;
     215    }
     216
     217    foreach ($ids as $id) {
     218
     219        $meta_values = get_post_meta( $id );
     220
     221        foreach ($meta_values as $key => $values) {
     222            if (preg_match('/^wooms_/',  $key)) {
     223                delete_post_meta($id, $key);
     224            }
     225        }
     226    }
     227
     228    do_action(
     229        'wooms_logger',
     230        $type = 'WooMS-Request',
     231        $title =  sprintf('Дубли meta-полей wooms для товаров и вариаций (%s) удалены', implode(', ', $ids))
     232    );
     233}
  • wooms/trunk/inc/ProductsWalker.php

    r2429596 r2629209  
    7171    self::add_setting_wooms_batch_size();
    7272    self::add_setting_short_description();
     73
     74    do_action('wooms_add_settings');
    7375  }
    7476
  • wooms/trunk/readme.txt

    r2517682 r2629209  
    44Tags: moysklad, woocommerce, sync, integration
    55Requires at least: 4.0
    6 Tested up to: 5.3
     6Tested up to: 5.8
    77Stable tag: 4.3
    88Requires PHP: 5.6
     
    7272= Какие минимальные требования? =
    7373
    74 WordPress 4.5
     74WordPress 5.0
    7575WooCommerce 3.0 - мб будет работать на Woo 2.х но не факт.
    7676PHP 5.6
     
    8484
    8585== Changelog ==
     86
     87= 8.4 =
     88- Проверка совместимости с WooCommerce 5.8
     89- Исправление проблем с деплоем
     90
     91= 8.3 =
     92- Проверка совместимости с WooCommerce 5.6
     93- Исправление ошибок
     94
    8695
    8796= 8.2 =
     
    95104- Краткое описание товара вместо полного как опция https://github.com/wpcraft-ru/wooms/issues/347
    96105- XT: При создании нового контрагента - нет email https://github.com/wpcraft-ru/wooms/issues/346
     106* Тест плагинов с новыми версиями WordPress и WooCommerce https://github.com/wpcraft-ru/wooms/issues/396
     107* [XT] Публикация решения для отображения остатков со множества складов через ACF https://github.com/wpcraft-ru/wooms/issues/327
     108* [XT] Публикация решения для передачи склада в заказе через методы доставки https://github.com/wpcraft-ru/wooms/issues/327
    97109
    98110= 8.0 =
  • wooms/trunk/wooms.php

    r2517682 r2629209  
    1212 * License: GPLv2 or later
    1313 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
    14  * WC requires at least: 4.0
    15  * WC tested up to: 5.2.0
     14 *
    1615 * PHP requires at least: 5.6
     16 * WC requires at least: 5.0
     17 * WC tested up to: 5.9
    1718 * WP requires at least: 5.0
    18  * Tested up to: 5.7
    19  * WooMS XT Latest: 8.2
    20  * Version: 8.2
     19 * Tested up to: 5.8.1
     20 * WooMS XT Latest: 8.5
     21 *
     22 * Version: 8.5
    2123 */
    2224
     
    9698      require_once __DIR__ . '/inc/MenuSettings.php';
    9799      require_once __DIR__ . '/inc/MenuTools.php';
     100           
     101      require_once __DIR__ . '/inc/MetaColumn.php';
    98102
    99103     
     
    130134
    131135    add_action('init', [__CLASS__, 'delete_old_schedules']);
     136    add_action('save_post', 'wooms_id_check_if_unique', 10, 3);
     137    add_action('admin_enqueue_scripts', array(__CLASS__,  'admin_styles'));
     138
    132139  }
    133140
     
    297304  }
    298305
     306  /**
     307   * Styles for Dashboard
     308   *
     309   * @return void
     310   */
     311  public static function admin_styles() {
     312
     313    $admin_style = plugin_dir_url( __FILE__ ) . 'css/admin.css';
     314
     315    wp_enqueue_style( 'wooms_styles', $admin_style, array() );
     316
     317  }
    299318}
    300319
Note: See TracChangeset for help on using the changeset viewer.