2016-11-21 72 views
0

我想添加自定義圖標到我的支付網關。我已經閱讀了WOO網關API,並沒有任何幫助。這是我的代碼如下。請幫助我找到包含圖標的功能方式,以便在前端有一個圖標。由於將圖標添加到自定義woocommerce支付網關

<?php if (! defined('ABSPATH')) { exit; } 

add_filter('woocommerce_payment_gateways', 'init_wpuw_gateway'); 
function init_wpuw_gateway ($methods) 
{ 
    $methods[] = 'WC_Gateway_WPUW'; 
    return $methods; 
} 


if(class_exists('WC_Payment_Gateway')): 
class WC_Gateway_WPUW extends WC_Payment_Gateway { 

    /** 
    * Constructor for the gateway. 
    */ 
    public function __construct() { 

     $plugin_dir = plugin_dir_url(__FILE__); 

     $this->id     = 'wpuw'; 

     //If you want to show an image next to the gateway’s name on the frontend, enter a URL to an image. 
     $this->icon    = apply_filters('woocommerce_gateway_icon', ''.$plugin_dir.'/assets/paysecure.png'); 
     $this->method_title  = __('User Wallet', 'woocommerce'); 
     $this->method_description = __('Have your customers pay with their user wallet balance.', 'woocommerce'); 
     $this->has_fields   = false; 

回答

0

用反斜槓代替斜線嘗試不與可變$plugin_dir

$this->icon = apply_filters('woocommerce_gateway_icon', $plugin_dir.'\assets\paysecure.png'); 
串聯初始空字符串