Ejemplo n.º 1
0
 * @package Cocoro
 */
$cardNo = get_cimyFieldValue($current_user->ID, "CARD_NO");
$firstName = get_cimyFieldValue($current_user->ID, "FIRST_NAME");
$lastName = get_cimyFieldValue($current_user->ID, "LAST_NAME");
get_header();
?>

		<main id="main" class="site-main" role="main">
			<header class="entry-header">
				<h1 class="entry-title">User profile page</h1>
			</header>
			<div class="entry-content">
				<?php 
if (is_user_logged_in()) {
    $royaltyCardAPI = new royaltyCardAPI();
    $balance = $royaltyCardAPI->getCardInfo($cardNo);
    ?>
					<p>Royalty point balance : <?php 
    echo $balance;
    ?>
</p>

					<?php 
    global $current_user;
    get_currentuserinfo();
    ?>
					<p>Name: <?php 
    echo $firstName . ' ' . $lastName;
    ?>
</p>
Ejemplo n.º 2
0
function addRoyaltyPoint($order_id)
{
    if (!get_current_user_id()) {
        return false;
    }
    $order = new WC_Order($order_id);
    $subtotal = $order->get_subtotal();
    $pointsAdjustment = $subtotal - $order->cart_discount;
    $cardNo = get_cimyFieldValue(get_current_user_id(), 'CARD_NO');
    $userInfo = array("CARD_NO" => $cardNo, "PLUS_POINT" => number_format($pointsAdjustment, 2));
    $royaltyCardAPI = new royaltyCardAPI();
    $rtnIncrementPoints = $royaltyCardAPI->incrementPoints($userInfo);
    if ($rtnIncrementPoints == 'SUCCESS') {
        //echo 'aaaa';
    } else {
        return new WP_Error(444, $rtnIncrementPoints);
    }
}