2016-11-21 65 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'); 
串联初始空字符串