示例#1
0
文件: order.php 项目: pemiu01/UM
/**
 * Main Template of Ucenter & Market WordPress Plugin
 *
 * @package   Ucenter & Market
 * @version   1.0
 * @date      2015.4.9
 * @author    Zhiyan <*****@*****.**>
 * @site      Zhiyanblog <www.zhiyanblog.com>
 * @copyright Copyright (c) 2015-2015, Zhiyan
 * @license   http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
 * @link      http://www.zhiyanblog.com/wordpress-plugin-ucenter-and-market.html
**/
function um_order_popup()
{
    if (is_single() && get_post_type() == 'post') {
        $currency = get_post_meta(get_the_ID(), 'pay_currency', true);
        $discount_arr = product_smallest_price(get_the_ID());
        ?>
            <div id="order" class="popupbox">
                <form id="alipayment" name="alipayment" action="<?php 
        echo UM_URI . 'alipay/alipayapi.php';
        ?>
" method="post">
                    <div id="pay">
                        <div class="part-order">
                            <ul>
                                <h3><?php 
        _e('订单信息', 'um');
        ?>
<span><?php 
        _e('(价格单位:', 'um');
        if ($currency == 1) {
            echo '元';
        } else {
            echo '积分';
        }
        _e(')', 'um');
        ?>
</span></h3>
                                <input type="hidden" name="order_nonce" value="<?php 
        echo wp_create_nonce('order-nonce');
        ?>
" >
                                <input type = "hidden" id="product_id" name="product_id" readonly="" value="<?php 
        echo get_the_ID();
        ?>
">
                                <input type = "hidden" id="order_id" name="order_id" readonly="" value="0">
                                <li><label for="order_name"><small>*</small><?php 
        _e('商品名称:', 'um');
        ?>
</label><input id="order_name" name="order_name" readonly="" value="<?php 
        the_title();
        ?>
"></li>
                                <li><label for="order_price"><small>*</small><?php 
        _e('商品单价:', 'um');
        ?>
</label><input id="order_price" readonly="" value="<?php 
        echo $discount_arr[5];
        ?>
"></li>
                                <li><label for="order_quantity"><small>*</small><?php 
        _e('商品数量:', 'um');
        ?>
</label><input id="order_quantity" name="order_quantity" value="1" maxlength="8" title="<?php 
        _e('请输入购买量', 'um');
        ?>
" onkeydown="if(event.keyCode==13)return false;"></li>
                            </ul>
                            <ul>
                                <h3><?php 
        _e('收货信息', 'um');
        ?>
<span><?php 
        _e('商店', 'um');
        _e('(虚拟商品除邮箱外可不填)', 'um');
        ?>
</span></h3>
                                <?php 
        $autofill = get_user_autofill_info();
        ?>
                                <li><label for="receive_name"><?php 
        _e('收货姓名:', 'um');
        ?>
</label><input id="receive_name" name="order_receive_name" value="<?php 
        echo $autofill['user_name'];
        ?>
" onkeydown="if(event.keyCode==13)return false;"></li>
                                <li><label for="receive_address"><?php 
        _e('收货地址:', 'um');
        ?>
</label><input id="receive_address" name="order_receive_address" value="<?php 
        echo isset($autofill['user_address']) ? $autofill['user_address'] : '';
        ?>
" onkeydown="if(event.keyCode==13)return false;"></li>
                                <li><label for="receive_zip"><?php 
        _e('收货邮编:', 'um');
        ?>
</label><input id="receive_zip" name="order_receive_zip" value="<?php 
        echo isset($autofill['user_zip']) ? $autofill['user_zip'] : '';
        ?>
" onkeydown="if(event.keyCode==13)return false;"></li>
                                <li><label for="receive_email"><?php 
        _e('用户邮箱:', 'um');
        ?>
</label><input id="receive_email" name="order_receive_email" value="<?php 
        echo $autofill['user_email'];
        ?>
" onkeydown="if(event.keyCode==13)return false;"></li>
                                <li><label for="receive_phone"><?php 
        _e('电话号码:', 'um');
        ?>
</label><input id="receive_phone" name="order_receive_phone" value="<?php 
        echo isset($autofill['user_phone']) ? $autofill['user_phone'] : '';
        ?>
" onkeydown="if(event.keyCode==13)return false;"></li>
                                <li><label for="receive_mobile"><?php 
        _e('手机号码:', 'um');
        ?>
</label><input id="receive_mobile" name="order_receive_mobile" value="<?php 
        echo isset($autofill['user_cellphone']) ? $autofill['user_cellphone'] : '';
        ?>
" onkeydown="if(event.keyCode==13)return false;"></li>
                                <li><label for="body"><?php 
        _e('留言备注:', 'um');
        ?>
</label><input name="order_body" value="" onkeydown="if(event.keyCode==13)return false;"></li>
                            </ul>
                        </div>
                        <div class="checkout">
                        <?php 
        if ($currency == 1 && get_post_meta(get_the_ID(), 'product_coupon_code_support', true) == 1) {
            ?>
                            <div id="coupon">
                                <input id="coupon_code" value="" onkeydown="if(event.keyCode==13)return false;">
                                <span id="coupon_code_apply"><?php 
            _e('使用优惠码', 'um');
            ?>
</span>
                            </div>
                        <?php 
        }
        ?>
                            <button id="pay-submit" type="submit"><?php 
        _e('立即付款', 'um');
        ?>
</button>
                            <div id="total-price"><?php 
        _e('总金额:', 'um');
        ?>
<strong><?php 
        if ($currency == 1) {
            echo '¥';
        } else {
            echo '<i class="fa fa-gift"></i>';
        }
        ?>
1.00</strong><?php 
        if ($currency == 1) {
            echo ' 元';
        } else {
            echo ' 积分';
        }
        ?>
</div>
                        </div>
                        <div>
                        </div>
                        <a class="popup-close"><i class="fa fa-times"></i></a>
                    </div>
                </form>
            </div>
<?php 
    }
}
示例#2
0
    ?>
</h1>
						<p><?php 
    $contents = get_the_excerpt();
    $excerpt = wp_trim_words($contents, 50, '');
    echo $excerpt;
    ?>
</p>
					</div>
					<div class="summary row">
						<ul>
							<?php 
    $currency = get_post_meta($post->ID, 'pay_currency', true);
    ?>
							<?php 
    $discount_arr = product_smallest_price($post->ID);
    if ($discount_arr[3] == 0 && $discount_arr[4] == 0) {
        ?>
							<li class="summary-price"><span class="dt"><?php 
        _e('商品售价', 'tinection');
        ?>
</span><strong><?php 
        if ($currency == 1) {
            echo '<em>¥</em>' . sprintf('%0.2f', $discount_arr[0]) . '<em>(元)</em>';
        } else {
            echo '<em><i class="fa fa-gift"></i></em>' . sprintf('%0.2f', $discount_arr[0]) . '<em>(积分)</em>';
        }
        ?>
</strong></li>
							<?php 
    } else {
示例#3
0
function store_pay_content_show($content)
{
    $hidden_content = '';
    $content = do_shortcode($content);
    $content = wpautop($content);
    $content = lightbox_gall_replace($content);
    if (is_single()) {
        $price = product_smallest_price(get_the_ID());
        //get_post_meta(get_the_ID(),'product_price',true);
        $dl_links = get_post_meta(get_the_ID(), 'product_download_links', true);
        $pay_content = get_post_meta(get_the_ID(), 'product_pay_content', true);
        $hidden_content = deal_pay_dl_content($dl_links);
        $hidden_content .= $pay_content;
        if ($price[5] == 0 || count(get_user_order_records(get_the_ID(), 0, 1)) > 0) {
            $see_content = empty($hidden_content) ? $content : $content . '<div class="label-title"><span>付费内容</span><p>' . $hidden_content . '</p></div>';
        } else {
            $see_content = empty($hidden_content) ? $content : $content . '<div class="label-title"><span>付费内容</span><p>你只有购买支付后才能查看该内容!</p></div>';
        }
    } else {
        $see_content = $content;
    }
    return $see_content;
}
示例#4
0
文件: functions.php 项目: pemiu01/UM
function um_post_paycontent($content)
{
    if (get_post_status(get_the_ID()) != 'publish' || !get_post_meta(get_the_ID(), 'pay_switch', true)) {
        return $content;
    }
    $hidden_content = '';
    if (is_single() && get_post_type() == 'post') {
        $price = product_smallest_price(get_the_ID());
        $dl_links = get_post_meta(get_the_ID(), 'product_download_links', true);
        $pay_content = get_post_meta(get_the_ID(), 'product_pay_content', true);
        if (!count(get_user_order_records(get_the_ID(), 0, 1))) {
            $hidden_content .= um_post_source_price(get_the_ID());
        }
        if (!empty($dl_links)) {
            $hidden_content .= '<div id="pay-content"><li class="summary-content"><span class="dt" style="position:absolute;top:0;left:0;">资源信息 :</span>';
            $arr_links = explode(PHP_EOL, $dl_links);
            foreach ($arr_links as $arr_link) {
                $arr_link = explode('|', $arr_link);
                $arr_link[0] = isset($arr_link[0]) ? $arr_link[0] : '';
                $arr_link[1] = isset($arr_link[1]) ? $arr_link[1] : '';
                $arr_link[2] = isset($arr_link[2]) ? $arr_link[2] : '';
                $hidden_content .= '<p style="margin:0 0 0 75px;">' . $arr_link[0] . '</p><p style="margin:0 0 0 75px;">下载链接:';
                if ($price[5] == 0 || count(get_user_order_records(get_the_ID(), 0, 1)) > 0) {
                    $hidden_content .= '<a href="' . $arr_link[1] . '" title="' . $arr_link[0] . '" target="_blank">' . $arr_link[1] . '</a>';
                } else {
                    $hidden_content .= '*** 隐藏内容购买后可见 ***';
                }
                $hidden_content .= '&nbsp;&nbsp;下载密码:';
                if ($price[5] == 0 || count(get_user_order_records(get_the_ID(), 0, 1)) > 0) {
                    $hidden_content .= $arr_link[2];
                } else {
                    $hidden_content .= '*** 隐藏内容购买后可见 ***';
                }
                $hidden_content .= '</p>';
            }
            $hidden_content .= '</li>';
        }
        if ($price[5] == 0 || count(get_user_order_records(get_the_ID(), 0, 1)) > 0) {
            $hidden_content .= '<p style="margin-left:75px;">' . $pay_content . '</p>';
        }
        if ($price[5] != 0 && count(get_user_order_records(get_the_ID(), 0, 1)) <= 0) {
            $amount = (int) get_post_meta(get_the_ID(), 'product_amount', true);
            $btn = $amount > 0 ? '<a class="inner-buy-btn" data-top="false"><i class="fa fa-shopping-cart"></i>立即购买</a>' : '<a class="inner-soldout" href="javascript:"><i class="fa fa-shopping-cart">&nbsp;</i>缺货不可购买</a>';
            $hidden_content .= '<div id="pay"><p>购买该资源后,相关内容将发送至您的邮箱!' . $btn . '</p></div>';
        }
        $hidden_content .= '</div>';
        $see_content = empty($hidden_content) ? $content : $content . '<div class="label-title post"><span id="title"><i class="fa fa-paypal"></i>&nbsp;付费资源</span>' . $hidden_content . '</div>';
    } else {
        $see_content = $content;
    }
    return $see_content;
}