From 77c84ba1f36bc3f52be69f945adf8e0729a9a092 Mon Sep 17 00:00:00 2001 From: dewalt201 Date: Fri, 25 Aug 2017 17:24:16 +0300 Subject: [PATCH] Fix for payment types ,in admin interface (#13) --- retailcrm/include/class-wc-retailcrm-base.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/retailcrm/include/class-wc-retailcrm-base.php b/retailcrm/include/class-wc-retailcrm-base.php index f9002ef..e7286b7 100644 --- a/retailcrm/include/class-wc-retailcrm-base.php +++ b/retailcrm/include/class-wc-retailcrm-base.php @@ -26,7 +26,7 @@ if ( ! class_exists( 'WC_Retailcrm_Base' ) ) : if ( ! class_exists( 'WC_Retailcrm_Proxy' ) ) { include_once( __DIR__ . '/api/class-wc-retailcrm-proxy.php' ); } - + $this->id = 'integration-retailcrm'; $this->method_title = __( 'RetailCRM', 'woocommerce-integration-retailcrm' ); $this->method_description = __( 'Интеграция с системой управления Retailcrm.', 'woocommerce-integration-retailcrm' ); @@ -141,7 +141,6 @@ if ( ! class_exists( 'WC_Retailcrm_Base' ) ) : } $wc_payment = new WC_Payment_Gateways(); - $wc_payment_list = $wc_payment->get_available_payment_gateways(); $this->form_fields[] = array( 'title' => __( 'Способы оплаты', 'woocommerce' ), @@ -150,7 +149,7 @@ if ( ! class_exists( 'WC_Retailcrm_Base' ) ) : 'id' => 'payment_options' ); - foreach ( $wc_payment_list as $payment ) { + foreach ( $wc_payment->payment_gateways as $payment ) { if ( isset( $payment->enabled ) && $payment->enabled == 'yes' ) { $key = $payment->id; $name = $key; @@ -230,7 +229,7 @@ if ( ! class_exists( 'WC_Retailcrm_Base' ) ) : 'description' => '', 'id' => 'upload_options' ); - + $this->form_fields['upload-button'] = array( 'label' => 'Выгрузить', 'title' => __( 'Выгрузка клиентов и заказов', 'woocommerce-integration-retailcrm' ), @@ -283,12 +282,12 @@ if ( ! class_exists( 'WC_Retailcrm_Base' ) ) : ); $response = $api->deliveryTypesList(); - + if (isset($response['errorMsg']) && $response['errorMsg'] == 'API method not found') { WC_Admin_Settings::add_error( esc_html__( '"Выбранная версия API недоступна"', 'woocommerce-integration-retailcrm' ) ); } else { return $value; - } + } } public function validate_api_url_field( $key, $value ) { @@ -299,7 +298,7 @@ if ( ! class_exists( 'WC_Retailcrm_Base' ) ) : ); $response = $api->deliveryTypesList(); - + if ($response == NULL) { WC_Admin_Settings::add_error( esc_html__( '"Введите корректный адрес CRM"', 'woocommerce-integration-retailcrm' ) ); } else {