我正在为英国的旅行社制作一个wordpress项目,我的客户希望通过SagePay完成付款。我的问题如下:
我必须在每个订单上添加一个参考号和日期。所以我将自定义字段设置为此日期,并且应为每个日期插入一个参考编号。所以他们想把这个参考号放到“名字”字段中。
问题:如何从数据库中获取此引用号并用它替换firstname字段?
如果您使用的是woocommerce sagepay插件,则会有一个名为sagepay-form-class.php
的文件。 Firstname字段从第720行的数据库获取,因此我必须获取此引用号而不是名字。
默认行为:'BillingFirstnames' => $order->billing_first_name
,应该类似于:'BillingFirstnames' => get_this_refference_number_from_database
。
提前谢谢。
$sage_pay_args_array = array(
'VendorTxCode' => apply_filters( 'woocommerce_sagepayform_vendortxcode', $VendorTxCode, $order ),
'Amount' => $order->get_total(),
'Currency' => get_woocommerce_currency(),
'Description' => __( 'Order', 'woocommerce_sagepayform' ) . ' ' . str_replace( '#' , '' , $order->get_order_number() ),
'SuccessURL' => str_replace( 'https:', 'http:', $this->successurl ),
'FailureURL' => apply_filters( 'woocommerce_sagepayform_cancelurl' , html_entity_decode( $order->get_cancel_order_url() ), $order_id, $order->order_key ),
'CustomerName' => $order->billing_first_name . ' ' . $order->billing_last_name,
'CustomerEMail' => $order->billing_email,
'VendorEMail' => $this->email,
'SendEMail' => $this->sendemail,
'BillingFirstnames' => $order->billing_first_name,
// Billing Address info
'BillingSurname' => $order->billing_last_name,
'BillingAddress1' => $order->billing_address_1,
'BillingAddress2' => $order->billing_address_2,
'BillingCity' => $order->billing_city,
'BillingState' => $billing_state,
'BillingPostCode' => $order->billing_postcode,
'BillingCountry' => $order->billing_country,
'BillingPhone' => $order->billing_phone,
'CustomerEMail' => $order->billing_email,
// Shipping Address info
'DeliveryFirstnames'=> apply_filters( 'woocommerce_sagepay_form_deliveryfirstname', $order->shipping_first_name ),
'DeliverySurname' => apply_filters( 'woocommerce_sagepay_form_deliverysurname', $order->shipping_last_name ),
'DeliveryAddress1' => apply_filters( 'woocommerce_sagepay_form_deliveryaddress1', $order->shipping_address_1 ),
'DeliveryAddress2' => apply_filters( 'woocommerce_sagepay_form_deliveryaddress2', $order->shipping_address_2 ),
'DeliveryCity' => apply_filters( 'woocommerce_sagepay_form_deliverycity', $order->shipping_city ),
'DeliveryState' => apply_filters( 'woocommerce_sagepay_form_deliverystate', $shipping_state ),
'DeliveryPostCode' => apply_filters( 'woocommerce_sagepay_form_deliverypostcode', $order->shipping_postcode ),
'DeliveryCountry' => apply_filters( 'woocommerce_sagepay_form_deliverycountry', $order->shipping_country ),
'DeliveryPhone' => apply_filters( 'woocommerce_sagepay_form_deliveryphone', $order->billing_phone ),
// BASKET
'Basket' => strtr( $sage_pay_basket, $unwanted_array ),
// Settings
'AllowGiftAid' => $this->allow_gift_aid,
'ApplyAVSCV2' => $this->apply_avs_cv2,
'Apply3DSecure' => $this->apply_3dsecure,
// SurchargeXML
'surchargeXML' => $surchargexml,
'ReferrerID' => $this->referrerid
);