本文整理汇总了PHP中wc_get_order_id_by_order_key函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_order_id_by_order_key函数的具体用法?PHP wc_get_order_id_by_order_key怎么用?PHP wc_get_order_id_by_order_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_get_order_id_by_order_key函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_paypal_order
/**
* Get the order from the PayPal 'Custom' variable
*
* @param string $raw_custom JSON Data passed back by PayPal
* @return bool|WC_Order object
*/
protected function get_paypal_order($raw_custom)
{
// We have the data in the correct format, so get the order
if (($custom = json_decode($raw_custom)) && is_object($custom)) {
$order_id = $custom->order_id;
$order_key = $custom->order_key;
// Fallback to serialized data if safe. This is @deprecated in 2.3.11
} elseif (preg_match('/^a:2:{/', $raw_custom) && !preg_match('/[CO]:\\+?[0-9]+:"/', $raw_custom) && ($custom = maybe_unserialize($raw_custom))) {
$order_id = $custom[0];
$order_key = $custom[1];
// Nothing was found
} else {
WC_Gateway_Paypal::log('Error: Order ID and key were not found in "custom".');
return false;
}
if (!($order = wc_get_order($order_id))) {
// We have an invalid $order_id, probably because invoice_prefix has changed
$order_id = wc_get_order_id_by_order_key($order_key);
$order = wc_get_order($order_id);
}
if (!$order || $order->order_key !== $order_key) {
WC_Gateway_Paypal::log('Error: Order Keys do not match.');
return false;
}
return $order;
}
示例2: get_paypal_order
/**
* Get the order from the PayPal 'Custom' variable
*
* @param string $custom
* @return bool|WC_Order object
*/
protected function get_paypal_order($custom)
{
$custom = maybe_unserialize($custom);
if (is_array($custom)) {
list($order_id, $order_key) = $custom;
if (!($order = wc_get_order($order_id))) {
// We have an invalid $order_id, probably because invoice_prefix has changed
$order_id = wc_get_order_id_by_order_key($order_key);
$order = wc_get_order($order_id);
}
if (!$order || $order->order_key !== $order_key) {
$this->log('Error: Order Keys do not match.');
return false;
}
} elseif (!($order = apply_filters('woocommerce_get_paypal_order', false, $custom))) {
$this->log('Error: Order ID and key were not found in "custom".');
return false;
}
return $order;
}
示例3: get_paypal_order
/**
* Get the order from the PayPal 'Custom' variable.
*
* @param string $raw_custom JSON Data passed back by PayPal
* @return bool|WC_Order Order object or false
*/
protected function get_paypal_order($raw_custom)
{
// We have the data in the correct format, so get the order.
if (($custom = json_decode($raw_custom)) && is_object($custom)) {
$order_id = $custom->order_id;
$order_key = $custom->order_key;
} else {
wc_gateway_ppec_log(sprintf('%s: %s', __FUNCTION__, 'Error: Order ID and key were not found in "custom".'));
return false;
}
if (!($order = wc_get_order($order_id))) {
// We have an invalid $order_id, probably because invoice_prefix has changed.
$order_id = wc_get_order_id_by_order_key($order_key);
$order = wc_get_order($order_id);
}
if (!$order || $order->order_key !== $order_key) {
wc_gateway_ppec_log(sprintf('%s: %s', __FUNCTION__, 'Error: Order Keys do not match.'));
return false;
}
return $order;
}
示例4: coinsimple_callback
/**
* Notification callback.
*
* @param void
* @return void
*/
public function coinsimple_callback()
{
// obtain body
@ob_clean();
$body = file_get_contents('php://input');
$data = json_decode($body);
$business = new \CoinSimple\Business($this->get_option("business_id"), $this->get_option('api_key'));
if (!$business->validateHash($data->hash, $data->timestamp)) {
$this->debug(__METHOD__, 'invalid callback hash');
return;
}
$order = new WC_Order($data->custom->order_id);
if (!isset($order->id)) {
// orderId invalid, try alternate find
$orderId = wc_get_order_id_by_order_key($data->custom->order_key);
$order = new WC_Order($orderId);
}
if ($order->order_key !== $data->custom->order_key) {
$this->debug(__METHOD__, 'invalid order key');
return;
}
$order->payment_complete();
}
示例5: woocommerce_get_order_id_by_order_key
/**
* @deprecated
*/
function woocommerce_get_order_id_by_order_key($order_key)
{
return wc_get_order_id_by_order_key($order_key);
}
示例6: check_payment_response
public static function check_payment_response()
{
if (!empty($_REQUEST['imp_uid'])) {
//결제승인 결과조회
require_once WSKL_PATH . '/includes/lib/iamport/iamport.php';
$imp_uid = $_REQUEST['imp_uid'];
$rest_key = wskl_get_option('iamport_rest_key');
$rest_secret = wskl_get_option('iamport_rest_secret');
$iamport = new Iamport($rest_key, $rest_secret);
$result = $iamport->findByImpUID($imp_uid);
if ($result->success) {
$payment_data = $result->data;
if (empty($_REQUEST['order_id'])) {
//call by iamport notification
$order_id = wc_get_order_id_by_order_key($payment_data->merchant_uid);
} else {
$order_id = $_REQUEST['order_id'];
}
$order = wc_get_order($order_id);
update_post_meta($order_id, '_iamport_provider', $payment_data->pg_provider);
update_post_meta($order_id, '_iamport_paymethod', $payment_data->pay_method);
update_post_meta($order_id, '_iamport_receipt_url', $payment_data->receipt_url);
if ($payment_data->status == 'paid') {
if ($order->order_total == $payment_data->amount) {
if (!$order->has_status(array('processing', 'completed'))) {
$order->payment_complete($payment_data->imp_uid);
//imp_uid
wp_redirect($order->get_checkout_order_received_url());
return;
}
} else {
$order->add_order_note('요청하신 결제금액이 다릅니다.');
wc_add_notice('요청하신 결제금액이 다릅니다.', 'error');
}
} else {
if ($payment_data->status == 'ready') {
if ($payment_data->pay_method == 'vbank') {
$vbank_name = $payment_data->vbank_name;
$vbank_num = $payment_data->vbank_num;
$vbank_date = $payment_data->vbank_date;
//가상계좌 입금할 계좌정보 기록
update_post_meta($order_id, '_iamport_vbank_name', $vbank_name);
update_post_meta($order_id, '_iamport_vbank_num', $vbank_num);
update_post_meta($order_id, '_iamport_vbank_date', $vbank_date);
//가상계좌 입금대기 중
$order->update_status('awaiting-vbank', __('가상계좌 입금대기 중', 'iamport'));
wp_redirect($order->get_checkout_order_received_url());
return;
} else {
$order->add_order_note('실제 결제가 이루어지지 않았습니다.');
wc_add_notice('실제 결제가 이루어지지 않았습니다.', 'error');
}
} else {
if ($payment_data->status == 'failed') {
$order->add_order_note('결제요청 승인에 실패하였습니다.');
wc_add_notice('결제요청 승인에 실패하였습니다.', 'error');
}
}
}
} else {
$payment_data =& $result->data;
if (!empty($_REQUEST['order_id'])) {
$order = new WC_Order($_REQUEST['order_id']);
$order->update_status('failed');
$order->add_order_note('결제승인정보를 받아오지 못했습니다. 관리자에게 문의해주세요' . $payment_data->error['message']);
wc_add_notice($payment_data->error['message'], 'error');
$redirect_url = $order->get_checkout_payment_url(TRUE);
wp_redirect($redirect_url);
}
}
}
}
示例7: woocommerce_pay_order_button_html
function woocommerce_pay_order_button_html($html)
{
$orderid = wc_get_order_id_by_order_key($_REQUEST['key']);
if ($_available_gateways = WC()->payment_gateways->get_available_payment_gateways()) {
if (isset($_available_gateways['inicis_card']) || isset($_available_gateways['inicis_bank']) || isset($_available_gateways['inicis_vbank']) || isset($_available_gateways['inicis_hpp']) || isset($_available_gateways['inicis_kpay']) || isset($_available_gateways['inicis_stdcard']) || isset($_available_gateways['inicis_escrow_bank'])) {
if (wp_is_mobile()) {
wp_register_script('ifw-pay-for-order', $this->plugin_url() . '/assets/js/ifw_pay_for_order.mobile.js', array(), $this->version);
} else {
wp_register_script('ifw-pay-for-order', $this->plugin_url() . '/assets/js/ifw_pay_for_order.js', array(), $this->version);
}
wp_enqueue_script('ifw-pay-for-order');
wp_localize_script('ifw-pay-for-order', '_ifw_pay_for_order', array('ajax_loader_url' => $this->plugin_url() . '/assets/images/ajax_loader.gif', 'order_id' => $orderid, 'order_key' => $_REQUEST['key']));
}
}
return $html;
}
示例8: get_paypal_order
/**
* get_paypal_order function.
*
* @param string $custom
* @param string $invoice
* @return WC_Order object
*/
private function get_paypal_order($custom, $invoice = '')
{
$custom = maybe_unserialize($custom);
// Backwards comp for IPN requests
if (is_numeric($custom)) {
$order_id = (int) $custom;
$order_key = $invoice;
} elseif (is_string($custom)) {
$order_id = (int) str_replace($this->invoice_prefix, '', $custom);
$order_key = $custom;
} else {
list($order_id, $order_key) = $custom;
}
$order = new WC_Order($order_id);
if (!isset($order->id)) {
// We have an invalid $order_id, probably because invoice_prefix has changed
$order_id = wc_get_order_id_by_order_key($order_key);
$order = new WC_Order($order_id);
}
// Validate key
if ($order->order_key !== $order_key) {
if ('yes' == $this->debug) {
$this->log->add('paypal', 'Error: Order Key does not match invoice.');
}
exit;
}
return $order;
}
示例9: generate_form
private function generate_form($order, $URL_Request)
{
$order_key = $_GET['key'];
$order_id = wc_get_order_id_by_order_key($order_key);
return '<a class="button" href="' . get_site_url() . '/?TodoPago_redirect=true&form=ext&order=' . $order_id . '" id="submit_todopago_payment_form"> Pagar con TodoPago </a>
<a class="button cancel" href="' . $order->get_cancel_order_url() . '">' . ' Cancelar orden ' . '</a>';
}
示例10: thankyou_page
/**
* Return page of Alipay, show Alipay Trade No.
*
* @access public
* @param mixed Sync Notification
* @return void
*/
function thankyou_page($order_id)
{
$_GET = stripslashes_deep($_GET);
if (isset($_GET['trade_status']) && !empty($_GET['trade_status'])) {
require_once "lib/alipay_notify.class.php";
$aliapy_config = $this->get_alipay_config();
$alipayNotify = new AlipayNotify($aliapy_config);
$order_key = $_GET['key'];
// Delete parameters added by WC from $_GET
if (isset($_GET['page_id'])) {
unset($_GET['page_id']);
}
// When using default permlaink format
if (isset($_GET['order-received'])) {
unset($_GET['order-received']);
}
// When using default permlaink format
unset($_GET['order']);
unset($_GET['key']);
if ($this->debug == 'yes') {
$log = true;
}
$verify_result = $alipayNotify->verifyReturn($log);
if ($verify_result) {
$trade_no = $_GET['trade_no'];
// Alipay Order Number
$out_trade_no = $_GET['out_trade_no'];
// Merchant Order Number
// Check order ID
if (is_numeric($out_trade_no)) {
if (!empty($this->order_prefix)) {
$check = (int) str_replace($this->order_prefix, '', $out_trade_no);
} else {
$check = (int) $out_trade_no;
}
} else {
$check = (int) str_replace($this->order_prefix, '', $out_trade_no);
}
if ($order_id != $check) {
// We have an invalid $order_id, probably because order_prefix has changed
$check = wc_get_order_id_by_order_key($order_key);
if ($order_id != $check) {
_e("<p><strong>ERROR:</strong>The order ID doesn't match!</p>", 'alipay');
return;
}
}
// Order ID is correct.
$order = new WC_Order($order_id);
echo '<ul class="order_details">
<li class="alipayNo">' . __('Your Alipay Trade No.: ', 'alipay') . '<strong>' . $trade_no . '</strong></li>
</ul>';
// Update the order according to data carried with the return_url
$trade_status = $_GET['trade_status'];
switch ($trade_status) {
case 'WAIT_SELLER_SEND_GOODS':
$order_needs_updating = in_array($order->status, array('processing', 'completed')) ? false : true;
$status = apply_filters('woocommerce_alipay_payment_successful_status', 'processing', $order);
if ($order_needs_updating) {
// Update order status if IPN has not process the order
update_post_meta($order_id, 'Alipay Trade No.', wc_clean($trade_no));
$order->update_status($status, __("Payment received, awaiting fulfilment. ", 'alipay'));
// Send deliver notification to alipay if the order is vitural and downloadable.
$success = $this->send_goods_confirm(wc_clean($trade_no), $order);
if (strpos($success, 'error') !== false) {
// Failed to update status
if ('yes' == $this->debug) {
$message = sprintf(__('ERROR: Failed to send goods automatically for order %d, ', 'alipay'), $order_id);
$message .= $success;
$this->log->add('alipay', $message);
}
} else {
if ($success === true) {
$order->add_order_note(__('Your order has been shipped, awaiting buyer\'s confirmation', 'alipay'));
}
}
// Reduce stock level
$order->reduce_order_stock();
}
break;
case 'TRADE_FINISHED':
case 'TRADE_SUCCESS':
if ($order->status != 'completed' && $order->status != 'processing') {
$order->payment_complete();
}
update_post_meta($order_id, 'Alipay Trade No.', wc_clean($trade_no));
break;
default:
break;
}
}
}
}
示例11: wp_head
//.........这里部分代码省略.........
;
var woocs_default_currency = <?php
echo json_encode($currencies[$this->default_currency]);
?>
;
var woocs_array_of_get = '{}';
<?php
if (!empty($_GET)) {
?>
<?php
//sanitization of $_GET array
$sanitized_get_array = array();
foreach ($_GET as $key => $value) {
$sanitized_get_array[$this->escape($key)] = $this->escape($value);
}
?>
woocs_array_of_get = '<?php
echo str_replace("'", "", json_encode($sanitized_get_array));
?>
';
<?php
}
?>
woocs_array_no_cents = '<?php
echo json_encode($this->no_cents);
?>
';
var woocs_ajaxurl = "<?php
echo admin_url('admin-ajax.php');
?>
";
var woocs_lang_loading = "<?php
_e('loading', 'woocommerce-currency-switcher');
?>
";
var woocs_shop_is_cached =<?php
echo (int) $this->shop_is_cached;
?>
;
</script>
<?php
if ($this->get_drop_down_view() == 'ddslick') {
wp_enqueue_script('jquery.ddslick.min', WOOCS_LINK . 'js/jquery.ddslick.min.js', array('jquery'));
}
if ($this->get_drop_down_view() == 'chosen' or $this->get_drop_down_view() == 'chosen_dark') {
wp_enqueue_script('chosen-drop-down', WOOCS_LINK . 'js/chosen/chosen.jquery.min.js', array('jquery'));
wp_enqueue_style('chosen-drop-down', WOOCS_LINK . 'js/chosen/chosen.min.css');
//dark chosen
if ($this->get_drop_down_view() == 'chosen_dark') {
wp_enqueue_style('chosen-drop-down-dark', WOOCS_LINK . 'js/chosen/chosen-dark.css');
}
}
if ($this->get_drop_down_view() == 'wselect') {
wp_enqueue_script('woocs_wselect', WOOCS_LINK . 'js/wselect/wSelect.min.js', array('jquery'));
wp_enqueue_style('woocs_wselect', WOOCS_LINK . 'js/wselect/wSelect.css');
}
//+++
wp_enqueue_style('woocommerce-currency-switcher', WOOCS_LINK . 'css/front.css');
wp_enqueue_script('woocommerce-currency-switcher', WOOCS_LINK . 'js/front.js', array('jquery'));
//+++
//trick for refreshing header cart after currency changing - code left just for history
if (isset($_GET['currency'])) {
//wp-content\plugins\woocommerce\includes\class-wc-cart.php
//apply_filters('woocommerce_update_cart_action_cart_updated', true);
//$this->current_currency = $_GET['currency'];
//$_POST['update_cart'] = 1;
//WC_Form_Handler::update_cart_action();
//private function set_cart_cookies
//wc_setcookie('woocommerce_items_in_cart', 0, time() - HOUR_IN_SECONDS);
//wc_setcookie('woocommerce_cart_hash', '', time() - HOUR_IN_SECONDS);
//do_action('woocommerce_cart_reset', WC()->cart, true);
//do_action('woocommerce_calculate_totals', WC()->cart);
}
//if customer paying pending order from the front
//checkout/order-pay/1044/?pay_for_order=true&key=order_55b764a4b7990
if (isset($_GET['pay_for_order']) and is_checkout_pay_page()) {
if ($_GET['pay_for_order'] == 'true' and isset($_GET['key'])) {
$order_id = wc_get_order_id_by_order_key($_GET['key']);
$currency = get_post_meta($order_id, '_order_currency', TRUE);
$this->current_currency = $currency;
$this->storage->set_val('woocs_current_currency', $currency);
}
}
//+++
//if we want to be paid in the basic currency - not multiple mode
if (!$this->is_multiple_allowed) {
if (is_checkout() or is_checkout_pay_page()) {
$this->reset_currency();
}
}
//logic hack for some cases when shipping for example is wrong in
//non multiple mode but customer doesn work allow pay in user selected currency
if ($this->is_multiple_allowed) {
if ((is_checkout() or is_checkout_pay_page()) and $this->bones['reset_in_multiple']) {
$this->reset_currency();
}
}
}
示例12: callback_payapp_status
/**
* AJAX 콜백. order key 에 대응해서 해당 order 의 주문 상태를 반환한다.
*
* 요구하는 파라미터: $_GET['order_key']
* JSON 응답:
* success: bool
* message: string success or 에러 메시지
* redirect: string 리다이렉트 주소
* order_id: int success=true 이면 order id
* order_status: string success=true 이면 order status 문자열.
* (pending|processing|completed)
*
* @action wc_ajax_{wskl-payapp-status}
*/
public static function callback_payapp_status()
{
if (!defined('DOING_AJAX') || !defined('WC_DOING_AJAX')) {
die(-1);
}
$order_key = isset($_GET['order_key']) ? sanitize_text_field($_GET['order_key']) : 0;
$order = wc_get_order(wc_get_order_id_by_order_key($order_key));
if (!$order) {
wc_add_notice(__('주문 과정에 문제가 발생했습니다. 다시 시도해 주세요.', 'wskl'), 'error');
wp_send_json(array('success' => FALSE, 'message' => 'An invalid order key received.', 'redirect' => wc_get_checkout_url()));
die;
}
if ($order->has_status(array('processing', 'completed'))) {
$redirect = $order->get_checkout_order_received_url();
} else {
$redirect = '';
}
wp_send_json(array('success' => TRUE, 'message' => 'success', 'order_id' => $order->id, 'order_status' => $order->get_status(), 'redirect' => $redirect));
die;
}
示例13: WC
dynx_pagetype: 'conversionintent',
dynx_totalvalue: <?php
echo WC()->cart->total;
?>
};
</script>
<?php
} elseif (is_order_received_page()) {
?>
<script type="text/javascript">
var google_tag_params = {
dynx_itemid: <?php
echo "[";
$order = new WC_Order(wc_get_order_id_by_order_key($_GET['key']));
$order_total = $order->get_total();
$items = $order->get_items();
$order_items = array();
foreach ((array) $items as $item) {
array_push($order_items, "'" . $item['product_id'] . "'");
}
echo implode(', ', $order_items);
echo "]";
?>
,
dynx_pagetype: 'conversion',
dynx_totalvalue: <?php
echo $order_total;
?>
示例14: wp_head
<!-- * WordPress wp_head() ********************************************** -->
<!-- ******************************************************************** -->
<?php
wp_head();
?>
</head>
<body <?php
body_class();
?>
>
<?php
if (is_wc_endpoint_url('order-received')) {
$order_id = wc_get_order_id_by_order_key($_GET['key']);
$order1 = new WC_order($order_id);
$order_items = array_values($order1->get_items());
$net_amount = $order_items[0]['line_subtotal'];
$tax_amount = $order_items[0]['line_subtotal_tax'];
$product_name = $order_items[0]['name'];
$product_id = $order_items[0]['product_id'];
$belboon = $_SESSION['belboon'];
$url_home = home_url();
?>
<img src="https://www1.belboon.de/adtracking/sale/000021772.gif/oc=<?php
echo $order_id;
?>
&sale=<?php
echo $net_amount;
?>
示例15: wp_head
public function wp_head()
{
wp_enqueue_script('jquery');
$currencies = $this->get_currencies();
?>
<script type="text/javascript">
var woocs_drop_down_view = "<?php
echo $this->get_drop_down_view();
?>
";
var woocs_current_currency = <?php
echo json_encode(isset($currencies[$this->current_currency]) ? $currencies[$this->current_currency] : $currencies[$this->default_currency]);
?>
;
var woocs_default_currency = <?php
echo json_encode($currencies[$this->default_currency]);
?>
;
var woocs_array_of_get = '{}';
<?php
if (!empty($_GET)) {
?>
woocs_array_of_get = '<?php
echo json_encode($_GET);
?>
';
<?php
}
?>
woocs_array_no_cents = '<?php
echo json_encode($this->no_cents);
?>
';
var woocs_ajaxurl = "<?php
echo admin_url('admin-ajax.php');
?>
";
var woocs_lang_loading = "<?php
_e('loading', 'woocommerce-currency-switcher');
?>
";
</script>
<?php
if ($this->get_drop_down_view() == 'ddslick') {
wp_enqueue_script('jquery.ddslick.min', WOOCS_LINK . 'js/jquery.ddslick.min.js', array('jquery'));
}
if ($this->get_drop_down_view() == 'chosen' or $this->get_drop_down_view() == 'chosen_dark') {
wp_enqueue_script('chosen-drop-down', WOOCS_LINK . 'js/chosen/chosen.jquery.min.js', array('jquery'));
wp_enqueue_style('chosen-drop-down', WOOCS_LINK . 'js/chosen/chosen.min.css');
//dark chosen
if ($this->get_drop_down_view() == 'chosen_dark') {
wp_enqueue_style('chosen-drop-down-dark', WOOCS_LINK . 'js/chosen/chosen-dark.css');
}
}
if ($this->get_drop_down_view() == 'wselect') {
wp_enqueue_script('woocs_wselect', WOOCS_LINK . 'js/wselect/wSelect.min.js', array('jquery'));
wp_enqueue_style('woocs_wselect', WOOCS_LINK . 'js/wselect/wSelect.css');
}
//+++
wp_enqueue_style('woocommerce-currency-switcher', WOOCS_LINK . 'css/front.css');
wp_enqueue_script('woocommerce-currency-switcher', WOOCS_LINK . 'js/front.js', array('jquery'));
//+++
//trick for refreshing header cart after currency changing - code left just for history
if (isset($_GET['currency'])) {
//wp-content\plugins\woocommerce\includes\class-wc-cart.php
//apply_filters('woocommerce_update_cart_action_cart_updated', true);
//$this->current_currency = $_GET['currency'];
//$_POST['update_cart'] = 1;
//WC_Form_Handler::update_cart_action();
//private function set_cart_cookies
//wc_setcookie('woocommerce_items_in_cart', 0, time() - HOUR_IN_SECONDS);
//wc_setcookie('woocommerce_cart_hash', '', time() - HOUR_IN_SECONDS);
//do_action('woocommerce_cart_reset', WC()->cart, true);
//do_action('woocommerce_calculate_totals', WC()->cart);
}
//if customer paying pending order from the front
//checkout/order-pay/1044/?pay_for_order=true&key=order_55b764a4b7990
if (isset($_GET['pay_for_order']) and is_checkout_pay_page()) {
if ($_GET['pay_for_order'] == 'true' and isset($_GET['key'])) {
$order_id = wc_get_order_id_by_order_key($_GET['key']);
$currency = get_post_meta($order_id, '_order_currency', TRUE);
$this->current_currency = $currency;
$this->storage->set_val('woocs_current_currency', $currency);
}
}
//+++
//if we want to be paid in the basic currency - not multiple mode
if (!$this->is_multiple_allowed) {
if (is_checkout() or is_checkout_pay_page()) {
$this->reset_currency();
}
}
}