diff --git a/retailcrm/include/class-wc-retailcrm-base.php b/retailcrm/include/class-wc-retailcrm-base.php index 3a47726..f52e111 100644 --- a/retailcrm/include/class-wc-retailcrm-base.php +++ b/retailcrm/include/class-wc-retailcrm-base.php @@ -191,22 +191,59 @@ if ( ! class_exists( 'WC_Retailcrm_Base' ) ) : 'description' => 'Отметьте данный пункт, если хотите выгружать остатки товаров из CRM в магазин.' ); - $this->form_fields[] = array( - 'title' => __( 'Настройки выгрузки', 'woocommerce' ), - 'type' => 'title', - 'description' => '', - 'id' => 'upload_options' - ); + $options = array_filter(get_option( 'woocommerce_integration-ecomlogic_settings' )); - $this->form_fields['uploadToCrm'] = array( - 'label' => __( 'Выгрузить все заказы и клиентов', 'textdomain' ), - 'title' => 'Выгрузка заказов и клиентов', - 'class' => 'checkbox', - 'type' => 'checkbox', - 'description' => 'Поставьте галочку, и нажмите сохранить, чтобы выгрузить все существующие заказы и клиентов.' - ); + if (!isset($options['uploads'])) { + $this->form_fields[] = array( + 'title' => __( 'Выгрузка клиентов и заказов', 'woocommerce' ), + 'type' => 'title', + 'description' => '', + 'id' => 'upload_options' + ); + + $this->form_fields['upload-button'] = array( + 'label' => 'Выгрузить', + 'title' => __( 'Выгрузка клиентов и заказов', 'woocommerce-integration-ecomlogic' ), + 'type' => 'button', + 'description' => __( 'Пакетная выгрузка существующих клиентов и заказов.', 'woocommerce-integration-ecomlogic' ), + 'desc_tip' => true, + 'id' => 'uploads-ecomlogic' + ); + } } } + + public function generate_button_html( $key, $data ) { + $field = $this->plugin_id . $this->id . '_' . $key; + $defaults = array( + 'class' => 'button-secondary', + 'css' => '', + 'custom_attributes' => array(), + 'desc_tip' => false, + 'description' => '', + 'title' => '', + ); + + $data = wp_parse_args( $data, $defaults ); + + ob_start(); + ?> +