我在我的wordpress网站上使用ccavenue付款网关。
插件网址为https://wordpress.org/plugins/ccavenue-payment-gateway-woocommerce/
但我遇到一个问题,我的基本货币是inr,ccavenue仅接受inr付款,因此当用户将货币切换为usd时, ccavenue将40美元作为inr40。
我想先将货币转换为ccavenue页。
相同的代码段是。
public function generate_ccavenue_form($order_id){
global $woocommerce;
$order = new WC_Order($order_id);
$redirect_url = ($this -> redirect_page_id=="" || $this -> redirect_page_id==0)?get_site_url() . "/":get_permalink($this -> redirect_page_id);
//For wooCoomerce 2.0
$redirect_url = add_query_arg( 'wc-api', get_class( $this ), $redirect_url );
$order_id = $order_id.'_'.date("ymds");
$checksum = $this -> getCheckSum($this -> merchant_id, $order->order_total, $order_id, $redirect_url, $this -> working_key);
$ccavenue_args = array(
'Merchant_Id' => $this -> merchant_id,
'Amount' => $order->order_total,
'Order_Id' => $order_id,
'Redirect_Url' => $redirect_url,
'Checksum' => $checksum,
'currency_code' => get_woocommerce_currency(), …Run Code Online (Sandbox Code Playgroud) 我有四个php变量,如:$abc, $bcd, $dsf, $gkg.现在我想用逗号分隔它们来连接它们.
输出:
abc,bcd,dsf,gkg
Run Code Online (Sandbox Code Playgroud)
现在,如果任何变量没有返回任何值..那么输出就像这样:
abc,,dsf,gkg
Run Code Online (Sandbox Code Playgroud)
那么如果任何变量的值为null,该怎么做才能避免这种情况?
$street = tribe_get_address( $event->ID );
$city = tribe_get_city( $event->ID );
$state = tribe_get_stateprovince($event->ID);
$country = tribe_get_country( $event->ID );
$zipcode = tribe_get_zip( $event->ID );
$fulladdress= concatenation of these variables..
Run Code Online (Sandbox Code Playgroud)