2016-07-04 4 views
2

woocommerce/includes/bacs/class-wc-gateway-bacs.phpmytheme/includes/bacs/class-wc-gateway-bacs.php에 템플릿 파일과 같이 바꿀 수 있습니까? 이 순간에 나는 플러그인 코어에서 코드를 변경했지만 업데이트 후에는 다시 변경됩니다.Woocommerce BACS 지불 게이트웨이 계좌 정보 수정

또는 어쩌면 누군가가 function.php 후크 또는 이와 비슷한 파일에서 어떻게 해야할지 알고 있을까요? ,

/** 
* Get bank details and place into a list format. 
* 
* @param int $order_id 
*/ 
private function bank_details($order_id = '') { 

    if (empty($this->account_details)) { 
     return; 
    } 

    // Get order and store in $order 
    $order  = wc_get_order($order_id); 

    // Get the order country and country $locale 
    $country = $order->billing_country; 
    $locale  = $this->get_country_locale(); 

    // Get sortcode label in the $locale array and use appropriate one 
    $sortcode = isset($locale[ $country ]['sortcode']['label']) ? $locale[ $country ]['sortcode']['label'] : __('Sort Code', 'woocommerce'); 

    $bacs_accounts = apply_filters('woocommerce_bacs_accounts', $this->account_details); 

    if (! empty($bacs_accounts)) { 
     echo '<h2 class="wc-bacs-bank-details-heading">' . __('Our Bank Details', 'woocommerce') . '</h2>' . PHP_EOL; 

     foreach ($bacs_accounts as $bacs_account) { 

      $bacs_account = (object) $bacs_account; 

      if ($bacs_account->account_name || $bacs_account->bank_name) { 
       echo '<h3>' . wp_unslash(implode(' - ', array_filter(array($bacs_account->account_name, $bacs_account->bank_name)))) . '</h3>' . PHP_EOL; 
      } 

      echo '<ul class="wc-bacs-bank-details order_details bacs_details">' . PHP_EOL; 

      // BACS account fields shown on the thanks page and in emails 
      $account_fields = apply_filters('woocommerce_bacs_account_fields', array(
       'account_number'=> array(
        'label' => __('Account Number', 'woocommerce'), 
        'value' => $bacs_account->account_number 
       ), 
       'sort_code'  => array(
        'label' => $sortcode, 
        'value' => $bacs_account->sort_code 
       ), 
       'iban'   => array(
        'label' => __('IBAN', 'woocommerce'), 
        'value' => $bacs_account->iban 
       ), 
       'bic'   => array(
        'label' => __('BIC', 'woocommerce'), 
        'value' => $bacs_account->bic 
       ) 
      ), $order_id); 

      foreach ($account_fields as $field_key => $field) { 
       if (! empty($field['value'])) { 
        echo '<li class="' . esc_attr($field_key) . '">' . esc_attr($field['label']) . ': <strong>' . wptexturize($field['value']) . '</strong></li>' . PHP_EOL; 
       } 
      } 

      echo '</ul>'; 
     } 
    } 

} 
난 정말이 도움이 필요

+1

, 설정 해제 있다면 내 영어에 대한 워드 프레스 :

Full code example fiddle(sorry for jsfiddle)

<?php /* Plugin Name: Custom Payment Gateway Description: Custom payment gateway Author: Baivaras */ if (! defined('ABSPATH')) { exit; // Exit if accessed directly } /** * Custom Payment Gateway. * * Provides a Custom Payment Gateway, mainly for testing purposes. */ add_action('plugins_loaded', 'init_custom_gateway_class'); function init_custom_gateway_class(){ class WC_Gateway_Custom extends WC_Payment_Gateway { public $domain; /* class-wc-gateway-bacs.php from public function __construct CODE GOES HERE */ } } add_filter('woocommerce_payment_gateways', 'add_custom_gateway_class'); function add_custom_gateway_class($methods) { $methods[] = 'WC_Gateway_Custom'; return $methods; } 

죄송에서 활성화 첫 번째 Bacs 결제 방법 ... Google에서 "BACS를 설정 해제하는 방법"또는 "woocommerce 설정되지 않은 결제 방법"및 "woocommerce 맞춤 결제 방법"과 같은 검색어를 검색합니다. 그런 다음 class-wc-gateway-bacs.php에서 몇 가지 코드를 선택할 수 있습니다. 단지 제안입니다. – LoicTheAztec

+0

감사합니다, 당신은 내게 올바른 길을 주셨습니다. 비슷한 기능을 가진 플러그인을 만들었지 만 다른 변수는 현재 작동 중입니다.) @LoicTheAztec – Baivaras

+1

@LoicTheAztec Done. 정확히 설명하는 방법을 모르지만 최선을 다했습니다. – Baivaras

답변

1

문제가 해결 :) 사전에 감사합니다 :

나는이 기능을 변경해야

난 그냥 여분 만든 파일 filename.php, 삽입 후크 + 기본값 woocommerce/includes/bacs/class-wc-gateway-bacs.php 코드, $this->id = 'bacs';$this->id = 'YOUR ID NAME';으로 변경하고 모든 변수를 "bacs"으로 변경했습니다. o "YOUR ID NAME". 이 파일은 플러그인 폴더로 이동하고 뭔가 잘못 : 사용자 정의 지불 방법을 생성하지 않는 이유는